Infinity Scroll

automatically creates element if user is near of the page bottom.

目前為 2022-03-02 提交的版本,檢視 最新版本

// ==UserScript==
// @name Infinity Scroll
// @namespace -
// @version 0.1
// @description automatically creates element if user is near of the page bottom.
// @author NotYou
// @include *
// @require https://code.jquery.com/jquery-3.3.1.min.js
// @run-at document-idle
// @license GPL-3.0-or-later
// @grant none
// ==/UserScript==

// NOTE //
// Doesn't work if you can't scroll page //

(function() {
let css = '.infinityScroll{padding: 0% 0% 100%;}';
if (typeof GM_addStyle !== "undefined") {
  GM_addStyle(css);
} else {
  let styleNode = document.createElement("style");
  styleNode.appendChild(document.createTextNode(css));
  (document.querySelector("head") || document.documentElement).appendChild(styleNode);
}
})();


window.onscroll = function(ev) {
    if((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 100) {
        $('body').append('<div class=infinityScroll></div>')
    }
};

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址