Youtube: Remove Overlays

04/26/2023, 11:35:27 AM

当前为 2023-04-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube: Remove Overlays
  3. // @namespace https://greasyfork.org/en/users/221281-klaufir
  4. // @match https://www.youtube.com/embed/*
  5. // @match https://www.youtube.com/*
  6. // @grant none
  7. // @version 1.11
  8. // @author -
  9. // @description 04/26/2023, 11:35:27 AM
  10. // ==/UserScript==
  11.  
  12. function addStyle(style)
  13. {
  14. var headelem = document.getElementsByTagName("head")[0];
  15. var styleelem = document.createElement("style");
  16. styleelem.setAttribute("id","remove-overlays");
  17. styleelem.type="text/css";
  18. styleelem.appendChild(document.createTextNode(style));
  19. headelem.appendChild(styleelem);
  20. }
  21.  
  22. function getRuleForClasses() {
  23. var classes = [
  24. 'ytp-paid-content-overlay', // paid promotion notification overlay in the bottom left corner
  25. 'ytp-pause-overlay', // "More Videos" overlay on paused embeds
  26. 'ytp-ce-element', // covering overlays at the end of the video
  27. 'iv-branding', // branding overlay in the bottom right corner
  28. 'ytp-cards-teaser', // info cards in the top right corner
  29. 'ytp-cards-button-icon', // info cards in the top right corner
  30. 'ytp-cards-button-title', // info cards in the top right corner
  31. 'ytp-endscreen-content', // endscreen recommended videos
  32. 'ytp-spinner' // remove spinner stuck on screen
  33. ];
  34. var style="";
  35. classes.forEach(cls => {
  36. style += "." + cls + " { visibility: hidden !important; }\n";
  37. });
  38. return style;
  39. }
  40.  
  41. addStyle(getRuleForClasses());
  42.