Replace Alienware Arena Control Center Twitch links

Replaces the Twitch quest links to the Twitch Alienware extension link in the Alienware Arena Control Center Twitch to not require the Twitch stream to be loaded

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Replace Alienware Arena Control Center Twitch links
// @description Replaces the Twitch quest links to the Twitch Alienware extension link in the Alienware Arena Control Center Twitch to not require the Twitch stream to be loaded
// @author      floriegl
// @license     CC0
// @match       https://*.alienwarearena.com/control-center
// @icon        https://media.alienwarearena.com/images/favicons/favicon.ico
// @version     1.5
// @grant       GM_addStyle
// @run-at      document-start
// @namespace   https://greasyfork.org/users/703184
// ==/UserScript==

(function() {
const UPGRADED_USERNAMES = ['TrishaHershberger', 'Mactics', 'FooYa', 'REDinFamy', 'Yun0gaming', 'kesslive', 'Ohmwrecker', 'Lovinurstyle', 'Layria', 'brydraa', 'Squeex', 'DatModz', 'CaliforniaGurl', '3llebelle', 'Liz_XP', 'KateeBear', 'A1phaChino', 'hazeleyedchic', 'DJUnreal', 'Pobelter', 'Valkyrae', 'TheGeekEntry', 'BlaineThePainTV', 'NinjaPullsGaming', 'MoonlitCharlie', 'Wickerrman', 'AmethystLady', 'BLbeel', 'everlynix', 'DemShenaniganss', 'whateverbri', 'Pokey_Star', 'runJDrun', 'Takkundr', 'Ludwig', 'MaudeGarrett', 'GrazeStreams', 'MatthewSantoro'];
const css = `
.user-profile__profile-card:has( > .user-profile__card-header #control-center__twitch-max-reached) .quest-list__play {
    display: none;
}
.user-profile__profile-card:has( > .user-profile__card-header #control-center__twitch-max-reached) .converted > .quest-list__play {
    display: inline-block;
}
`;
if (typeof GM_addStyle !== "undefined") {
    GM_addStyle(css);
} else {
    let styleNode = document.createElement("style");
    styleNode.appendChild(document.createTextNode(css));
    (document.querySelector("head") || document.documentElement).appendChild(styleNode);
}
let x = 0;
const intervalID = setInterval(function () {
    const foundLinks = document.querySelectorAll(".user-profile__profile-card:has( > .user-profile__card-header #control-center__twitch-max-reached) a:has( > .quest-list__play)");
    if (foundLinks.length) {
        window.clearInterval(intervalID);
        for (const foundLink of foundLinks) {
            const username = (foundLink.href.match(/(?:https?:\/\/)?(?:www\.)?twitch\.tv\/([^\/?]+)/) || [])[1];
            if (username != null && !UPGRADED_USERNAMES.includes(username)) {
                foundLink.href = "https://www.twitch.tv/popout/" + username + "/extensions/ehc5ey5g9hoehi8ys54lr6eknomqgr/panel";
                foundLink.classList.add("converted");
            }
        }
    }
   if (++x === 20) {
       window.clearInterval(intervalID);
   }
}, 500);
})();