2024-05-16 00:15:34 +08:00
|
|
|
document.addEventListener("DOMContentLoaded", function(event) {
|
|
|
|
if (document.hasFocus()) {
|
|
|
|
// hide reload button if the site reloads automatically
|
|
|
|
let list = document.getElementsByClassName("reload button");
|
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
|
|
// list[i] is a node with the desired class name
|
|
|
|
list[i].style.display = 'none';
|
|
|
|
}
|
2022-03-12 00:00:24 +08:00
|
|
|
|
2024-05-16 00:15:34 +08:00
|
|
|
// set timeout for reload
|
|
|
|
setTimeout(function(){
|
|
|
|
window.location.reload(1);
|
|
|
|
}, 5000);
|
|
|
|
} else {
|
|
|
|
window.addEventListener("beforeunload", function() {
|
|
|
|
document.getElementById('overlay').classList.add('loading')
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|