Reddit Infinite Scrolling ♾️

Adds infinite scrolling to subreddits and to comments.

  1. // ==UserScript==
  2. // @name Reddit Infinite Scrolling ♾️
  3. // @version 1.3
  4. // @namespace old.reddit.com
  5. // @description Adds infinite scrolling to subreddits and to comments.
  6. // @license MIT
  7. // @include https://*.reddit.com/*
  8. // @icon https://www.redditstatic.com/desktop2x/img/favicon/android-icon-192x192.png
  9. // @grant unsafeWindow
  10. // @grant GM_addStyle
  11. // @require http://code.jquery.com/jquery-2.1.4.min.js
  12. // @require https://cdnjs.cloudflare.com/ajax/libs/jscroll/2.4.1/jquery.jscroll.min.js
  13. // ==/UserScript==
  14.  
  15. GM_addStyle(`
  16. /* hide Reddit CSS default buttons */
  17. .nav-buttons {display:none !important}
  18.  
  19. .jscroll-loading {font-size: large !important; font-weight: bold !important; color: white !important; text-align: center; background: red !important;padding:3px; border-radius:20px;display: flex;justify-content: center;align-items: center}
  20. `);
  21. // Jscroll code
  22. $('#siteTable').jscroll({
  23. nextSelector: 'span.nextprev a:last',
  24. contentSelector: '#siteTable .thing, .nav-buttons',
  25. callback: function() {
  26. $('.nav-buttons').remove();
  27. }
  28. });
  29.  
  30. //if current URL contains the string 'comments', then click the 'more comments' button when scrolling at the end of the page
  31. if (/(.*comments.*)/.test(document.location)) {
  32. $(window).scroll(function() {
  33. if ($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
  34. // console.log('bottom!');
  35. var element = unsafeWindow.document.getElementsByClassName('morecomments');
  36. var last = element.length;
  37. element[last - 1].firstChild.click();
  38. }
  39. });
  40. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址