2024-01-24 21:53:26 +00:00
|
|
|
#include utility.js
|
2023-07-17 14:37:39 +00:00
|
|
|
|
2024-01-24 21:53:26 +00:00
|
|
|
const MszChristmas2019EventInfo = function() {
|
|
|
|
return {
|
|
|
|
isActive: () => {
|
|
|
|
const d = new Date;
|
|
|
|
return d.getMonth() === 11 && d.getDate() > 5 && d.getDate() < 27;
|
|
|
|
},
|
|
|
|
dispatch: () => {
|
|
|
|
const impl = new MszChristmas2019Event;
|
|
|
|
impl.dispatch();
|
|
|
|
return impl;
|
|
|
|
},
|
|
|
|
};
|
2022-09-13 13:14:49 +00:00
|
|
|
};
|
2024-01-24 21:53:26 +00:00
|
|
|
|
|
|
|
const MszChristmas2019Event = function() {
|
|
|
|
const propName = 'msz-christmas-' + (new Date).getFullYear().toString();
|
|
|
|
const headerBg = $q('.header__background');
|
|
|
|
const menuBgs = Array.from($qa('.header__desktop__submenu__background'));
|
|
|
|
|
|
|
|
if(!localStorage.getItem(propName))
|
|
|
|
localStorage.setItem(propName, '0');
|
|
|
|
|
|
|
|
const changeColour = () => {
|
|
|
|
let count = parseInt(localStorage.getItem(propName));
|
|
|
|
document.body.style.setProperty('--header-accent-colour', (count++ % 2) ? 'green' : 'red');
|
|
|
|
localStorage.setItem(propName, count.toString());
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
changeColour: changeColour,
|
|
|
|
dispatch: () => {
|
|
|
|
if(headerBg)
|
|
|
|
headerBg.style.transition = 'background-color .4s';
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
if(headerBg)
|
|
|
|
headerBg.style.transition = 'background-color 1s';
|
|
|
|
|
|
|
|
for(const menuBg of menuBgs)
|
|
|
|
menuBg.style.transition = 'background-color 1s';
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
changeColour();
|
|
|
|
setInterval(changeColour, 10000);
|
|
|
|
},
|
|
|
|
};
|
2022-09-13 13:14:49 +00:00
|
|
|
};
|