Created
December 24, 2023 05:11
-
-
Save alanhg/1b204366502dfef03c7e4b5185499a8a to your computer and use it in GitHub Desktop.
视频变速 for Tampermonkey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 视频变速 | |
// @namespace http://tampermonkey.net/ | |
// @version 2023-12-23 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.youtube.com/watch* | |
// @match https://peixun.amac.org.cn/** | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com | |
// @run-at document-start | |
// @grant GM_registerMenuCommand | |
// ==/UserScript== | |
(function () { | |
'use strict'; | |
const setSpeed = (speed) => { | |
const el = document.querySelector('video'); | |
if (el) { | |
el.playbackRate = speed; | |
} | |
}; | |
GM_registerMenuCommand('1倍速', function () { | |
setSpeed(1); | |
}); | |
GM_registerMenuCommand('8倍速', function () { | |
setSpeed(8); | |
}); | |
GM_registerMenuCommand('16倍速', function () { | |
setSpeed(16); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment