Discussions » Creation Requests
remove the youtube audio track setting
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
Why use MutationObserver only to apply a css rule. Just add a new stylesheet, and you're done.
Personally I use Stylus extension for things like this.
.ytp-settings-menu .ytp-audio-menu-item { display: none !important; }
Just apply that to domain: youtube.com
can someone make a script that removes the youtube audio track setting (it's the one in the middle)