added page title for notifications if pinned as app tab in a modern browser
This commit is contained in:
parent
1f988e30d8
commit
047e7d8b98
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
};
|
||||
});
|
||||
}]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user