Crunchyroll: [PageUp = Skip]

Press PageUp key at the video player to press the skip button (if available)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Crunchyroll: [PageUp = Skip]
// @name:de      Crunchyroll: [Bild hoch = Skip]
// @namespace    http://tampermonkey.net/
// @version      2025-10-17
// @description  Press PageUp key at the video player to press the skip button (if available)
// @description:de  Drücke Bild hoch im Videoplayer, um zu skippen (wenn verfügbar)
// @author       L4faro
// @match        https://static.crunchyroll.com/vilos-v2/web/vilos/player.html
// @icon         https://www.google.com/s2/favicons?sz=64&domain=crunchyroll.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    ////////////////////////
    // Config
    ////////////////////////

    // Keys to press for skip:
    const altKey = false;       // If Alt key as modifier is required
    const crtlKey = false;      // If Ctrl key as modifier is required
    const shiftKey = false;     // If Shift key as modifier is required
    const keyCode = 33;         // The key code for skip (33 = PageUp) - Search for JavaScript key codes in the internet for more

    ////////////////////////
    // Functions
    ////////////////////////

    // Search & press skip button
    function pressSkipButton(){
        // Search skip button via query selector
        let button = document.querySelector(`[data-testid=skipButton] [role=button]`);
        // Print message to browser console
        console.log("pressSkipButton", button ?? "No skip button found");
        // Click the Skip button, if one found. Make sure to focus the video player element
        button?.click();
    }

    // Init key event
    function registerGlobalKeyDownEvent(){
        document.onkeydown = function(evt) {
            evt = evt || window.event;

            if(crtlKey && !evt.ctrlKey)
                return;
            if(shiftKey && !evt.shiftKey)
                return;
            if(altKey && !evt.altKey)
                return;
            if (evt.keyCode != keyCode)
                return;

            pressSkipButton();
        };
    }

    ////////////////////////
    // Script
    ////////////////////////
    registerGlobalKeyDownEvent();
})();