Got this code, it won't run I keep getting errors in the chrome console. Need helps, Cheers
Fixed a few errors but it still runs wobbly... ;/
Code:
function checkTimeAndLoad(){
var date = new Date();
var currentHour = date.getHours();
var currentMinutes = date.getMinutes();
var currentSeconds = date.getSeconds();
var hourRefresh = 22;
var minuteRefresh = 55;
while (true){
if (currentHour != hourRefresh){
sleep(60 * 1000 - (currentSeconds)); #wait the seconds left in the minute
sleep(60*1000*60-(currentMinutes-1); #wait the minutes left in the hour
var date = new Date();
currentHour = date.getHours(); #get the new hour
currentSeconds = date.getSeconds();
}else if (currentMinutes != minuteRefresh){
sleep(60 * 1000 - (currentSeconds)); #wait the seconds left in the minute
sleep(60*1000*60-(currentMinutes-1); #wait the minutes left in the hour
var date = new Date();
currentMinutes = date.getMinutes();
currentSeconds = date.getSeconds();
}else{
break;
}
window.location.href = (url)
}
}
checkTimeandLoad();
Fixed a few errors but it still runs wobbly... ;/
Code:
function checkTimeAndRefresh(){
var date = new Date();
var currentHour = date.getHours();
var currentMinutes = date.getMinutes();
var currentSeconds = date.getSeconds();
var hourRefresh = 23;
var minuteRefresh = 18;
while (true){
if (currentHour != hourRefresh){
setTimeout(60 * 1000 - (currentSeconds));
setTimeout(60*1000*60-(currentMinutes-1));
var date = new Date();
currentHour = date.getHours();
currentSeconds = date.getSeconds();
}else if (currentMinutes != minuteRefresh){
setTimeout(60 * 1000 - (currentSeconds));
setTimeout(60*1000*60-(currentMinutes-1));
var date = new Date();
currentMinutes = date.getMinutes();
currentSeconds = date.getSeconds();
}else{
break;
}
window.location.href = url
}
}
checkTimeAndLoad();
Last edited: