Hide youtube theather mode button

It's in the name

当前为 2023-03-25 提交的版本,查看 最新版本

// ==UserScript==
// @name         Hide youtube theather mode button
// @version      1.2
// @description  It's in the name
// @author       equmaq
// @match        https://www.youtube.com/*
// @grant        none
// @license      MIT
// @namespace https://greasyfork.org/users/990886
// ==/UserScript==
 
(function() {
    'use strict';
 
    // Define a function to delete the theater mode button
    function deleteTheaterModeButton() {
        const elementToDelete = document.querySelector('button.ytp-size-button.ytp-button[aria-label="Theater mode"]');

        if (elementToDelete) {
            elementToDelete.remove();
        }
    }

    const observer = new MutationObserver((mutations) => {
        mutations.forEach((mutation) => {
            const addedNodes = Array.from(mutation.addedNodes);
            addedNodes.forEach((node) => {
                if (node.matches('button.ytp-size-button.ytp-button[aria-label="Theater mode"]')) {
                    deleteTheaterModeButton();
                }
            });
        });
    });

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

})();