Skip to content

Instantly share code, notes, and snippets.

@zst123
Created August 4, 2015 09:28
Show Gist options
  • Save zst123/34e4a71042391c913837 to your computer and use it in GitHub Desktop.
Save zst123/34e4a71042391c913837 to your computer and use it in GitHub Desktop.
Updated https://gist.github.com/BrettBukowski/5108358 for the new Youtube player
javascript:!function(a){function g(a,b){for(var c in b)b.hasOwnProperty(c)&&(a.style[c]=b[c])}var b=a.querySelector("video"),c=a.createElement("input"),d=a.createElement("label"),e=a.createElement("div"),f;d.innerHTML='<span class="asdf">1x</span>',g(d,{color:"#EEE",fontSize:"11px",background:"transparent"}),h=document.getElementsByClassName("ytp-chrome-controls"),c.type="range",c.max=4,c.min=.25,c.value=1,c.step=.25,g(c,{left:"8px",width:"90%",verticalAlign:"middle",webkitAppearance:"slider-horizontal",mozAppearance:"slider-horizontal"}),d.appendChild(c),g(e,{top:"22%",width:"50%",padding:"4px",position:"absolute",zIndex:1e3}),e.appendChild(d),(f=a.querySelector(".ytp-chrome-bottom"))?(f.appendChild(e),g(e,{left:"25%"})):b.parentNode.insertBefore(e,b),d.querySelector(".asdf").innerHTML=b.playbackRate+"x",c.value=b.playbackRate,c.addEventListener("change",function(a){var c=a.target.value;b.playbackRate=c,d.querySelector(".asdf").innerHTML=c+"x"})}(document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment