Crunchyroll Subtitle Resizer

Adjusts the subtitle size on Crunchyroll's

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Crunchyroll Subtitle Resizer
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Adjusts the subtitle size on Crunchyroll's 
// @author       Bitodette
// @homepageURL  https://github.com/Bitodette/crunchyroll-subtitle-resizer
// @supportURL   https://github.com/Bitodette/crunchyroll-subtitle-resizer/issues
// @match        *://*.crunchyroll.com/*
// @match        *://static.crunchyroll.com/vilos-v2/web/vilos/player.html*
// @grant        GM_addStyle
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // =================================================================================
    // --- USER SETTINGS: Adjust the values below to customize your subtitles ---
    // =================================================================================

    // 1. SUBTITLE SIZE
    // Controls the overall size of the subtitles.
    // Use values less than 1.0 to make them smaller, and greater than 1.0 to make them larger.
    // Examples:
    // 0.8 = 80% size (Smaller)
    // 0.7 = 70% size (Even smaller)
    // 1.0 = 100% size (Default)
    // 1.2 = 120% size (Larger)
    const SUBTITLE_SCALE = 0.8;


    // 2. VERTICAL POSITION
    // Adjust this if the subtitles are too high or too low after resizing.
    // It moves the subtitle block up or down from the bottom of the screen.
    // Examples:
    // "1%"  (Default - slightly raised from the very bottom)
    // "0%"  (At the very bottom edge)
    // "-2%" (Slightly lower, potentially cutting into the controls area)
    // "5%"  (Higher up on the screen)
    const VERTICAL_POSITION = "1%";


    // =================================================================================
    // --- SCRIPT LOGIC: No need to edit below this line ---
    // =================================================================================

    const cssCanvasResize = `
        #velocity-canvas {
            transform: scale(${SUBTITLE_SCALE}) !important;

            transform-origin: bottom center !important;

            bottom: ${VERTICAL_POSITION} !important;

            width: 100% !important;
            height: 100% !important;
            object-fit: contain !important;
        }
    `;

    GM_addStyle(cssCanvasResize);

})();