Reddit Infinite Scrolling

Adds infinite scrolling to subreddits and to comments.

Verze ze dne 13. 08. 2016. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        Reddit Infinite Scrolling
// @namespace 	darkred
// @author      darkred
// @description Adds infinite scrolling to subreddits and to comments.
// @include     https://www.reddit.com/*
// @version     2015.12.14
// @grant       unsafeWindow
// @require     http://code.jquery.com/jquery-2.1.4.min.js
// @require     https://greatest.deepsurf.us/scripts/11636-jscroll/code/jScroll.js?version=67302
// ==/UserScript==

// Jscroll code
$('#siteTable').jscroll({
  nextSelector: 'span.nextprev a:last',
  contentSelector: '#siteTable .thing, .nav-buttons',
  callback: function () {
    $('.nav-buttons').remove();
  }
});


//if current URL contains the string 'comments', then click the 'more comments' button when scrolling at the end of the page
if (/(.*comments.*)/.test(document.location)) {
  $(window).scroll(function () {
    if ($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
      // console.log('bottom!');
      var element = unsafeWindow.document.getElementsByClassName('morecomments');
      var last = element.length;
      element[last - 1].firstChild.click();
    }
  });
}