diff --git a/js/ctrls/download.js b/js/ctrls/download.js index 3211b2d..bdc9b93 100644 --- a/js/ctrls/download.js +++ b/js/ctrls/download.js @@ -6,9 +6,11 @@ angular .controller('DownloadCtrl', [ '$scope', '$rpc', '$utils', '$alerts', '$modals', '$fileSettings', '$activeInclude', '$waitingExclude', + // for document title + '$window', function( scope, rpc, utils, alerts, modals, - fsettings, activeInclude, waitingExclude + fsettings, activeInclude, waitingExclude, window ) { scope.active = [], scope.waiting = [], scope.stopped = []; scope.gstats = {}; @@ -86,6 +88,8 @@ function( rpc.subscribe('getGlobalStat', [], function(data) { scope.gstats = data[0]; + window.document.title = utils.getTitle(scope.gstats); + }); rpc.once('getVersion', [], function(data) { diff --git a/js/services/utils.js b/js/services/utils.js index a11827a..a7a4848 100644 --- a/js/services/utils.js +++ b/js/services/utils.js @@ -1,5 +1,5 @@ angular.module('webui.services.utils', []) -.factory('$utils', function() { +.factory('$utils', ['$filter', function(filter) { return { // saves the key value pair in cookies setCookie: function(key, value) { @@ -58,6 +58,18 @@ angular.module('webui.services.utils', []) return dest; }, + // get info title from global statistics + getTitle: function(stats) { + var title = + '(' + + ' a:' + stats.numActive + + ' p:' + stats.numWaiting + + ' s:' + stats.numStopped + + ') ' + + 'aria2 Web Client'; + + return title; + }, // get download chunks from aria2 bitfield getChunksFromHex: function(bitfield, numOfPieces) { @@ -93,4 +105,4 @@ angular.module('webui.services.utils', []) return chunks; } }; -}); +}]);