mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 04:15:17 +00:00
Added easter egg (a pacman game)
This commit is contained in:
@ -1136,6 +1136,13 @@ var ComunicWeb = {
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Easter egg : pacman
|
||||
*/
|
||||
pacman: {
|
||||
//TODO : implement
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
|
46
assets/js/components/pacman.js
Normal file
46
assets/js/components/pacman.js
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* A little easter egg....
|
||||
* A pacman !
|
||||
*
|
||||
* @author Pierre HUBERT
|
||||
*/
|
||||
|
||||
ComunicWeb.components.pacman = {
|
||||
|
||||
/**
|
||||
* Open pacman game
|
||||
*/
|
||||
open: function(){
|
||||
|
||||
var dialog = ComunicWeb.common.messages.createDialogSkeleton({
|
||||
title: "Pacman game",
|
||||
type: "default"
|
||||
});
|
||||
$(dialog.modal).modal("show");
|
||||
|
||||
//Create modal close function
|
||||
var closeModal = function(){
|
||||
$(dialog.modal).modal("hide");
|
||||
};
|
||||
dialog.cancelButton.addEventListener("click", closeModal);
|
||||
dialog.closeModal.addEventListener("click", closeModal);
|
||||
|
||||
//This modal must be completely cleaned
|
||||
$(dialog.modal).on("hidden.bs.modal", function(){
|
||||
emptyElem(dialog.modal);
|
||||
dialog.modal.remove();
|
||||
});
|
||||
|
||||
//Create iframe
|
||||
createElem2({
|
||||
appendTo: dialog.modalBody,
|
||||
type: "iframe",
|
||||
class: "pacman-iframe",
|
||||
src: ComunicWeb.__config.assetsURL + "3rdparty/pacman"
|
||||
});
|
||||
|
||||
//Add a notice
|
||||
add_p(dialog.modalBody, "Please click on the pacman grid and press N to start a new game.");
|
||||
},
|
||||
|
||||
}
|
@ -79,7 +79,7 @@ ComunicWeb.pages.settings.sections.general = {
|
||||
});
|
||||
|
||||
//Display user ID
|
||||
createFormGroup({
|
||||
var userIDInput = createFormGroup({
|
||||
target: target,
|
||||
label: "User ID",
|
||||
type: "text",
|
||||
@ -88,6 +88,18 @@ ComunicWeb.pages.settings.sections.general = {
|
||||
additionalGroupClasses: "input-user-id"
|
||||
});
|
||||
|
||||
//Easter egg : open pacman when clicking 10 times on user ID input label
|
||||
var clicks = 0;
|
||||
userIDInput.parentNode.parentNode.addEventListener("click", function(){
|
||||
clicks++;
|
||||
|
||||
if(clicks >= 10) {
|
||||
ComunicWeb.components.pacman.open();
|
||||
clicks = 0;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//Display user email
|
||||
createFormGroup({
|
||||
target: target,
|
||||
|
Reference in New Issue
Block a user