Clicking the notification focuses the tab

This commit is contained in:
Kasper Rynning-Tønnesen
2015-06-11 13:56:16 +02:00
parent 6569d006f2
commit 663859cd61

View File

@@ -283,7 +283,8 @@ function notifyUser(id, title) {
title= title.replace(/\\\'/g, "'").replace(/"/g,"'").replace(/&/g,"&"); title= title.replace(/\\\'/g, "'").replace(/"/g,"'").replace(/&/g,"&");
if (Notification.permission === "granted" && document.hidden && id != "30H2Z8Lr-4c" && !window.mobilecheck()) { if (Notification.permission === "granted" && document.hidden && id != "30H2Z8Lr-4c" && !window.mobilecheck()) {
var notification = new Notification("Now Playing", {body: title, icon: "http://i.ytimg.com/vi/"+id+"/mqdefault.jpg", iconUrl: "http://i.ytimg.com/vi/"+id+"/mqdefault.jpg"}); var notification = new Notification("Now Playing", {body: title, icon: "http://i.ytimg.com/vi/"+id+"/mqdefault.jpg", iconUrl: "http://i.ytimg.com/vi/"+id+"/mqdefault.jpg"});
setTimeout(function(){ notification.onclick = function(x) { window.focus(); this.cancel(); };
setTimeout(function(){
notification.close(); notification.close();
},5000); },5000);
} }