Youtube - No "More Videos" on paused embeds

10/27/2021, 12:22:39 AM

当前为 2021-10-26 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube - No "More Videos" on paused embeds
  3. // @namespace https://greasyfork.org/en/users/221281-klaufir
  4. // @match https://www.youtube.com/embed/*
  5. // @grant none
  6. // @version 1.0
  7. // @author -
  8. // @description 10/27/2021, 12:22:39 AM
  9. // ==/UserScript==
  10.  
  11. let maxTries = 10;
  12. let tryInterval = 1000;
  13. var tries = 0;
  14.  
  15.  
  16. function removeMoreVideosOverlay() {
  17. document?.querySelector(".ytp-pause-overlay.ytp-scroll-min")?.remove();
  18. }
  19.  
  20. function main() {
  21. var playButton = document?.querySelector('.ytp-play-button.ytp-button')
  22. if (!playButton) {
  23. tries += 1;
  24. if (tries < maxTries)
  25. setTimeout(main, tryInterval);
  26. return;
  27. }
  28. playButton.addEventListener('click', removeMoreVideosOverlay);
  29. removeMoreVideosOverlay();
  30. }
  31.  
  32. main()