1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-22 09:25:45 +01:00

Add totals columns to the download manager.

--HG--
extra : transplant_source : %A4%9E%BE%15.%EC%EFk%E1F%9D%A8%3A%D1E%06%5B%A9%60%1D
This commit is contained in:
Kris Maglione
2011-01-24 10:14:01 -05:00
parent 2df1de7ad1
commit ef75a4c414
2 changed files with 30 additions and 6 deletions

View File

@@ -672,6 +672,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* @returns {string}
*/
formatSeconds: function formatSeconds(seconds) {
function pad(n, val) ("0000000" + val).substr(-Math.max(n, String(val).length));
function div(num, denom) [Math.round(num / denom), Math.round(num % denom)];
let days, hours, minutes;
@@ -683,7 +684,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
if (hours)
return hours + "h " + minutes + "m";
if (minutes)
return minutes + ":" + seconds;
return minutes + ":" + pad(2, seconds);
return seconds + "s";
},