TwitchUnrecommend

Removes the left nav bars

  1. // ==UserScript==
  2. // @name TwitchUnrecommend
  3. // @version 1.09081
  4. // @description Removes the left nav bars
  5. // @match https://*.twitch.tv/*
  6.  
  7. // @run-at document-end
  8. // @namespace https://greasyfork.org/users/1359318
  9. // ==/UserScript==
  10.  
  11. window.onload = function () {
  12.  
  13. document.querySelectorAll(".side-nav-section").forEach(entry => {
  14. if (entry.ariaLabel !== 'Followed Channels') {
  15. entry.style.setProperty("display", "none", "important");
  16. }
  17. });
  18.  
  19. const targetNode = document.getElementById("root");
  20. const config = { childList: true, subtree: true };
  21.  
  22. const callback = (mutationList, observer) => {
  23. for (const mutation of mutationList) {
  24. mutation.addedNodes.forEach(entry => {
  25. if (entry.ariaLabel != null && (entry.ariaLabel === 'Recommended Channels' || entry.ariaLabel.endsWith('Viewers Also Watch'))) {
  26. entry.style.setProperty("display", "none", "important");
  27. }
  28. });
  29. }
  30. };
  31.  
  32. const observer = new MutationObserver(callback);
  33. observer.observe(targetNode, config);
  34.  
  35. }