Twitch - Disable automatic video downscale

Disables the automatic downscaling of Twitch streams while tabbed away

目前為 2019-08-07 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Twitch - Disable automatic video downscale
// @namespace    CommanderRoot
// @copyright    CommanderRoot
// @version      1.0.1
// @description  Disables the automatic downscaling of Twitch streams while tabbed away
// @author       https://twitter.com/CommanderRoot
// @match        https://www.twitch.tv/*
// @match        https://www-origin.twitch.tv/*
// @match        https://player.twitch.tv/*
// @grant        none
// @run-at       document-start
// ==/UserScript==
"use strict";

// Try to trick the site into thinking it's never hidden
Object.defineProperty(document, 'hidden', {value: false, writable: false});
Object.defineProperty(document, 'visibilityState', {value: 'visible', writable: false});
Object.defineProperty(document, 'webkitVisibilityState', {value: 'visible', writable: false});
document.dispatchEvent(new Event('visibilitychange'));
document.hasFocus = function () { return true; };
window.localStorage.setItem('video-quality', '{"default":"chunked"}');