YouTube Volume Adjuster by 5%

将YouTube视频的音量增加5%。

当前为 2023-11-06 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name                       YouTube Volume Adjuster by 5%
// @namespace                  https://gist.github.com/4lrick/0c225473e9609302c6dd6f0dfa4f22a3
// @version                    1.0
// @description                Increments the audio volume of YouTube videos by 5%.
// @description:fr             Augmente le volume des vidéos YouTube de 5%.
// @description:es             Aumenta el volumen de los videos de YouTube en un 5%.
// @description:de             Erhöht die Lautstärke von YouTube-Videos um 5%.
// @description:it             Aumenta il volume audio dei video di YouTube del 5%.
// @description:zh-CN          将YouTube视频的音量增加5%。
// @author                     4lrick
// @match                      https://www.youtube.com/*
// @icon                       https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant                      none
// @license                    GPL-3.0-only
// ==/UserScript==

(function() {
    'use strict';

    let lastVolume = 0;

    function adjustVolume() {
        const player = document.getElementById('movie_player');

        if (player) {
            const currentVolume = player.getVolume();
            const remainder = currentVolume % 10;

            if (remainder < 5) {
                player.setVolume(currentVolume - remainder);
            } else if (remainder >= 5) {
                player.setVolume(currentVolume + (5 - remainder));
            }

            lastVolume = player.getVolume();
        }
    }

    setInterval(adjustVolume, 1000);
})();