Hide Twitch React Button

Hide the react button on Twitch

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Hide Twitch React Button
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Hide the react button on Twitch
// @author       Welshdroo
// @match        https://www.twitch.tv/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Wait for the page to load
    window.addEventListener('load', function() {
        // Function to hide the react button
        function hideReactButton() {
            // Find the react button by class name and hide it
            var reactButton = document.querySelector('.ScCoreButton-sc-ocjdkq-0.ScCoreButtonText-sc-ocjdkq-3');
            if (reactButton) {
                reactButton.style.display = 'none';
            }
        }

        // Run the function initially
        hideReactButton();

        // Set up an observer to handle dynamic changes in the DOM
        var observer = new MutationObserver(function(mutations) {
            mutations.forEach(function(mutation) {
                // Run the function whenever the DOM changes
                hideReactButton();
            });
        });

        // Configuration of the observer
        var config = { attributes: true, childList: true, subtree: true };

        // Start observing the target node for configured mutations
        observer.observe(document.body, config);
    });
})();