Created
October 15, 2019 03:37
-
-
Save syousif94/b18d0c9bdf583788f9fc6d9eeda2bcf0 to your computer and use it in GitHub Desktop.
infinite reddit
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
| function run() { | |
| console.log('sup') | |
| $('#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(); | |
| } | |
| }); | |
| } | |
| } | |
| run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment