Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name YouTube - Always Show Filter Bar
- // @namespace http://tampermonkey.net/
- // @version 1.1
- // @description Monitors the YouTube page and ensures that the filter bar (e.g., "New recommendations") is always visible.
- // @author You
- // @match https://www.youtube.com/*
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- (function() {
- 'use strict';
- // Function designed to show the filter bar
- function showChips() {
- const chipsBar = document.querySelector('ytd-feed-filter-chip-bar-renderer');
- if (chipsBar) {
- chipsBar.style.display = 'block'; // You can also try 'flex'
- chipsBar.style.visibility = 'visible';
- chipsBar.style.opacity = '1';
- chipsBar.removeAttribute('hidden'); // Very important - YouTube often uses the 'hidden' attribute
- }
- }
- // We use MutationObserver to watch for changes on the page.
- // This is key, because YouTube constantly modifies its page.
- const observer = new MutationObserver((mutations) => {
- // Every time something changes on the page, we try to show our bar
- showChips();
- });
- // We start observing the entire document body for added/removed elements
- observer.observe(document.body, {
- childList: true,
- subtree: true
- });
- // Additionally, we run the function every second, just in case
- // the MutationObserver misses something.
- setInterval(showChips, 1000);
- })();
Advertisement