Fixed stuff
- Fixed button not showing up if navigated to Monstercat from YouTube. - FIxed CSS
This commit is contained in:
parent
72f527bf08
commit
2c69c22a1b
1 changed files with 7 additions and 6 deletions
|
@ -5,8 +5,8 @@
|
|||
// @description Creates a button that searches for a lyrics video!
|
||||
// @author NorbiPeti
|
||||
// @match https://www.youtube.com/
|
||||
// @include http://www.youtube.com/watch
|
||||
// @include https://www.youtube.com/watch*
|
||||
// @include http://www.youtube.com/*
|
||||
// @include https://www.youtube.com/*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
|
@ -14,6 +14,9 @@ window.lasturl="";
|
|||
|
||||
function AddIfChanged()
|
||||
{
|
||||
var namecont=document.getElementById("watch7-user-header");
|
||||
if(namecont===null || namecont.innerHTML.indexOf("Monstercat")==-1)
|
||||
return;
|
||||
if(window.location.href==window.lasturl)
|
||||
return;
|
||||
var cont=document.getElementById("watch7-subscription-container");
|
||||
|
@ -22,10 +25,11 @@ function AddIfChanged()
|
|||
window.setTimeout(function() {
|
||||
if(window.location.href==window.lasturl)
|
||||
return;
|
||||
//var cont=document.getElementById("watch7-subscription-container").childNodes[0];
|
||||
var cont=document.getElementById("watch7-subscription-container");
|
||||
if(cont===null)
|
||||
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-subscribed-branded no-icon-markup yt-uix-subscription-button yt-can-buffer hover-enabled\">Show lyrics</button>";
|
||||
window.lasturl=window.location.href;
|
||||
}, 2000); //TODO: Detect page load finish
|
||||
}
|
||||
|
@ -34,9 +38,6 @@ function AddIfChanged()
|
|||
'use strict';
|
||||
|
||||
// Your code here...
|
||||
var namecont=document.getElementById("watch7-user-header");
|
||||
if(namecont.innerHTML.indexOf("Monstercat")==-1)
|
||||
return;
|
||||
AddIfChanged();
|
||||
window.setInterval(AddIfChanged, 1000);
|
||||
})();
|
||||
|
|
Loading…
Reference in a new issue