SheridanCoriana6

YouTube - Always Show Filter Bar

Nov 17th, 2025
128
0
Never
8
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | Source Code | 0 0
  1. // ==UserScript==
  2. // @name YouTube - Always Show Filter Bar
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Monitors the YouTube page and ensures that the filter bar (e.g., "New recommendations") is always visible.
  6. // @author You
  7. // @match https://www.youtube.com/*
  8. // @grant none
  9. // @run-at document-start
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Function designed to show the filter bar
  16. function showChips() {
  17. const chipsBar = document.querySelector('ytd-feed-filter-chip-bar-renderer');
  18. if (chipsBar) {
  19. chipsBar.style.display = 'block'; // You can also try 'flex'
  20. chipsBar.style.visibility = 'visible';
  21. chipsBar.style.opacity = '1';
  22. chipsBar.removeAttribute('hidden'); // Very important - YouTube often uses the 'hidden' attribute
  23. }
  24. }
  25.  
  26. // We use MutationObserver to watch for changes on the page.
  27. // This is key, because YouTube constantly modifies its page.
  28. const observer = new MutationObserver((mutations) => {
  29. // Every time something changes on the page, we try to show our bar
  30. showChips();
  31. });
  32.  
  33. // We start observing the entire document body for added/removed elements
  34. observer.observe(document.body, {
  35. childList: true,
  36. subtree: true
  37. });
  38.  
  39. // Additionally, we run the function every second, just in case
  40. // the MutationObserver misses something.
  41. setInterval(showChips, 1000);
  42. })();
Tags: youtube
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Xarvekig
    10 days
    Comment was deleted
Add Comment
Please, Sign In to add comment