summaryrefslogtreecommitdiffstats
path: root/deluge/ui/web/js/deluge-all/Formatters.js
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/ui/web/js/deluge-all/Formatters.js')
-rw-r--r--deluge/ui/web/js/deluge-all/Formatters.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/deluge/ui/web/js/deluge-all/Formatters.js b/deluge/ui/web/js/deluge-all/Formatters.js
index 0ea3b6903..5c909987c 100644
--- a/deluge/ui/web/js/deluge-all/Formatters.js
+++ b/deluge/ui/web/js/deluge-all/Formatters.js
@@ -1,6 +1,6 @@
/*!
* Deluge.Formatters.js
- *
+ *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -56,11 +56,11 @@ Deluge.Formatters = {
}
timestamp = timestamp * 1000;
var date = new Date(timestamp);
- return String.format('{0}/{1}/{2} {3}:{4}:{5}',
+ return Ext.String.format('{0}/{1}/{2} {3}:{4}:{5}',
zeroPad(date.getDate(), 2), zeroPad(date.getMonth() + 1, 2), date.getFullYear(),
zeroPad(date.getHours(), 2), zeroPad(date.getMinutes(), 2), zeroPad(date.getSeconds(), 2));
},
-
+
/**
* Formats the bytes value into a string with KiB, MiB or GiB units.
*
@@ -71,16 +71,16 @@ Deluge.Formatters = {
size: function(bytes, showZero) {
if (!bytes && !showZero) return '';
bytes = bytes / 1024.0;
-
+
if (bytes < 1024) { return bytes.toFixed(1) + ' KiB'; }
else { bytes = bytes / 1024; }
-
+
if (bytes < 1024) { return bytes.toFixed(1) + ' MiB'; }
else { bytes = bytes / 1024; }
-
+
return bytes.toFixed(1) + ' GiB'
},
-
+
/**
* Formats a string to display a transfer speed utilizing {@link #size}
*
@@ -91,7 +91,7 @@ Deluge.Formatters = {
speed: function(bytes, showZero) {
return (!bytes && !showZero) ? '' : fsize(bytes, showZero) + '/s';
},
-
+
/**
* Formats a string to show time in a human readable form.
*
@@ -103,7 +103,7 @@ Deluge.Formatters = {
time = time.toFixed(0);
if (time < 60) { return time + 's'; }
else { time = time / 60; }
-
+
if (time < 60) {
var minutes = Math.floor(time)
var seconds = Math.round(60 * (time - minutes))
@@ -113,18 +113,18 @@ Deluge.Formatters = {
return minutes + 'm'; }
}
else { time = time / 60; }
-
- if (time < 24) {
+
+ if (time < 24) {
var hours = Math.floor(time)
var minutes = Math.round(60 * (time - hours))
if (minutes > 0) {
return hours + 'h ' + minutes + 'm';
} else {
return hours + 'h';
- }
+ }
}
else { time = time / 24; }
-
+
var days = Math.floor(time)
var hours = Math.round(24 * (time - days))
if (hours > 0) {
@@ -133,7 +133,7 @@ Deluge.Formatters = {
return days + 'd';
}
},
-
+
/**
* Simply returns the value untouched, for when no formatting is required.
*