fix orgy refreshing

master
Aevann 2023-09-22 00:05:14 +03:00
parent 64f66347a1
commit 2a31e8a841
2 changed files with 19 additions and 18 deletions

View File

@ -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);
}
}

View File

@ -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);