Greasy Fork

Greasy Fork is available in English.

Twitch - Redirect Live Videos to Popout Player Version

Redirect Twitch broadcasts to the minimal popout player version

当前为 2018-08-21 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Twitch - Redirect Live Videos to Popout Player Version
// @namespace    TwitchLiveVidPopoutPlayerRedirect
// @description  Redirect Twitch broadcasts to the minimal popout player version
// @version      1.1
// @author       Kai Krause <[email protected]>
// @match        http://*.twitch.tv/*
// @match        https://*.twitch.tv/*
// @run-at       document-end
// ==/UserScript==

setInterval(() => {
	var x = document.getElementsByClassName("channel-header"); // check whether the current page is a broadcast channel
	if (x.length <= 0) return;
	var videoPath = window.location.pathname;
	// only continue if channel name, and not twitch.tv/channelName/otherPage
	if (videoPath.endsWith("/")) videoPath = videoPath.slice(0, -1);
	var backslashCount = videoPath.match(/[/]/gm);
	if (backslashCount.length > 1) return;
	// redirect
	var popoutUrl = "https://player.twitch.tv/?channel=" + videoPath.substr(1);
	window.location.replace(popoutUrl);
}, 3000);