Hide 7tv theather mode button on youtube

It is in the name

目前为 2023-03-25 提交的版本。查看 最新版本

// ==UserScript==
// @name         Hide 7tv theather mode button on youtube
// @version      1.2
// @description  It is in the name
// @author       equmaq
// @match        https://www.youtube.com/*
// @grant        none
// @license      MIT
// @namespace https://gf.qytechs.cn/users/990886
// ==/UserScript==

(function() {
    'use strict';

    function removeElementByXpath(xpath) {
        const element = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
        if (element) {
            element.remove();
        }
    }

    const targetXPath = '//button[@aria-label="Theater mode"]';

    const observer = new MutationObserver((mutations) => {
        mutations.forEach((mutation) => {
            const addedNodes = Array.from(mutation.addedNodes);
            addedNodes.forEach((node) => {
                if (node.matches(targetXPath)) {
                    removeElementByXpath(targetXPath);
                }
            });
        });
    });

    observer.observe(document.documentElement, { childList: true, subtree: true });

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址