42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
function begin()
|
|
{
|
|
const settings_div = document.querySelector('#settings');
|
|
const status_div = document.querySelector('#status');
|
|
let settings = JSON.parse(settings_div.innerHTML);
|
|
let status = status_div.innerHTML;
|
|
console.log("msg");
|
|
console.log(settings);
|
|
console.log(status);
|
|
|
|
let auto_reload_page_interval = 0.0;
|
|
if(settings) {
|
|
auto_reload_page_interval = settings.advanced.auto_reload_page_interval;
|
|
}
|
|
|
|
// too short to cause error.
|
|
if(auto_reload_page_interval < 0.8) {
|
|
auto_reload_page_interval = 0.8;
|
|
}
|
|
|
|
if(status=='ON') {
|
|
setInterval(() => {
|
|
busyFor = 0;
|
|
reload();
|
|
}, auto_reload_page_interval * 1000);
|
|
}
|
|
}
|
|
|
|
function dom_ready()
|
|
{
|
|
//console.log("checking...");
|
|
const settings_div = document.querySelector('#settings');
|
|
if(settings_div) {
|
|
clearInterval(myInterval);
|
|
begin();
|
|
}
|
|
}
|
|
|
|
myInterval = setInterval(() => {
|
|
dom_ready();
|
|
}, 100);
|