From a9358b6ffad0ac98a4e60f43beda24a22bc0224d Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sun, 10 Apr 2022 03:26:28 -0700 Subject: refactor and make Firefox-friendly --- tempo.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'tempo.js') diff --git a/tempo.js b/tempo.js index aafb078..40b426a 100644 --- a/tempo.js +++ b/tempo.js @@ -1,18 +1,12 @@ -// Copyright 2014 David Vazgenovich Shakaryan -// Distributed under the terms of the GNU General Public License v2. -// See http://www.gnu.org/licenses/gpl-2.0.txt for the full license text. - var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; - var timeformat = null; function padTime(x) { - if(x < 10) { + if (x < 10) return '0' + x; - } else { + else return x; - } } function updateTime() { @@ -26,9 +20,8 @@ function updateTime() { var dm = date.getMonth(); var dy = date.getFullYear(); - if(timeformat == 12) { + if (timeformat == 12) h = (h + 11) % 12 + 1; - } var str_t = padTime(h) + '  ' + padTime(m) + '  ' + padTime(s); @@ -43,10 +36,10 @@ function startTempo() { updateTime(); - setTimeout(function() {updateTime(); setInterval(updateTime, 1000)}, + setTimeout(function() { updateTime(); setInterval(updateTime, 1000) }, 1000 - new Date().getTime() % 1000); } window.onload = startTempo; -document.addEventListener('contextmenu', function(e) {e.preventDefault()}); +document.addEventListener('contextmenu', function(e) { e.preventDefault() }); -- cgit v1.2.3-70-g09d2