Update clkinfo.js to tap to show city name

master
RKBoss6 2025-06-19 15:51:11 -04:00 committed by GitHub
parent 231271a94f
commit 0b53dc956f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 59 additions and 9 deletions

View File

@ -20,7 +20,7 @@
const laTimeOffset=-420; const laTimeOffset=-420;
const parisTimeOffset=120; const parisTimeOffset=120;
var showCityName=false;
function getWorldDateString(cityName){ function getWorldDateString(cityName){
//Gets difference between UTC and local time //Gets difference between UTC and local time
@ -97,6 +97,7 @@
//Nothing else matches //Nothing else matches
finalCityStr=cityName; finalCityStr=cityName;
} }
}else{ }else{
finalCityStr=cityName; finalCityStr=cityName;
@ -106,7 +107,13 @@
var finalStr=finalCityStr+"\n"+clockStr; //var finalStr=finalCityStr+"\n"+clockStr+"\n";
if(showCityName){
//show city
var finalStr=finalCityStr;
}else{
var finalStr=clockStr;
}
return finalStr; return finalStr;
@ -125,7 +132,7 @@
return { return {
text : getWorldDateString("London"), text : getWorldDateString("London"),
//blank image //blank image
img : atob("") img : atob("GBiBAAB+AAP/wAeB4A4AcBgYGDAYDHAYDmAYBmAYBsAYA8AYA8AYA8AcA8AOA8AHA2ADBmAABnAADjAADBgAGA4AcAeB4AP/wAB+AA==")
}; };
}, },
show : function() { show : function() {
@ -139,7 +146,14 @@
hide : function() { hide : function() {
clearInterval(this.interval); clearInterval(this.interval);
this.interval = undefined; this.interval = undefined;
},
run : function() {
//toggle showCityName
showCityName=!showCityName;
this.emit("redraw");
} }
}, },
{ name : "Mumbai", { name : "Mumbai",
@ -147,7 +161,7 @@
return { return {
text : getWorldDateString("Mumbai"), text : getWorldDateString("Mumbai"),
//blank image //blank image
img : atob("") img : atob("GBiBAAB+AAP/wAeB4A4AcBgYGDAYDHAYDmAYBmAYBsAYA8AYA8AYA8AcA8AOA8AHA2ADBmAABnAADjAADBgAGA4AcAeB4AP/wAB+AA==")
}; };
}, },
show : function() { show : function() {
@ -161,6 +175,12 @@
hide : function() { hide : function() {
clearInterval(this.interval); clearInterval(this.interval);
this.interval = undefined; this.interval = undefined;
},
run : function() {
//toggle showCityName
showCityName=!showCityName;
this.emit("redraw");
} }
}, },
@ -169,7 +189,7 @@
return { return {
text : getWorldDateString("New York"), text : getWorldDateString("New York"),
//blank image //blank image
img : atob("") img : atob("GBiBAAB+AAP/wAeB4A4AcBgYGDAYDHAYDmAYBmAYBsAYA8AYA8AYA8AcA8AOA8AHA2ADBmAABnAADjAADBgAGA4AcAeB4AP/wAB+AA==")
}; };
}, },
show : function() { show : function() {
@ -183,6 +203,12 @@
hide : function() { hide : function() {
clearInterval(this.interval); clearInterval(this.interval);
this.interval = undefined; this.interval = undefined;
},
run : function() {
//toggle showCityName
showCityName=!showCityName;
this.emit("redraw");
} }
}, },
@ -191,7 +217,7 @@
return { return {
text : getWorldDateString("Tokyo"), text : getWorldDateString("Tokyo"),
//blank image //blank image
img : atob("") img : atob("GBiBAAB+AAP/wAeB4A4AcBgYGDAYDHAYDmAYBmAYBsAYA8AYA8AYA8AcA8AOA8AHA2ADBmAABnAADjAADBgAGA4AcAeB4AP/wAB+AA==")
}; };
}, },
show : function() { show : function() {
@ -205,6 +231,12 @@
hide : function() { hide : function() {
clearInterval(this.interval); clearInterval(this.interval);
this.interval = undefined; this.interval = undefined;
},
run : function() {
//toggle showCityName
showCityName=!showCityName;
this.emit("redraw");
} }
}, },
@ -213,7 +245,7 @@
return { return {
text : getWorldDateString("Dubai"), text : getWorldDateString("Dubai"),
//blank image //blank image
img : atob("") img : atob("GBiBAAB+AAP/wAeB4A4AcBgYGDAYDHAYDmAYBmAYBsAYA8AYA8AYA8AcA8AOA8AHA2ADBmAABnAADjAADBgAGA4AcAeB4AP/wAB+AA==")
}; };
}, },
show : function() { show : function() {
@ -227,6 +259,12 @@
hide : function() { hide : function() {
clearInterval(this.interval); clearInterval(this.interval);
this.interval = undefined; this.interval = undefined;
},
run : function() {
//toggle showCityName
showCityName=!showCityName;
this.emit("redraw");
} }
}, },
{ name : "Los Angeles", { name : "Los Angeles",
@ -234,7 +272,7 @@
return { return {
text : getWorldDateString("Los Angeles"), text : getWorldDateString("Los Angeles"),
//blank image //blank image
img : atob("") img : atob("GBiBAAB+AAP/wAeB4A4AcBgYGDAYDHAYDmAYBmAYBsAYA8AYA8AYA8AcA8AOA8AHA2ADBmAABnAADjAADBgAGA4AcAeB4AP/wAB+AA==")
}; };
}, },
show : function() { show : function() {
@ -248,6 +286,12 @@
hide : function() { hide : function() {
clearInterval(this.interval); clearInterval(this.interval);
this.interval = undefined; this.interval = undefined;
},
run : function() {
//toggle showCityName
showCityName=!showCityName;
this.emit("redraw");
} }
}, },
@ -256,7 +300,7 @@
return { return {
text : getWorldDateString("Paris"), text : getWorldDateString("Paris"),
//blank image //blank image
img : atob("") img : atob("GBiBAAB+AAP/wAeB4A4AcBgYGDAYDHAYDmAYBmAYBsAYA8AYA8AYA8AcA8AOA8AHA2ADBmAABnAADjAADBgAGA4AcAeB4AP/wAB+AA==")
}; };
}, },
show : function() { show : function() {
@ -270,6 +314,12 @@
hide : function() { hide : function() {
clearInterval(this.interval); clearInterval(this.interval);
this.interval = undefined; this.interval = undefined;
},
run : function() {
//toggle showCityName
showCityName=!showCityName;
this.emit("redraw");
} }
} }