diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-04-10 03:26:28 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-04-10 03:26:28 -0700 |
commit | a9358b6ffad0ac98a4e60f43beda24a22bc0224d (patch) | |
tree | b8f9e3ddbd299d16f8203029ab2b500e70e32c12 /tempo.js | |
parent | 21bbce4c069778b98441c2d0af69f8a1397bca9f (diff) | |
download | tempo-a9358b6ffad0ac98a4e60f43beda24a22bc0224d.tar.gz tempo-a9358b6ffad0ac98a4e60f43beda24a22bc0224d.tar.xz |
refactor and make Firefox-friendly
Diffstat (limited to 'tempo.js')
-rw-r--r-- | tempo.js | 17 |
1 files changed, 5 insertions, 12 deletions
@@ -1,18 +1,12 @@ -// Copyright 2014 David Vazgenovich Shakaryan <dvshakaryan@gmail.com> -// 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() }); |