您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds 2.25x 2.5x 2.75x 3x speed buttons below the video
当前为
- // ==UserScript==
- // @name m.YouTube.com more playback speeds
- // @namespace m-youtube-com-more-playback-speeds
- // @version 1.1
- // @description Adds 2.25x 2.5x 2.75x 3x speed buttons below the video
- // @author hlorand.hu
- // @match https://m.youtube.com/watch*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
- // @grant none
- // @license https://creativecommons.org/licenses/by-nc-sa/4.0/
- // ==/UserScript==
- (function() {
- //'use strict';
- function addbuttons(){
- document.getElementById("speedbuttons").innerHTML = "";
- const speeds = ["3.5","3.25","3.0","2.75","2.5","2.25","2.0","1.75","1.5"];
- speeds.forEach((speed)=>{
- let button = document.createElement('button');
- button.textContent = speed;
- button.className = "speedbutton";
- button.style.margin = "5px";
- button.style.padding = "5px";
- button.style.backgroundColor = "blue";
- button.style.position = "relative";
- button.onclick = function() {
- video = document.querySelector("video");
- if(video && video.readyState >= 2) {
- video.playbackRate = this.textContent;
- video.mozPreservesPitch = video.webkitPreservesPitch = video.preservePitch = true;
- document.querySelectorAll(".speedbutton").forEach((btn)=>{
- btn.style.backgroundColor = "blue";
- });
- this.style.backgroundColor = "darkorange";
- }
- };
- let target = document.getElementById("speedbuttons");
- target.insertBefore(button, target.firstChild);
- }); // end speeds foreach
- } // end addbuttons
- window.addEventListener('load', function () {
- setInterval(()=>{
- if( document.getElementById("speedbuttons") == undefined ){
- let parent = document.querySelector('.related-chips-slot-wrapper');
- let wrapper = document.createElement('div');
- wrapper.setAttribute("id","speedbuttons");
- parent.insertBefore(wrapper, parent.firstChild);
- addbuttons();
- }
- }, 1000);
- }); // end addEventListener
- })();