您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Makes the YouTube volume slider exponential for easier adjustment of lower volumes.
// ==UserScript== // @name YouTube Volume Fixer // @namespace http://tampermonkey.net/ // @version 1 // @description Makes the YouTube volume slider exponential for easier adjustment of lower volumes. // @author zGqnis // @icon https://www.gstatic.com/youtube/img/branding/favicon/favicon_144x144.png // @match https://www.youtube.com/* // @match https://music.youtube.com/* // @run-at document-start // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; const EXPONENT = 3; const storedOriginalVolumes = new WeakMap(); const {get, set} = Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'volume'); Object.defineProperty(HTMLMediaElement.prototype, 'volume', { get() { const lowVolume = get.call(this); const calculatedOriginalVolume = lowVolume ** (1 / EXPONENT); const storedOriginalVolume = storedOriginalVolumes.get(this); const storedDeviation = Math.abs(storedOriginalVolume - calculatedOriginalVolume); const originalVolume = storedDeviation < 0.01 ? storedOriginalVolume : calculatedOriginalVolume; return originalVolume; }, set(originalVolume) { const lowVolume = originalVolume ** EXPONENT; storedOriginalVolumes.set(this, originalVolume); set.call(this, lowVolume); } }); })();