您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Prevents YouTube and Vimeo from pausing videos when minimizing or switching tabs. Cross-browser port of https://addons.mozilla.org/en-US/firefox/addon/video-background-play-fix/
当前为
// ==UserScript== // @name Video Background Play Fix // @namespace https://gf.qytechs.cn/en/users/50-couchy // @version 1.1 // @description Prevents YouTube and Vimeo from pausing videos when minimizing or switching tabs. Cross-browser port of https://addons.mozilla.org/en-US/firefox/addon/video-background-play-fix/ // @author Couchy // @match *://*.youtube.com/* // @match *://*.vimeo.com/* // @grant none // @run-at document-start // ==/UserScript== (function() { 'use strict'; const IS_YOUTUBE = window.location.hostname.endsWith('youtube.com') || window.location.hostname.endsWith('youtube-nocookie.com'); const IS_VIMEO = window.location.hostname.endsWith('vimeo.com'); // Page Visibility API Object.defineProperties(document, { 'hidden': {value: false}, 'visibilityState': {value: 'visible'} }); window.addEventListener('visibilitychange', evt => evt.stopImmediatePropagation(), true); // Fullscreen API if (IS_VIMEO) { window.addEventListener('fullscreenchange', evt => evt.stopImmediatePropagation(), true); } // User activity tracking if (IS_YOUTUBE) { const REFRESH_INTERVAL = 60 * 1000; const TIMEOUT_FUNC = function(){window._lact = Date.now();}; if (window.hasOwnProperty('_lact')) { window.setInterval(TIMEOUT_FUNC, REFRESH_INTERVAL); } else { // Set a "listener" for _lact property to be written the first time Object.defineProperty(window, '_lact', { configurable: true, set: function(val){ Object.defineProperty(window, '_lact', {writable: true}); window._lact = val; window.setInterval(TIMEOUT_FUNC, REFRESH_INTERVAL); } }); } } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址