老司机小说自动翻页

try to take over the world!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         老司机小说自动翻页
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       ta
// @match        *://www.yulinzhanye.xyz/*
// @match       *://www.lsjxs.cc/*
// @match       *://www.biquge.info/*
// @grant        none
// @require     https://cdn.bootcdn.net/ajax/libs/jquery/1.10.0/jquery.js
// ==/UserScript==


(function() {

    $(window).scroll(function() {
        if ($(document).scrollTop() >= $(document).height() - $(window).height()) {
            console.log("滚动条已经到达底部为" + $(document).scrollTop());
            var hrefStr = window.location.href
            if(hrefStr.indexOf('biquge')>0){
                autoPage()
            }else{
                console.log()
                tr()
            }
        }

    })

    function autoPage(){
        var st = $($('.bottem a')[3]).attr('href')
        getcontent1(st)
    }

    function getcontent1(url){
        $.ajax({
            type:'get',
            url:url,
            success:function(body,heads,status){
                var bot = $(body)
                $('.bottem').html(bot.find('.bottem'))
                $('#content').append(bot.find('#content').html());  //body就是内容了,也就是url网页中du的内容
            }
        });
    }

    function tr(){
        var leng = $('.chapterPages a').length
        var cur =  $('.chapterPages .curr').text().replace('【','').replace('】','')
        var ahref = ''
        if(cur < leng){
            ahref = $($('.chapterPages a')[cur]).attr('href')
        }
        if(cur == leng){
            ahref = $('.bd .next').attr('href')
        }

        getcontent(ahref)
    }
    function getcontent(url){

        $.ajax({
            type:'get',
            url:url,//这里是baiurl
            success:function(body,heads,status){
                var bot = $(body)
                $('.chapterPages').html(bot.find('.chapterPages'))
                $('.page-control .bd').html(bot.find('.page-control .bd'))
                $('.page-content p').append(bot.find('.page-content p').html())
            }
        });
    }
})();