Greasy Fork

Greasy Fork is available in English.

Replace Worlds 2024 twitch.tv riotgames channel with caedrel

Earn lolesports rewards/drops while watching a certain ratking. Only works with the Twitch provider.

目前为 2024-10-05 提交的版本,查看 最新版本

// ==UserScript==
// @name         Replace Worlds 2024 twitch.tv riotgames channel with caedrel
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Earn lolesports rewards/drops while watching a certain ratking. Only works with the Twitch provider.
// @author       aureliony
// @match        https://lolesports.com/live/worlds/riotgames
// @icon         https://www.google.com/s2/favicons?sz=64&domain=lolesports.com
// @grant        none
// @license      MIT
// ==/UserScript==

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

async function replaceFrames() {
    while (true) {
        let iframe = document.querySelector("#video-player-twitch > iframe");
        if (iframe) {
            // Replace stream window
            iframe.src = iframe.src.replace("?channel=riotgames", "?channel=caedrel");

            // Replace chat window
            let chatEmbed = document.getElementById("riotgames");
            chatEmbed.src = chatEmbed.src.replace("embed/riotgames", "embed/caedrel");
            break;
        }
        await sleep(50);
    }
}

replaceFrames();