Update MLButton.user.js

This commit is contained in:
Norbi Peti 2016-05-28 14:41:43 +02:00
parent b9cf4b4fd9
commit 72f527bf08

View file

@ -14,6 +14,12 @@ window.lasturl="";
function AddIfChanged() function AddIfChanged()
{ {
if(window.location.href==window.lasturl)
return;
var cont=document.getElementById("watch7-subscription-container");
if(cont===null)
return;
window.setTimeout(function() {
if(window.location.href==window.lasturl) if(window.location.href==window.lasturl)
return; return;
var cont=document.getElementById("watch7-subscription-container"); var cont=document.getElementById("watch7-subscription-container");
@ -21,6 +27,7 @@ function AddIfChanged()
return; return;
cont.innerHTML+="<button type=\"button\" onClick=\"window.showLyrics()\" class=\"yt-uix-button yt-uix-button-size-default yt-uix-button-default\">Show lyrics</button>"; cont.innerHTML+="<button type=\"button\" onClick=\"window.showLyrics()\" class=\"yt-uix-button yt-uix-button-size-default yt-uix-button-default\">Show lyrics</button>";
window.lasturl=window.location.href; window.lasturl=window.location.href;
}, 2000); //TODO: Detect page load finish
} }
(function() { (function() {
@ -31,7 +38,7 @@ function AddIfChanged()
if(namecont.innerHTML.indexOf("Monstercat")==-1) if(namecont.innerHTML.indexOf("Monstercat")==-1)
return; return;
AddIfChanged(); AddIfChanged();
window.setTimeout(AddIfChanged, 1000); window.setInterval(AddIfChanged, 1000);
})(); })();
window.showLyrics=function() window.showLyrics=function()