forked from extern/the-glorious-startpage
rewrite clock script
This commit is contained in:
parent
31bf7fe60d
commit
49a2462854
@ -1,7 +1,7 @@
|
|||||||
var clock = document.getElementById("clock")
|
var clock = document.getElementById("clock")
|
||||||
|
|
||||||
// Append 0 before time elements if less hour's than 10
|
// Append 0 before time elements if less hour's than 10
|
||||||
function appendZero(k) {
|
const appendZero = (k) => {
|
||||||
if (k < 10) {
|
if (k < 10) {
|
||||||
return "0" + k;
|
return "0" + k;
|
||||||
} else {
|
} else {
|
||||||
@ -9,7 +9,8 @@ function appendZero(k) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function currentTime() {
|
// Update/Set clock
|
||||||
|
const currentTime = () => {
|
||||||
// Date object
|
// Date object
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
|
|
||||||
@ -33,6 +34,6 @@ function currentTime() {
|
|||||||
var t = setTimeout(currentTime, 1000);
|
var t = setTimeout(currentTime, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start
|
// Start clock
|
||||||
window.onload = currentTime();
|
window.onload = currentTime();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user