YouTube - Remove Specific Elements and Style Fixes

Remove elements and ensure sharp edges on YouTube overlays

// ==UserScript==
// @name         YouTube - Remove Specific Elements and Style Fixes
// @namespace    http://tampermonkey.net/
// @version      3.2
// @description  Remove elements and ensure sharp edges on YouTube overlays
// @author       You
// @match        https://www.youtube.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    // Remove specific elements
    function removeElements() {
        const selectors = [
            'button.ytp-button[data-tooltip-target-id="ytp-autonav-toggle-button"]',
            '.ytp-miniplayer-button',
            '.ytp-next-button.ytp-button',
            '.ytp-prev-button.ytp-button',
            '.yt-spec-touch-feedback-shape',
            '.yt-spec-touch-feedback-shape--touch-response',
            '.style-scope.ytd-masthead #guide-button',
            '.style-scope.ytd-masthead #guide-button yt-icon'
        ];

        selectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(element => element.remove());
        });
    }

    // Ensure sharp corners on video overlays
    function makeCornersSharp() {
        const sharpSelectors = [
            '.ytp-ce-covering-overlay',
            '.ytp-ce-video-title',
            '.ytp-ce-video-duration'
        ];

        sharpSelectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(element => {
                element.style.borderRadius = '0px';
                element.style.overflow = 'hidden';
            });
        });
    }

    // Observe dynamic changes
    const observer = new MutationObserver(() => {
        removeElements();
        makeCornersSharp();
    });

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

    // Reinforce with intervals
    setInterval(() => {
        removeElements();
        makeCornersSharp();
    }, 1000);

    // Initial execution
    window.addEventListener('load', () => {
        removeElements();
        makeCornersSharp();
    });
})();