老司机小说自动翻页

try to take over the world!

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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())
            }
        });
    }
})();