YT播放速度修改器

播放速度透過+/-改變

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         YT播放速度修改器
// @namespace    http://tampermonkey.net/
// @version      1.0.1
// @description  播放速度透過+/-改變
// @author       Zoosewu
// @match        https://www.youtube.com/*
// @grant        none
// @license      MIT
// ==/UserScript==
var player = document.getElementsByTagName("video")[0];

(function() {
    document.onkeydown=function(e){//對整個頁面文件監聽
        var keyNum=window.event ? e.keyCode :e.which;//獲取被按下的鍵值
        //判斷如果使用者按下了回車鍵(keycody=13)

        if(keyNum==107){
            console.log('按下了+');
            player.playbackRate = player.playbackRate + 0.25;
        }
        //判斷如果使用者按下了空格鍵(keycode=32),
        if(keyNum==109){
            console.log('按下了-');
            player.playbackRate = player.playbackRate - 0.25;
        }
    }
})();