AIS

Period to skip forward, comma to skip backward (cause why not), slash to edit keybinds and skip time. Works only on HTML5 videos for now.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         AIS
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  Period to skip forward, comma to skip backward (cause why not), slash to edit keybinds and skip time. Works only on HTML5 videos for now.
// @author       jaek#9509
// @match        https://twist.moe/a/*/*
// @grant        GM.getValue
// @grant        GM.setValue
// ==/UserScript==

(async function() {
    'use strict;'

    var get = GM.getValue;
    var set = GM.setValue
    var skipTime = await get("skipTime", 85);
    var forwardKey = await get("forwardKey", 190);
    var backKey = await get("backKey", 188);
    var editKey = 191
    document.addEventListener("keydown", function(e){
        var vid = document.getElementsByTagName("video")[0];
        switch(e.keyCode){
            case forwardKey:
                vid.currentTime += skipTime;
                break;
            case backKey:
                vid.currentTime -= skipTime;
                break;
            case editKey:
                skipTime = Number(prompt("How much time to skip?", skipTime) || skipTime);
                forwardKey = Number(prompt("Key code for skipping forward? (Use keycode.info if you don't know what keycodes are)", forwardKey) || forwardKey);
                backKey = Number(prompt("Key code for skipping backward? (keycode.info for info)", backKey) || backKey);
                set("skipTime", skipTime);
                set("forwardKey", forwardKey);
                set("backKey", backKey);
                break;
            default: return;
        }
    e.preventDefault()
    });
})();