Greasy Fork is available in English.
防止抖音网页版因长时间未操作而自动暂停
// ==UserScript==
// @name 抖音-防止抖音网页版因长时间未操作而自动暂停
// @namespace hengyuan
// @license MIT
// @version 0.2
// @description 防止抖音网页版因长时间未操作而自动暂停
// @author Devv
// @match https://www.douyin.com/*
// @match https://live.douyin.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=douyin.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
let interval = 1 * 60 * 1000; // 每1分钟模拟一次鼠标移动
let lastMove = Date.now();
function simulateMouseMove() {
let now = Date.now();
if (now - lastMove > interval) {
let event = new MouseEvent('mousemove', {
'view': window,
'bubbles': true,
'cancelable': true,
'clientX': Math.random() * window.innerWidth,
'clientY': Math.random() * window.innerHeight
});
document.dispatchEvent(event);
lastMove = now;
}
}
setInterval(simulateMouseMove, 60 * 1000); // 每分钟检查一次是否需要模拟鼠标移动
})();