diff --git a/Assets/Assets/BDPayload.js b/Assets/Assets/BDPayload.js index fdfbd3f..abef179 100644 --- a/Assets/Assets/BDPayload.js +++ b/Assets/Assets/BDPayload.js @@ -1,62 +1,194 @@ -/*(function(){ - var Force = false; - var Duration = OcttTime.Duration; - var Curr = OcttTime.YearsAgeNow() % 1; - if (Force || (Curr < Duration) || ((1 - Curr) < Duration)) { - if ((Curr < Duration)) { // After day - var Dir = 'right'; - } else - if ((1 - Curr) < Duration) { // Before day - var Dir = 'left'; +var BDRunInterval; + +function ReadCookie(Key) { + var Value; + document.cookie.split('; ').forEach(function(Cookie){ + if (Cookie.startsWith(`${Key}=`)) { + Value = Cookie.split('=')[1]; }; + }); + return Value; +}; + +function BDDuration() { + return OcttTime.Duration; +}; +function BDCurrent() { + return OcttTime.YearsAgeNow() % 1; +}; + +function BDMargin(Duration, Current) { + if (Current < Duration) { + return 'After'; + } else + if ((1 - Current) < Duration) { + return 'Before'; + }; +}; + +function BDRun() { + if (BDInit(BDDuration(), BDCurrent())) { + BDRunInterval = setInterval(function(){ + BDDraw(BDDuration(), BDCurrent()); + }, 200); + }; +}; + +function BDInit(Duration, Current) { + var TimeMargin = BDMargin(Duration, Current); + if ( + (TimeMargin === 'After' && !ReadCookie('BDAfter')) + || + (TimeMargin === 'Before' && !ReadCookie('BDBefore')) + ) { var BDCover = document.createElement('div'); var BDView = document.createElement('div'); - //var BDProg = document.createElement('div'); + BDCover.id = 'BDCover'; + BDView.id = 'BDView'; BDCover.style = ` position: fixed; - z-index: 999998; + z-index: 999997; top: 0; left: 0; width: 100vw; height: 100vh; - background-color: black; - opacity: ${0.5}; - `; - BDView.style = ` - position: fixed; - z-index: 999999; - top: 0; - left: 0; - width: 100vw; - height: 100vh; - color: white; + background-color: black !important; `; BDView.innerHTML = ` -
+ + + ❌️ Chiudi + + `; - //BDProg.style = ` - // position: fixed; - // z-index: 999999; - // top: 35%; - // height: 4em; - // background-color: white; - // ${'left'}: 0; - // width: ${50}%; - //`; document.body.appendChild(BDCover); document.body.appendChild(BDView); - //document.body.appendChild(BDProg); - //if (true) { - // setTimeout(function(){ - // Wrap.innerHTML = '
+ A causa di compleannoctt,
+ il sitoctt è temporaneamente in manutenzione,
+ fino al completamento della barra di progresso.
+
+ Questa non è assolutamente una scusa per introdurre
+ un easter egg stagionale nel sito, ovviamente.
+
+ Il sitoctt è temporaneamente in manutenzione,
+ fino al completamento della barra di progresso.
+
+ Ci dispiace per il disagio.
+