// ==UserScript== // @namespace http://mrob.com/time/scripts-beta // @name YT Vidcontrol // @description Control video player // @author Robert Munafo // @version 100122.26 // @downloadURL http://mrob.com/time/scripts-beta/yt-vidcontrol.user.js.txt // @include https://www.youtube.com/* // ==/UserScript== /* REVISION HISTORY 98814.94 First version (using Id 'full-bleed-container') 98831.61 Attach to ID 'ytd-player' so it works in all four sizes/positions 100091.38 Add another querySelector (doesn't fix current problem) 100122.26 Add autoSkip1 V=document.querySelector('video'); V.currentTime=V.duration-1; x1=D.getElementById('full-bleed-container'); b1=D.createElement('button'); b1.style.position='relative'; b1.style.height='20px'; b1.style.top='80%'; b1.onclick=function() { V=document.querySelector('video'); V.currentTime=V.currentTime+10; }; t1=D.createTextNode('>|'); b1.appendChild(t1); x1.appendChild(b1); // from greasyfork.org/en/scripts/436115-return-youtube-dislike/code function ytid () { var u1 = new URL(window.location.href); var pn = u1.pathname; if (pn.startsWith("/clip")) { return (document.querySelector("meta[itemprop='videoId']") || document.querySelector("meta[itemprop='identifier']")).content; } else { if (pn.startsWith("/shorts")) { return pn.slice(8); } return u1.searchParams.get("v"); } } */ var autoSkip1 = function() { const skb = document.querySelector(`.ytp-ad-skip-button`) || document.querySelector(`.ytp-skip-ad-button`) || document.querySelector(`.ytp-ad-skip-button-modern`); if (skb) { skb.click(); // for desktop browsers } } // End of autoSkip1 var addControl1 = function () { var D, x1, b1, b2, t1; // console.info("foo1"); D=document; b2=D.getElementById('arosbutton'); if(b2===null) { // getElementById('full-bleed-container'); x1=D.getElementById('ytd-player'); b1=D.createElement('button'); b1.id='arosbutton'; b1.style.position='absolute'; b1.style.height='27px'; b1.style.width='40px'; b1.style.top='60%'; b1.style.right='4px'; b1.onclick=function() { V = document.querySelector(`.ad-showing video`) || document.querySelector(`video`); V.currentTime=V.duration-1; }; t1=D.createTextNode('>|'); b1.appendChild(t1); x1.appendChild(b1); } setInterval(autoSkip1, 1000); }; (function () { window.addEventListener("yt-navigate-finish", addControl1, true); })();