From c2353dd1cc568ad19d4f86d159603f77da535d64 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Tue, 2 Aug 2016 22:25:22 +0200 Subject: [PATCH] Song title is now shown at mixes; AJAX --- indev.user.js | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/indev.user.js b/indev.user.js index 1045df1..489cbde 100644 --- a/indev.user.js +++ b/indev.user.js @@ -13,6 +13,28 @@ window.lasttitle=""; +function loadXMLDoc(url, ondone) { + var xmlhttp = new XMLHttpRequest(); + + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == XMLHttpRequest.DONE ) { + if (xmlhttp.status == 200) { + var ret = xmlhttp.responseXML; //TODO: Browser extension + var wrapper= document.createElement('div'); + wrapper.innerHTML= ret; + ret= wrapper.firstChild; + ondone(ret); + } + else { + alert('Error while retrieving page! '+xmlhttp.status); + } + } + }; + + xmlhttp.open("GET", url, true); + xmlhttp.send(); +} + function AddYouTube(addtries) { //TODO: Handle [Official Lyric Video] (if from a mix, test if there is a lyric video on MC channel, if not, go to ML) var namecont=document.getElementById("watch7-user-header"); if(namecont===null || namecont.innerHTML.indexOf("Monstercat")==-1) @@ -43,7 +65,7 @@ function AddYouTube(addtries) { //TODO: Handle [Official Lyric Video] (if from a time=spl[0]*60; time=spl[1]*1; } - //console.log("Time: "+time+" CTime: "+currenttime+" LastTime: "+lasttime); + //console.log("Time: "+time+" CTime: "+currenttime+" LastTime: "+lasttime+" - "+lastmatch[2]+" - "+lastmatch[3]); if(time>currenttime && lasttime