diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-03-23 21:05:02 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-03-23 21:05:02 (GMT) |
commit | 81a24e4523784786dcc45abcf7a48c1e563ab2d1 (patch) | |
tree | 69df97d34fbbde07fbb1a492e5faf9c7e2784986 | |
parent | 67ecaf31f7125c9d24d3c52dded063ad2f5a788f (diff) |
moved javascript variables to own namepsace
-rw-r--r-- | www/js/clock.js | 2 | ||||
-rw-r--r-- | www/js/utils.js | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/www/js/clock.js b/www/js/clock.js index a2b0628..673374e 100644 --- a/www/js/clock.js +++ b/www/js/clock.js @@ -21,6 +21,8 @@ 'use strict'; +var RHRD = RHRD || {}; + function Clock() { this.draw_callbacks = $.Callbacks('unique'); diff --git a/www/js/utils.js b/www/js/utils.js index 1c5727a..3af67ff 100644 --- a/www/js/utils.js +++ b/www/js/utils.js @@ -21,6 +21,8 @@ 'use strict'; +var RHRD = RHRD || {}; + Number.prototype.pad = function(size) { var s = String(this); while (s.length < (size || 2)) {s = "0" + s;} @@ -55,6 +57,19 @@ function format_datetime(d) { return datetimestr; } +function msToTimeString(time) { + if(time == '-') return time; + + var h = Number(Math.floor(time / 3600000)); + time %= 3600000; + var m = Number(Math.floor(time / 60000)); + time %= 60000; + var s = Number(Math.floor(time / 1000)); + var hs = Number(Math.floor((time % 1000)/100)); + + return h + ':' + m.pad(2) + ':' + s.pad(2) + '.' + hs; +} + function get_rd_week(msEpoch) { // // This computes the current Rivendell Week based on the number |