Skip to content

Instantly share code, notes, and snippets.

@nicholastay
Last active March 21, 2018 06:47
Show Gist options
  • Save nicholastay/665822c67bd3e098d5c43ec31eb4d830 to your computer and use it in GitHub Desktop.
Save nicholastay/665822c67bd3e098d5c43ec31eb4d830 to your computer and use it in GitHub Desktop.
Schoology userscript - infinitely scroll news feeds (press raw to install)
// ==UserScript==
// @name Schoology infiniscroll feed
// @namespace http://nicholastay.github.io/
// @version 0.1.0
// @homepage https://gist.github.com/nicholastay/665822c67bd3e098d5c43ec31eb4d830
// @author Nicholas Tay <nexerq@gmail.com>
// @icon https://i.imgur.com/meGrY1N.png
// @include *://app.schoology.com/*
// @include *://schoology.cgs.vic.edu.au/*
// @grant none
// @downloadURL https://gist.github.com/nicholastay/665822c67bd3e098d5c43ec31eb4d830/raw/schoology-infiniscroll.user.js
// @noframes
// ==/UserScript==
(function() {
var $feed = $(".s-edge-feed");
if (!$feed || ($feed.length < 1))
return console.log("[nexerq/Infiniscroll] no feed found.");
$(document).scroll(function() {
var $window = $(window);
var $document = $(document);
if ($window.scrollTop() + $window.height() === $document.height()) {
var $elem = $(".s-edge-feed-more-link a:not(.nexerq-infini)");
if (!$elem && ($elem.length < 1))
return;
console.log("[nexerq/Infiniscroll] hit bottom & more to load, loading more in feed...");
$elem.addClass("nexerq-infini");
$elem.click();
}
});
console.log("[nexerq/Infiniscroll] attached scroll handler.");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment