您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
speed up video on any site
当前为
// ==UserScript== // @name video, faster // @namespace Violentmonkey Scripts // @include *://*/* // @grant none // @version 1.0 // @author KraXen72 // @license MIT // @description speed up video on any site // @grant GM_registerMenuCommand // @grant GM_unregisterMenuCommand // @grant GM_notification // ==/UserScript== // TODO // auto look for video elements on location change // add a floating menu above video to change speed & remember speed across videos (reapply) // possibly support remembering speed + subtitles on a per-site basis implementation // NOTE: to get compact video speed buttons, add this css in violentMonkey custom css in settings /* [data-message="video, faster"] + .submenu-buttons + .submenu-commands { display: flex; justify-content: center; } [data-message="video, faster"] + .submenu-buttons + .submenu-commands .menu-item { padding: 0.5rem; margin: 0px; width: auto; } [data-message="video, faster"] + .submenu-buttons + .submenu-commands .menu-item .icon { display: none; } */ let videoElem = null const commands = { "1x": () => playbackRate(1), "1.5x": () => playbackRate(1.5), "2x": () => playbackRate(2), "2.5x": () => playbackRate(2.5), "2.75x": () => playbackRate(2.75), "3x": () => playbackRate(3), "3.5x": () => playbackRate(3.5), "4x": () => playbackRate(4) } function findVideoElement(debug = false) { if (videoElem !== null) return; let qs = "video" // switch(window.location.hostname) { // default: // qs = "video" // break; // } videoElem = document.querySelector(qs) if (videoElem !== null) { if (debug) console.log("found video elem", videoElem, qs) } else { if (debug) console.log("failed to find videoElem", qs) } } function playbackRate(rate) { findVideoElement() let wasplaying = !videoElem.paused if (wasplaying) videoElem.pause() videoElem.playbackRate = rate if (wasplaying) videoElem.play() } function registerCommands() { Object.keys(commands).forEach(command => { try { GM_unregisterMenuCommand(command) } catch (e) { console.error(e) } }) Object.entries(commands).forEach(command => { GM_registerMenuCommand(command[0], command[1]) }) } findVideoElement() registerCommands()
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址