diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-08-11 20:36:10 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-08-11 20:36:10 +0200 |
commit | 080643e89af62013d70bb574cd54cf4876628515 (patch) | |
tree | e79e3bebe9175da613c4a339fc4ac3fa172ecced /pyload/web/app/scripts/helpers/formatTimeLeft.js | |
parent | another try to fix broken accounts (diff) | |
download | pyload-080643e89af62013d70bb574cd54cf4876628515.tar.xz |
improved account list
Diffstat (limited to 'pyload/web/app/scripts/helpers/formatTimeLeft.js')
-rw-r--r-- | pyload/web/app/scripts/helpers/formatTimeLeft.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pyload/web/app/scripts/helpers/formatTimeLeft.js b/pyload/web/app/scripts/helpers/formatTimeLeft.js new file mode 100644 index 000000000..dafeda3e2 --- /dev/null +++ b/pyload/web/app/scripts/helpers/formatTimeLeft.js @@ -0,0 +1,17 @@ +// Format seconds in human readable format +define('helpers/formatTimeLeft', ['handlebars', 'vendor/remaining'], function(Handlebars, Remaining) { + 'use strict'; + + function formatTimeLeft(seconds, options) { + if (seconds === Infinity) + return '∞'; + else if (!seconds || seconds <= 0) + return '-'; + + // TODO: digital or written string + return Remaining.getStringDigital(seconds, window.dates); + } + + Handlebars.registerHelper('formatTimeLeft', formatTimeLeft); + return formatTimeLeft; +});
\ No newline at end of file |