Greasy Fork is available in English.
Prevents autoplay on Tubi
当前为
// ==UserScript==
// @name Prevent Tubi Autoplay
// @version 0.2
// @description Prevents autoplay on Tubi
// @match https://tubitv.com/*
// @namespace http://greasyfork.icu/users/189717
// ==/UserScript==
(() => {
let lastUserAction = 0
setInterval(() => {
['click', 'keydown'].forEach((type) => {
document.addEventListener(type, () => {
lastUserAction = Date.now()
})
})
document.querySelectorAll('video').forEach((v) => {
const timeSinceAction = Date.now() - lastUserAction
if(v.currentTime < 30 && timeSinceAction > 60000 && !v.paused){
v.pause()
}
})
}, 1000)
})()