Youtube Cleaner

Removes the recommendations from the main page of YouTube.

当前为 2014-07-09 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @description Removes the recommendations from the main page of YouTube.
  3. // @include http://www.youtube.com/
  4. // @include http://youtube.com/
  5. // @include https://youtube.com/
  6. // @include https://www.youtube.com/
  7. // @name Youtube Cleaner
  8. // @namespace kgnc
  9. // @version 1.2.2
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. /*
  14. A userscript to remove the recommendations on YouTube.
  15. Copyright (C) 2014 Kaan Genç
  16.  
  17. This program is free software: you can redistribute it and/or modify
  18. it under the terms of the GNU General Public License as published by
  19. the Free Software Foundation, either version 3 of the License, or
  20. (at your option) any later version.
  21.  
  22. This program is distributed in the hope that it will be useful,
  23. but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. GNU General Public License for more details.
  26.  
  27. A copy of the GNU General Public License can be found at:
  28. <https://raw.githubusercontent.com/SeriousBug/yt-cleaner/master/LICENSE>
  29. or <https://www.gnu.org/licenses/gpl.html>.
  30. */
  31.  
  32. //Recommended and Popular
  33. popular = document.getElementsByClassName("branded-page-module-title-text");
  34. popularLength = popular.length - 1;
  35. for (;popularLength >= 0;popularLength--){
  36. if ((popular[popularLength].innerHTML.indexOf("Recommended") != -1) || (popular[popularLength].innerHTML.indexOf("Popular on YouTube") != -1)){
  37. popular[popularLength].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = "None";
  38. }
  39. }
  40.  
  41. //Recommended channels
  42. subButtons = document.getElementsByClassName("shelf-subscription-button yt-uix-button-subscription-container");
  43. buttonLength = subButtons.length - 1;
  44. for (;buttonLength >= 0;buttonLength--){
  45. subButtons[buttonLength].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = "None";
  46. }
  47.  
  48. //Recommended channels column on the right
  49. document.getElementsByClassName("branded-page-related-channels branded-page-box ")[0].style.display = "None";