您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Choose the default volume for youtube videos!
当前为
// ==UserScript== // @name Auto Set Youtube Volume // @namespace YTVol // @version 0.1 // @description Choose the default volume for youtube videos! // @author hacker09 // @match https://www.youtube.com/watch?v=* // @icon https://www.youtube.com/s/desktop/03f86491/img/favicon.ico // @run-at document-start // @grant GM_getValue // @grant GM_setValue // ==/UserScript== (function() { 'use strict'; if (GM_getValue('Default_Volume') === undefined) //If the Default_Volume wasn't set yet { //Starts the if condition GM_setValue('Default_Volume', 20); //Save the Default YT Volume as 20% } //Finishes the if condition window.sessionStorage.setItem('yt-player-volume', '{"data":"{\\"volume\\":' + GM_getValue('Default_Volume') + ',\\"muted\\":false}","creation":' + new Date().valueOf() + '}'); //Set the Default YT Volume /* var video = document.querySelector('.video-stream'); //Save the video element to a variable function CheckLoad() { //Starts the CheckLoad function if (video.readyState === 1) { //When the video "starts" document.querySelector('.video-stream').volume = 0.2; //Set the volume to 20% document.querySelector('div.ytp-volume-panel').ariaValueNow = GM_getValue('Default_Volume'); //Set the aria value document.querySelector('div.ytp-volume-panel').valuetext = GM_getValue('Default_Volume') + ' volume'; //Set the value to show on hover document.querySelector('div.ytp-volume-panel > div > div').style.left = '8px'; //Make the volume line shorter document.querySelector(".ytp-svg-volume-animation-speaker").attributes[2].value = "M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 Z"; //Make the volume box shorter } else { //Starts the else condition if the video didn't "start" yet setTimeout(CheckLoad, 100); //Keep checking till the video "starts" } //Finishes the else condition } //Finishes the function CheckLoad CheckLoad(); //Starts the CheckLoad function */ })();