Twitch Pause Autohost

Prevents hosted streams from auto playing.

24.02.2018 itibariyledir. En son verisyonu görün.

// ==UserScript==
// @name         Twitch Pause Autohost
// @version      0.1
// @description  Prevents hosted streams from auto playing.
// @author       Luxocracy
// @grant        none
// @match      	 https://www.twitch.tv/*
// @namespace https://greasyfork.dpdns.org/users/30239
// ==/UserScript==

(function() {
	var observer = new MutationObserver(function(mutations) {
		mutations.forEach(function(mutation) {
			// Check if the mutation is the hosting video player being added.
			if(mutation.target.classList.contains('video-player-hosting-ui__container')) {
				let playButton = document.querySelector('div.pl-controls-bottom.pl-flex.qa-controls-bottom > div.player-buttons-left > button');
				// Loop to click the pause button once the stream starts playing.
				var pauseLoop = function() {
					if((playButton.firstChild.firstChild.dataset.tip.toLowerCase() === "pause")) {
						playButton.click(); // Click pause button
					} else {
						setTimeout(pauseLoop, 500);
					}
				};
				pauseLoop();
			}
		});
	});

	if (!window.location.pathname.match('directory')) observer.observe(document.querySelector('body'), { childList: true, subtree: true });
})();
长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元