Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Gab Auto Scroll
- // @namespace https://gab.com/spender
- // @version 0.1
- // @description Automatically clicks "load more" when scrolling through Gab feeds
- // @author @spender
- // @match https://gab.com/*
- // @grant none
- // ==/UserScript==
- ;(function() {
- "use strict"
- let loading = false
- window.addEventListener('scroll', function() {
- if (loading) return
- const { scrollHeight, clientHeight, scrollTop } = document.documentElement
- if (scrollHeight < 3 * clientHeight + scrollTop) {
- const button = document.querySelector("button.load-more")
- const feed = document.querySelector(".item-list[role='feed']")
- if (button && feed) {
- const observer = new MutationObserver(() => {
- observer.disconnect()
- loading = false
- })
- observer.observe(feed, { childList: true })
- button.click()
- loading = true
- }
- }
- })
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement