Video Speed Buttons

Add speed buttons to any HTML5 <video> element. Comes with a loader for YouTube and Vimeo

< Feedback on Video Speed Buttons

Question/comment

§
Posted: 26.11.2024
Edited: 26.11.2024

@version 1.0.8.1 Works well so far, the buttons are displayed, with the added code at the end of the script:

// 🏃crutch greasyfork.org/scripts/381176/

!function(){window.trustedTypes&&window.trustedTypes.createPolicy&&window.trustedTypes.createPolicy("default",{createHTML:(e,t)=>e});let e,t;function i(i){if(!e)return;let d=i||localStorage.getItem("third_video_plugin_speed");d&&t&&(t.playbackRate=d)}function d(t){let d=parseFloat(t.target.innerHTML.replace("x",""));localStorage.setItem("third_video_plugin_speed",d),i(d);for(let n=0;n-1||location.href.indexOf("channel")>-1)return;document.querySelector("#above-the-fold")&&null===document.getElementById("video_speed_div")&&( function t(){let i=document.createElement("style");i.type="text/css",i.innerHTML="#video_speed_div button {} #video_speed_div button:first-child{margin-left:0;} #video_speed_div button:hover{background-color: #000;} .video_speed_div-button-active { }",document.getElementsByTagName("head").item(0).appendChild(i),(e=document.createElement("div")).setAttribute("id","video_speed_div");for(let o=0;o<n.length;o++){let r=n[o],l=document.createElement("button");l.innerHTML=""+r,l.style.width="25px",l.setAttribute("id","third_video_plugin_btn_"+r),l.addEventListener("click",d),e.appendChild(l)}e.style.width="100%",e.style.height="4px";let c=document.querySelector("#above-the-fold");c.insertBefore(e,c.firstChild)}(), function t(){if(!e)return;let i=localStorage.getItem("third_video_plugin_speed");i||(i="1");for(let d=0;d<e.childNodes.length;d++){let n=e.childNodes[d];n.getAttribute("id")==="third_video_plugin_btn_"+i&&-1===n.className.indexOf("video_speed_div-button-active")&&n.click()}document.getElementById("third_video_plugin_btn_"+i).click()}()),!t&&(t=document.querySelector(".html5-main-video"))&&!t.onloadstart&&(i(),t.onloadstart=function(e){i()});let n=document.querySelector(".ytp-skip-ad-button");n&&n.click()},1e3)}();

§
Posted: 27.11.2024
Edited: 27.11.2024

// Multi-purpose Loader (defaults to floating on top right)

const loader_data = { container_candidates: ["div.ytp-right-controls",

...

css_div: [ ??

...

setInterval(function(){if(document.readyState === "complete"){setTimeout(loader_loop, 1000);} }, 2000);

Post reply

Sign in to post a reply.