無盡可樂漫畫

一直往下滾一直看

目前为 2024-02-27 提交的版本。查看 最新版本

// ==UserScript==
// @name 無盡可樂漫畫
// @namespace http://tampermonkey.net/
// @version 2024-02-27
// @description 一直往下滾一直看
// @author 貓咪不作戰
// @match https://www.colamanga.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=colamanga.com
// @grant none
// @license MIT
// ==/UserScript==

(function () {
    'use strict';

    var styleElement = document.createElement("style");
    styleElement.appendChild(document.createTextNode(" ::-webkit-scrollbar {-webkit-appearance: none;width: 0px;}"));
    document.getElementsByTagName("head")[0].appendChild(styleElement);
    var newDiv;
    var url = window.location.href;
    var frontUrl;
    var lastSlashIndex = url.lastIndexOf('/');
    frontUrl = url.substring(0, lastSlashIndex);
    //alert(frontUrl);
    var lastSlashIndex2 = url.lastIndexOf('.html');
    var now = parseInt(url.substring(lastSlashIndex + 1, lastSlashIndex2));
    //alert(now);
    var last = now + 1;
    //alert(last);

    //document.querySelector("body> div:nth-child(1)").style.display = "none";
    //document.querySelector("body > div:nth-child(7)").style.display = "none";

    window.addEventListener('message', function (event) {
        if (event.data.action === 'changeUrl') {
            history.replaceState({}, '', event.data.newUrl);
            //this.alert(event.data.newUrl)
        }
    });
    let a = setInterval(() => {
        endToBottom();
    }, 500);

    function endToBottom() {
        if (isScrollAtBottom()) {
            clearInterval(a);

            var xx = frontUrl + "/" + last + ".html";

            let p = window.top;
            p.postMessage({ action: 'changeUrl', newUrl: new URL(xx).pathname }, '*');

            x(xx); //alert(xx);
        }
    };

    function x(url) {
        //alert(response);
        newDiv = document.createElement("iframe");
        //newDiv.className = "iframeX";
        newDiv.src = url;
        newDiv.style.cssText = ` display: block;
    border: none;
    height: calc(100vh);
    width: 100%;`;

        document.body.appendChild(newDiv);
    }

    function isScrollAtBottom() {
        const documentHeight = document.documentElement.scrollHeight;
        const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
        const windowHeight = window.innerHeight || document.documentElement.clientHeight;
        return scrollTop + windowHeight >= documentHeight - 50;
    }
})();

QingJ © 2025

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