summaryrefslogtreecommitdiff
path: root/tempo.js
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-15 02:54:39 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-15 02:54:39 -0700
commita82a5ed69075d1069d3bbe64db5a162906062611 (patch)
tree40652ea73a506020df5c947ce0803b5d68c5c406 /tempo.js
parentfd37abfe0ecfb4126f3c9b2cb8148f74fa17e97e (diff)
downloadtempo-a82a5ed69075d1069d3bbe64db5a162906062611.tar.gz
tempo-a82a5ed69075d1069d3bbe64db5a162906062611.tar.xz
make colours configurable
Diffstat (limited to 'tempo.js')
-rw-r--r--tempo.js34
1 files changed, 21 insertions, 13 deletions
diff --git a/tempo.js b/tempo.js
index f280142..ae3fa22 100644
--- a/tempo.js
+++ b/tempo.js
@@ -1,5 +1,5 @@
-var timeformat = null;
-var months = ['January', 'February', 'March', 'April', 'May', 'June',
+let timefmt = null;
+const months = ['January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'];
function padTime(x) {
@@ -7,29 +7,37 @@ function padTime(x) {
}
function updateTime() {
- var date = new Date();
+ let date = new Date();
- var h = date.getHours();
- var m = date.getMinutes();
- var s = date.getSeconds();
+ let h = date.getHours();
+ let m = date.getMinutes();
+ let s = date.getSeconds();
- var dd = date.getDate();
- var dm = date.getMonth();
- var dy = date.getFullYear();
+ let dd = date.getDate();
+ let dm = date.getMonth();
+ let dy = date.getFullYear();
- if (timeformat == 12) // default to 24
+ if (timefmt == 12) // default to 24
h = (h + 11) % 12 + 1;
- var str_t = padTime(h) + '&nbsp;&nbsp;' + padTime(m) +
+ let str_t = padTime(h) + '&nbsp;&nbsp;' + padTime(m) +
'&nbsp;&nbsp' + padTime(s);
- var str_d = dd + ' ' + months[dm] + ' ' + dy;
+ let str_d = dd + ' ' + months[dm] + ' ' + dy;
document.getElementById('timeval').innerHTML = str_t;
document.getElementById('dateval').innerHTML = str_d;
}
function startTempo() {
- timeformat = localStorage['timeformat'];
+ timefmt = localStorage['timefmt'];
+
+ let fg = localStorage['fg'];
+ if (fg)
+ document.body.style.color = fg;
+
+ let bg = localStorage['bg'];
+ if (bg)
+ document.body.style.backgroundColor = bg;
updateTime();
setTimeout(function() { updateTime(); setInterval(updateTime, 1000) },