From 8f2f2153dffd075d99df80f295c94592309d9eb9 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 28 May 2016 14:15:37 +0200 Subject: [PATCH] Create MLButton.user.js --- MLButton.user.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 MLButton.user.js diff --git a/MLButton.user.js b/MLButton.user.js new file mode 100644 index 0000000..d1ca927 --- /dev/null +++ b/MLButton.user.js @@ -0,0 +1,42 @@ +// ==UserScript== +// @name MonsterLyrics button +// @namespace https://github.com/NorbiPeti/LINK +// @version 0.1 +// @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* +// @grant none +// ==/UserScript== + +window.lasturl=""; + +function AddIfChanged() +{ + if(window.location.href==window.lasturl) + return; + var cont=document.getElementById("watch7-subscription-container"); + if(cont===null) + return; + cont.innerHTML+=""; + window.lasturl=window.location.href; +} + +(function() { + 'use strict'; + + // Your code here... + var namecont=document.getElementById("watch7-user-header"); + if(namecont.innerHTML.indexOf("Monstercat")==-1) + return; + AddIfChanged(); + window.setTimeout(AddIfChanged, 1000); +})(); + +window.showLyrics=function() +{ + var title=document.getElementById("eow-title").title; + title=encodeURI(title.replace(/\[[^\[\]]+\]/g, "")).replace("&", ""); //Tested on: Pegboard Nerds & NGHTMRE - Superstar (ft. Krewella) + window.location.href="https://www.youtube.com/user/monstercatmedialyric/search?query="+title; +};