// ==UserScript== // @name Universal Autoplay Stopper // @version 0.7 // @description Aims to prevent autoplay on any streaming service! // @match https://*/* // @namespace https://greasyfork.org/users/189717 // @downloadURL none // ==/UserScript== (() => { const setLastUserAction = () => { localStorage.setItem('last user action', Date.now()) } ['click', 'keydown'].forEach((type) => { document.addEventListener(type, setLastUserAction) }) // Listen on this element for Netflix, because click events don't bubble up to document. const watchVideoElement = document.querySelector('.watch-video') if(watchVideoElement){ watchVideoElement.addEventListener('click', setLastUserAction) } setInterval(() => { document.querySelectorAll('video').forEach((v) => { const timeSinceAction = Date.now() - (localStorage.getItem('last user action') ?? 0) if(v.currentTime < 30 && timeSinceAction > 60000 && !v.paused){ v.pause() } }) }, 1000) })()