Last active
March 21, 2018 06:47
-
-
Save nicholastay/665822c67bd3e098d5c43ec31eb4d830 to your computer and use it in GitHub Desktop.
Schoology userscript - infinitely scroll news feeds (press raw to install)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Schoology infiniscroll feed | |
// @namespace http://nicholastay.github.io/ | |
// @version 0.1.0 | |
// @homepage https://gist.github.com/nicholastay/665822c67bd3e098d5c43ec31eb4d830 | |
// @author Nicholas Tay <[email protected]> | |
// @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