您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adjusts YouTube quality when not focused
- // ==UserScript==
- // @name Youtube Auto Quality
- // @version 1.0
- // @grant none
- // @match https://www.youtube.com/*
- // @run-at document-start
- // @author RexOmni
- // @description Adjusts YouTube quality when not focused
- // @no-frames
- // @namespace https://greasyfork.org/users/48806
- // ==/UserScript==
- /* Acceptable qulaities
- 'auto'
- 'highres' // 8k or 'original'
- 'hd2880'
- 'hd2160'
- 'hd1440'
- 'hd1080'
- 'hd720'
- 'large'
- 'medium'
- 'small'
- 'tiny'
- if the one you chose is not available it will choose the better one
- */
- const FOCUSEDQUALITY = 'hd720';
- const HIDDENQUALITY = 'tiny';
- (function(){
- 'use strict';
- document.addEventListener('DOMContentLoaded', function(){
- // Handle page visibility change
- document.addEventListener("visibilitychange", function(){
- if (document.visibilityState == 'hidden') {
- document.getElementById("movie_player").setPlaybackQualityRange(HIDDENQUALITY);
- } else if (document.visibilityState == 'visible') {
- document.getElementById("movie_player").setPlaybackQualityRange(FOCUSEDQUALITY);
- }
- }, false);
- })
- })();
- console.log('YAQ: LOADED');