summaryrefslogtreecommitdiffstats
path: root/module/web/app/scripts/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/app/scripts/helpers')
-rw-r--r--module/web/app/scripts/helpers/fileHelper.js22
-rw-r--r--module/web/app/scripts/helpers/formatSize.js6
-rw-r--r--module/web/app/scripts/helpers/formatTime.js6
3 files changed, 18 insertions, 16 deletions
diff --git a/module/web/app/scripts/helpers/fileHelper.js b/module/web/app/scripts/helpers/fileHelper.js
index d48d7d863..156be58f0 100644
--- a/module/web/app/scripts/helpers/fileHelper.js
+++ b/module/web/app/scripts/helpers/fileHelper.js
@@ -7,17 +7,17 @@ define('helpers/fileHelper', ['handlebars', 'utils/apitypes', 'helpers/formatTim
if (file.finished)
return 'finished';
else if (file.failed)
- return "failed";
+ return 'failed';
else if (file.offline)
- return "offline";
+ return 'offline';
else if (file.online)
- return "online";
+ return 'online';
else if (file.waiting)
- return "waiting";
+ return 'waiting';
else if (file.downloading)
- return "downloading";
+ return 'downloading';
- return "";
+ return '';
}
// TODO
@@ -31,17 +31,17 @@ define('helpers/fileHelper', ['handlebars', 'utils/apitypes', 'helpers/formatTim
var msg = file.download.statusmsg;
if (file.failed) {
- s = "<i class='icon-remove'></i>&nbsp;";
+ s = '<i class="icon-remove"></i>&nbsp;';
if (file.download.error)
s += file.download.error;
else s += msg;
} else if (file.finished)
- s = "<i class='icon-ok'></i>&nbsp;" + msg;
+ s = '<i class="icon-ok"></i>&nbsp;' + msg;
else if (file.downloading)
- s = "<div class='progress'><div class='bar' style='width: " + file.progress + "%'>&nbsp;&nbsp;" +
- formatTime(file.eta) + "</div></div>";
+ s = '<div class="progress"><div class="bar" style="width: ' + file.progress + '%">&nbsp;&nbsp;' +
+ formatTime(file.eta) + '</div></div>';
else if (file.waiting)
- s = "<i class='icon-time'></i>&nbsp;" + formatTime(file.eta);
+ s = '<i class="icon-time"></i>&nbsp;' + formatTime(file.eta);
else
s = msg;
diff --git a/module/web/app/scripts/helpers/formatSize.js b/module/web/app/scripts/helpers/formatSize.js
index a50588bc6..3b62e74c7 100644
--- a/module/web/app/scripts/helpers/formatSize.js
+++ b/module/web/app/scripts/helpers/formatSize.js
@@ -1,9 +1,11 @@
// Format bytes in human readable format
define('helpers/formatSize', ['handlebars'], function(Handlebars) {
- var sizes = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"];
+ 'use strict';
+
+ var sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB'];
function formatSize(bytes, options) {
if (!bytes || bytes === 0) return '0 B';
- var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
+ var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10);
// round to two digits
return (bytes / Math.pow(1024, i)).toFixed(2) + ' ' + sizes[i];
}
diff --git a/module/web/app/scripts/helpers/formatTime.js b/module/web/app/scripts/helpers/formatTime.js
index 77d67a39c..757ff73ad 100644
--- a/module/web/app/scripts/helpers/formatTime.js
+++ b/module/web/app/scripts/helpers/formatTime.js
@@ -1,12 +1,12 @@
// Format bytes in human readable format
-define('helpers/formatTime', ['handlebars', 'utils/remaining'], function(Handlebars, Remaining) {
-
+define('helpers/formatTime', ['handlebars', 'vendor/remaining'], function(Handlebars, Remaining) {
+ 'use strict';
function formatTime(seconds, options) {
if (seconds === Infinity)
return '∞';
else if (!seconds || seconds <= 0)
- return "-";
+ return '-';
// TODO: digital or written string
return Remaining.getStringDigital(seconds, window.dates);