added page title for notifications if pinned as app tab in a modern browser

This commit is contained in:
hamza zia 2013-07-17 16:10:24 +02:00
parent 1f988e30d8
commit 047e7d8b98
2 changed files with 19 additions and 3 deletions

View File

@ -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) {

View File

@ -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;
}
};
});
}]);