Twitch Un-raid

Go back to the channel where you were a few minutes after a raid

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Twitch Un-raid
// @version      1.5.3
// @description  Go back to the channel where you were a few minutes after a raid
// @author       raianwz
// @namespace    https://greasyfork.org/users/425245
// @match        *://twitch.tv/*
// @include       *://www.twitch.tv/*
// @exclude      *://*.twitch.tv/videos/*
// @exclude      *://*.twitch.tv/*/video/*
// @exclude      *://*.twitch.tv/embed/*
// @exclude      *://*.twitch.tv/popout/*
// ==/UserScript==

(function() {
    var delayBeforeRedirect = 1000 * 60 * 3 // 3 minutes delay to Redirect
    var delayBeforeRecheck = 1000 * 60 * 3 // 3 minutes delay to Check URL
    function goBackChannel(){history.back()}
    function checkPage(){
        if(window.location.href.includes('?referrer=raid')){
            setTimeout(goBackChannel, delayBeforeRedirect); // redirect in 3 minutes
        }else{
            setTimeout(checkPage, delayBeforeRecheck); // check again in 3 minutes
        }
    }
    console.log('Twitch Unraid is enabled')
    setTimeout(checkPage, 3*1000); // check page 3 seconds after load
})();