Greasy Fork is available in English.
Prevents autoplay on Tubi
当前为
// ==UserScript==
// @name Prevent Tubi Autoplay
// @version 0.3
// @description Prevents autoplay on Tubi
// @match https://tubitv.com/*
// @namespace http://greasyfork.icu/users/189717
// ==/UserScript==
(() => {
setInterval(() => {
['click', 'keydown'].forEach((type) => {
document.addEventListener(type, () => {
localStorage.setItem('last user action', Date.now())
})
})
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)
})()