Made the button appear faster
This commit is contained in:
parent
1423771b9d
commit
0ddf2d11dd
1 changed files with 22 additions and 10 deletions
|
@ -6,11 +6,31 @@
|
||||||
// @author NorbiPeti
|
// @author NorbiPeti
|
||||||
// @match https://www.youtube.com/
|
// @match https://www.youtube.com/
|
||||||
// @include http://www.youtube.com/*
|
// @include http://www.youtube.com/*
|
||||||
// @include https://www.youtube.com/*
|
// @include https://www.twitch.tv/Monstercat*
|
||||||
|
// @include https://live.monstercat.com/*
|
||||||
// @grant none
|
// @grant none
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
window.lasturl="";
|
window.lasturl="";
|
||||||
|
window.lasttitle="";
|
||||||
|
window.addtries=0;
|
||||||
|
|
||||||
|
function Add() {
|
||||||
|
var title=document.getElementById("eow-title").title;
|
||||||
|
if(window.location.href==window.lasturl)
|
||||||
|
return;
|
||||||
|
if(title==lasttitle && window.lasttries<10)
|
||||||
|
{
|
||||||
|
window.addtries++;
|
||||||
|
window.setTimeout(Add, 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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-subscribed-branded no-icon-markup yt-uix-subscription-button yt-can-buffer hover-enabled\">Lyrics video</button>";
|
||||||
|
window.lasturl=window.location.href; //TODO: Show Lyrics button
|
||||||
|
}
|
||||||
|
|
||||||
function AddIfChanged()
|
function AddIfChanged()
|
||||||
{
|
{
|
||||||
|
@ -22,15 +42,7 @@ function AddIfChanged()
|
||||||
var cont=document.getElementById("watch7-subscription-container");
|
var cont=document.getElementById("watch7-subscription-container");
|
||||||
if(cont===null)
|
if(cont===null)
|
||||||
return;
|
return;
|
||||||
window.setTimeout(function() { //TODO: Check for video title change every 100 ms
|
window.setTimeout(Add, 100);
|
||||||
if(window.location.href==window.lasturl)
|
|
||||||
return;
|
|
||||||
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-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
|
|
||||||
} //TODO: Add for every platform, not just YouTube
|
} //TODO: Add for every platform, not just YouTube
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
Loading…
Reference in a new issue