Youtube Cleaner

Removes the recommendations from the main page of YouTube.

当前为 2014-11-21 提交的版本,查看 最新版本

  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 2.0.0
  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.  
  33. //All annotations
  34. annotations = document.getElementsByClassName("shelf-annotation shelf-title-annotation");
  35. annotationsLength = annotations.length - 1;
  36. for (;annotationsLength >= 0;annotationsLength--){
  37. annotations[annotationsLength].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = "None";
  38. }
  39.  
  40. //Try to disable auto-loading of the page
  41. document.getElementsByClassName("yt-uix-load-more")[0].setAttribute("data-uix-load-more-href", "");
  42. document.getElementsByClassName("yt-uix-load-more")[0].setAttribute("data-scrolldetect-callback", "");
  43. document.getElementsByClassName("yt-uix-load-more")[0].style.display="None";