Easter egg special Manon

This commit is contained in:
Pierre HUBERT 2020-05-08 10:56:05 +02:00
parent 4c92f3398d
commit 8bbf55c7ed
8 changed files with 137 additions and 0 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1013 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

62
assets/3rdparty/clippy.js/clippy.css vendored Normal file
View File

@ -0,0 +1,62 @@
.clippy, .clippy-balloon {
position: fixed;
z-index: 1000;
cursor: pointer;
}
.clippy-balloon {
background: #FFC;
color: black;
padding: 8px;
border: 1px solid black;
border-radius: 5px;
}
.clippy-content {
max-width: 200px;
min-width: 120px;
font-family: "Microsoft Sans", sans-serif;
font-size: 10pt;
}
.clippy-tip {
width: 10px;
height: 16px;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAgCAMAAAAlvKiEAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAlQTFRF///MAAAA////52QwgAAAAAN0Uk5T//8A18oNQQAAAGxJREFUeNqs0kEOwCAIRFHn3//QTUU6xMyyxii+jQosrTPkyPEM6IN3FtzIRk1U4dFeKWQiH6pRRowMVKEmvronEynkwj0uZJgR22+YLopPSo9P34wJSamLSU7lSIWLJU7NkNomNlhqxUeAAQC+TQLZyEuJBwAAAABJRU5ErkJggg==) no-repeat;
position: absolute;
}
.clippy-top-left .clippy-tip {
top: 100%;
margin-top: 0px;
left: 100%;
margin-left: -50px;
}
.clippy-top-right .clippy-tip {
top: 100%;
margin-top: 0px;
left: 0;
margin-left: 50px;
background-position: -10px 0;
}
.clippy-bottom-right .clippy-tip {
top: 0;
margin-top: -16px;
left: 0;
margin-left: 50px;
background-position: -10px -16px;
}
.clippy-bottom-left .clippy-tip {
top: 0;
margin-top: -16px;
left: 100%;
margin-left: -50px;
background-position: 0px -16px;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,70 @@
/**
* Manon's special (hidden) features
*
* @author Pierre Hubert
*/
/**
* Check if it is Manon's birthday
*/
async function checkManonBirthday() {
// Manon's feature only
if(userID() !== 150)
return;
const date = new Date();
if(date.getMonth() != 4 && date.getDay() != 8)//TODO: replace
return;
// Load clippy
const css = document.createElement("link");
css.rel = "stylesheet";
css.type = "text/css";
css.href = ComunicWeb.__config.assetsURL + "3rdparty/clippy.js/clippy.css"
document.head.appendChild(css);
const js = document.createElement("script");
js.type = "text/javascript";
js.src = ComunicWeb.__config.assetsURL + "3rdparty/clippy.js/clippy.min.js"
document.body.appendChild(js);
await new Promise((res, rej) => js.addEventListener("load", res));
// Configure clippy
clippy.BASE_PATH = ComunicWeb.__config.assetsURL + "3rdparty/clippy.js/Agents/";
// Load Merlin
const agent = await new Promise((res, rej) => clippy.load('Merlin', res));
// Wait for Manon
await new Promise((res, rej) => window.addEventListener("mousedown", res, {once: true}));
// Show the agent
agent.show();
agent.play("Announce");
agent.speak("Joyeux anniversaire Manon ! Que cette nouvelle année qui commence pour toi t'apporte la joie !", true);
setTimeout(() => agent.stopCurrent(), 8000);
agent.play("Pleased", 6000, () => agent.hide());
}
// Do the check on first page load only
document.addEventListener("wsOpen", () => {
setTimeout(() => checkManonBirthday(), 1000);
}, {
once: true
})

View File

@ -472,6 +472,7 @@ class Dev {
//Pacman component (easter egg) //Pacman component (easter egg)
"js/components/pacman.js", "js/components/pacman.js",
"js/components/manon.js",
//User scripts //User scripts
"js/user/loginTokens.js", "js/user/loginTokens.js",