您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
An attempt to eliminate the gap between youtube short video replays. Doesn't work for background tabs.
// ==UserScript== // @name Gapless Playback for YouTube Shorts // @namespace https://greasyfork.org/en/users/1413127-tumoxep // @version 1.0 // @description An attempt to eliminate the gap between youtube short video replays. Doesn't work for background tabs. // @license WTFPL // @match https://www.youtube.com/shorts/* // @grant none // ==/UserScript== (function() { 'use strict'; // Based on perception. Tune for yourself const TRIGGER_THRESHOLD = 0.2; let pollingStarted = false; function enableGaplessPlayback() { const videoElement = document.querySelector('video'); if (pollingStarted) { return; } if (!videoElement) { return; } function checkVideoTime() { if (videoElement.duration - videoElement.currentTime < TRIGGER_THRESHOLD) { pollingStarted = false; videoElement.currentTime = 0; videoElement.play(); enableGaplessPlayback(); } else { // Continue polling requestAnimationFrame(checkVideoTime); } } console.log('setting up gapless playback'); // Start polling pollingStarted = true; requestAnimationFrame(checkVideoTime); } // Run the filter when the page loads or updates const observer = new MutationObserver(enableGaplessPlayback); observer.observe(document.body, { childList: true, subtree: true }); // Initial filter run enableGaplessPlayback(); })();