Greasy Fork

Greasy Fork is available in English.

笔趣阁小说/起点小说自动翻页/阅读到达底部自动翻页/空格手动翻页

笔趣阁小说/起点小说自动翻页

// ==UserScript==
// @name        笔趣阁小说/起点小说自动翻页/阅读到达底部自动翻页/空格手动翻页
// @namespace   [email protected]
// @include     http://www.cits0871.com/*
// @include     https://www.qidian.com/*
// @license MIT
// @grant       no
// @version     1.7
// @run-at      document-end
// @description 笔趣阁小说/起点小说自动翻页
// @require    http://code.jquery.com/jquery-1.11.0.min.js
// ==/UserScript==

(function () {


    xh()//1.执行自动循环翻页
    function xh(){
        setTimeout(function(){//延迟器
            var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
            var clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
            var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
            if(scrollHeight > clientHeight && scrollTop + clientHeight === scrollHeight) {//到达底部
                setTimeout(function(){//延迟器
                    xyz();
                },10000)
            }

            xh();
        },3000)
    }

    //2.手动执行翻页
    $(document).keydown(function(event){
        if(event.keyCode == 32){//监听空格键,当到达底部并且空格键按下自动翻页
            var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
            var clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
            var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
            if(scrollHeight > clientHeight && scrollTop + clientHeight === scrollHeight) {
                xyz();
            }
        }
        if(event.keyCode == 39 ){//监听右箭头,按下自动翻页
            xyz();
        }
    });

    function xyz(){//翻页点击
        if(document.querySelector('.bottem2') !== null){
            if(document.getElementsByClassName("bottem2")[0].children[3].text=='下一章'){
                document.getElementsByClassName("bottem2")[0].children[3].click();
            }else if(document.getElementsByClassName("bottem2")[0].children[2].text=='下一章'){
                document.getElementsByClassName("bottem2")[0].children[2].click();
            }else{
                document.getElementsByClassName("bottem2")[0].children[4].click();
            }
        }
        if(document.querySelector('.nav-btn-group') !== null){
            document.getElementsByClassName("nav-btn-group")[0].children[2].click();
        }


    }

    document.getElementsByClassName("header_logo")[0].style.display='none';
    document.getElementsByClassName("logo")[0].style.display='none';





})();