Only update the background if connected to the Internet
This commit is contained in:
parent
76b00b2d43
commit
bd20c403b3
|
@ -6,10 +6,11 @@ var backgroundList = ["img/1.png", "img/2.png", "img/3.png", "img/4.png",
|
|||
|
||||
$(document).ready(function () {
|
||||
calcBackground();
|
||||
setInterval(calcBackground, 60000);
|
||||
setInterval(calcBackground, 60000); // run every minute
|
||||
});
|
||||
|
||||
function calcBackground() {
|
||||
if (navigator.onLine) {
|
||||
var now = new Date();
|
||||
var hours = now.getHours();
|
||||
var mins = now.getMinutes();
|
||||
|
@ -34,6 +35,7 @@ function calcBackground() {
|
|||
else
|
||||
setBackground(7, true);
|
||||
}
|
||||
}
|
||||
|
||||
function setBackground(num, dark) {
|
||||
// dark is a boolean that indicates the brightness of the background
|
||||
|
|
Loading…
Reference in a new issue