diff --git a/files/assets/js/chat.js b/files/assets/js/chat.js index 213dfaafd..549639412 100644 --- a/files/assets/js/chat.js +++ b/files/assets/js/chat.js @@ -367,3 +367,22 @@ setTimeout(function () { document.addEventListener('DOMContentLoaded', function () { box.scrollTo(0, box.scrollHeight) }); + +if (location.pathname == '/orgy') { + const now = new Date(); + const day_of_week = now.getUTCDay() + + if (day_of_week == 5 || day_of_week == 7) { + let hour + if (day_of_week == 5) hour = 0 + else hour = 20 + + let millis = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), hour, 0, 10) - now; + if (millis < 0) + millis += 86400000; + + const minutes = Math.round(millis/1000/60*10)/10 + console.log(`Refreshing page in ${minutes} minutes`) + setTimeout(() => location.reload(), millis); + } +} diff --git a/files/assets/js/orgy_file.js b/files/assets/js/orgy_file.js index 10b01573b..acf6d57d5 100644 --- a/files/assets/js/orgy_file.js +++ b/files/assets/js/orgy_file.js @@ -38,21 +38,3 @@ orgy_file.addEventListener("timeupdate", function(){ }, 300000); } }); - -const now = new Date(); -const now_utc = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds()); - -let millis_00 = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), 0, 0, 10) - now; -if (millis_00 < 0) - millis_00 += 86400000; - -console.log(millis_00/1000/60) -setTimeout(() => location.reload(), millis_00); - - -let millis_20 = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), 20, 0, 10) - now; -if (millis_20 < 0) - millis_20 += 86400000; - -console.log(millis_20/1000/60) -setTimeout(() => location.reload(), millis_20);