diff options
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() }); |