Reddit jScroll

adds infinite scrolling to Reddit subreddits, eg, https://www.reddit.com/r/technology/

当前为 2015-08-17 提交的版本,查看 最新版本

// ==UserScript==
// @name        Reddit jScroll
// @namespace   rikkie
// @include     http://www.reddit.com/*
// @include     https://www.reddit.com/*
// @version     2
// @grant       unsafeWindow
// @require     http://code.jquery.com/jquery-2.1.4.min.js
// @require     https://greasyfork.org/scripts/11636-jscroll/code/jScroll.js?version=67302
// @description adds infinite scrolling to Reddit subreddits, eg, https://www.reddit.com/r/technology/
// ==/UserScript==



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




$(window).scroll(function () {
  if ($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
    // $(window).unbind('scroll');
    alert('bottom!');
    var element = unsafeWindow.document.getElementsByClassName('morecomments');
    var last = element.length;
    element[last - 1].firstChild.click();
    // alert ('FIRE!!!!');        
    // document.getElementsByClassName('morecomments')[77].firstChild.click();
  }
});