diff --git a/deluge/ui/web/js/deluge-all/Deluge.Formatters.js b/deluge/ui/web/js/deluge-all/Deluge.Formatters.js index 141cadc0f..2053b8c80 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.Formatters.js +++ b/deluge/ui/web/js/deluge-all/Deluge.Formatters.js @@ -64,10 +64,11 @@ Deluge.Formatters = { * Formats the bytes value into a string with KiB, MiB or GiB units. * * @param {Number} bytes the filesize in bytes + * @param {Boolean} showZero pass in true to displays 0 values * @return {String} formatted string with KiB, MiB or GiB units. */ - size: function(bytes) { - if (!bytes) return ''; + size: function(bytes, showZero) { + if (!bytes && !showZero) return ''; bytes = bytes / 1024.0; if (bytes < 1024) { return bytes.toFixed(1) + ' KiB'; } @@ -83,10 +84,11 @@ Deluge.Formatters = { * Formats a string to display a transfer speed utilizing {@link #size} * * @param {Number} bits the number of bits per second + * @param {Boolean} showZero pass in true to displays 0 values * @return {String} formatted string with KiB, MiB or GiB units. */ - speed: function(bits) { - return (!bits) ? '' : fsize(bits) + '/s'; + speed: function(bits, showZero) { + return (!bits && !showZero) ? '' : fsize(bits, showZero) + '/s'; }, /** diff --git a/deluge/ui/web/js/deluge-all/Deluge.UI.js b/deluge/ui/web/js/deluge-all/Deluge.UI.js index c2634fa50..2c42e064e 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.UI.js +++ b/deluge/ui/web/js/deluge-all/Deluge.UI.js @@ -87,6 +87,8 @@ Deluge.UI = { }, this, {single: true}); this.update = this.update.createDelegate(this); + + this.originalTitle = document.title; }, update: function() { @@ -118,6 +120,12 @@ Deluge.UI = { */ onUpdate: function(data) { if (!data['connected']) Deluge.Events.fire('disconnect'); + + if (Deluge.config.show_session_speed) { + document.title = this.originalTitle + + ' (Down: ' + fspeed(data['stats'].download_rate, true) + + ' Up: ' + fspeed(data['stats'].upload_rate, true) + ')'; + } Deluge.Torrents.update(data['torrents']); Deluge.Statusbar.update(data['stats']); Deluge.Sidebar.update(data['filters']);