can someone make a script that removes the youtube audio track setting (it's the one in the middle)

For something as simple as hiding an element, the best way is to just write a filter rule. Please paste this rule into "My Filters" in uBlock Origin or "User rules" in AdGuard.

www.youtube.com##.ytp-audio-menu-item

If you'd rather use a UserScript, here you go:

// ==UserScript==
// @name         Hide YouTube Audio Track Selector
// @namespace    
// @version      0.1
// @description  Hides the 'Audio track' option in the YouTube player settings.
// @author       
// @match        https://www.youtube.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const hideAudioTrackElement = () => {
        const audioTrackMenuItem = document.querySelector('.ytp-audio-menu-item');
        if (audioTrackMenuItem && audioTrackMenuItem.style.display !== 'none') {
            audioTrackMenuItem.style.display = 'none';
        }
    };

    const observer = new MutationObserver(hideAudioTrackElement);

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

thank you so much man

उत्तर पोस्ट करा

उत्तर पोस्ट करण्यासाठी साइन इन करा.

长期地址
遇到问题?请前往 GitHub 提 Issues。