1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 00:34:04 +00:00

#5007 Web client attempts to post notifications without permission, causing transfers not to update

This commit is contained in:
Mitchell Livingston 2012-08-07 23:00:10 +00:00
parent 0a656a1375
commit f6efebb25c

View file

@ -11,15 +11,17 @@ $(document).ready(function () {
toggle.show(); toggle.show();
updateMenuTitle(); updateMenuTitle();
$(transmission).bind('downloadComplete seedingComplete', function (event, torrent) { $(transmission).bind('downloadComplete seedingComplete', function (event, torrent) {
var title = (event.type == 'downloadComplete' ? 'Download' : 'Seeding') + ' complete', if (notificationsEnabled) {
content = torrent.getName(), var title = (event.type == 'downloadComplete' ? 'Download' : 'Seeding') + ' complete',
notification; content = torrent.getName(),
notification;
notification = window.webkitNotifications.createNotification('style/transmission/images/logo.png', title, content); notification = window.webkitNotifications.createNotification('style/transmission/images/logo.png', title, content);
notification.show(); notification.show();
setTimeout(function () { setTimeout(function () {
notification.cancel(); notification.cancel();
}, 5000); }, 5000);
};
}); });
function updateMenuTitle() { function updateMenuTitle() {