// ==UserScript== // @id video.golem.de-cf1af14e-25ea-4d9a-9924-58563eb39677@scriptish // @name golem-html5-vids // @version 1.0 // @namespace // @author about:robots // @description Kill flash and ads on video.golem.de // @include http://video.golem.de/* // @run-at document-end // @downloadURL none // ==/UserScript== var url = document.URL; var i1 = url.indexOf("/", 22) + 1; var i2 = url.indexOf("/", i1); var videoId = url.substring(i1, i2); var videoUrlHD = "http://video.golem.de/download/"+videoId+"?q=high"; var videoUrlSD = "http://video.golem.de/download/"+videoId+"?q=normal"; var videoObj = document.createElement("video"); var switchObj = document.createElement("div"); var flashObj = document.getElementById("NVBPlayer"+videoId+"video"); var containerObj = document.getElementById("NVBPlayer"+videoId); i1 = containerObj.getAttribute("style").indexOf("http"); i2 = containerObj.getAttribute("style").indexOf('"', i1); var snapshotUrl = containerObj.getAttribute("style").substring(i1, i2); if (localStorage.getItem("videoQuality") === null) { localStorage.setItem("videoQuality", "SD"); } if (localStorage.getItem("videoQuality") == "SD") { videoObj.setAttribute("src", videoUrlSD); switchObj.innerHTML = "SD" } else { videoObj.setAttribute("src", videoUrlHD); switchObj.innerHTML = "HD" } videoObj.setAttribute("height", flashObj.height); videoObj.setAttribute("width", flashObj.width); videoObj.setAttribute("controls", 1); videoObj.setAttribute("poster", snapshotUrl); videoObj.setAttribute("id", "videoGolem") while (containerObj.hasChildNodes()) containerObj.removeChild(containerObj.lastChild); containerObj.appendChild(videoObj); var styleUnfocused = "color:rgba(255,255,255,0.3);background:rgba(0,0,0,0.1);cursor:pointer;height:32px;width:32px;position:absolute;top:1em;right:0.8em;font:bold 18px/32px sans-serif;text-align:center;"; var styleMouseover = "color:rgba(255,255,255,0.5);background:rgba(0,0,0,0.2);cursor:pointer;height:32px;width:32px;position:absolute;top:1em;right:0.8em;font:bold 18px/32px sans-serif;text-align:center;"; switchObj.setAttribute("style", styleUnfocused); switchObj.setAttribute("title", "Qualität zwischen SD und HD umschalten"); switchObj.onmouseover = function() { switchObj.setAttribute("style", styleMouseover); }; switchObj.onmouseout = function() { switchObj.setAttribute("style", styleUnfocused); }; switchObj.onclick = function() { var videoPos = videoObj.currentTime - 1.1; if (videoPos < 0) videoPos = 0; if (switchObj.innerHTML == "HD") { localStorage.setItem("videoQuality", "SD"); switchObj.innerHTML = "SD"; videoObj.setAttribute("src", videoUrlSD); } else { localStorage.setItem("videoQuality", "HD"); switchObj.innerHTML = "HD"; videoObj.setAttribute("src", videoUrlHD); } videoObj.play(); videoObj.oncanplay = function() { videoObj.currentTime = videoPos; videoObj.oncanplay = ""; }; }; containerObj.appendChild(switchObj);