卡提諾小說

小說拉到底下載下一頁、移除廣告

当前为 2017-10-24 提交的版本,查看 最新版本

// ==UserScript==
// @name         卡提諾小說
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  小說拉到底下載下一頁、移除廣告
// @author       Kai
// @match        https://ck101.com/thread*
// @grant        none
// @require      http://code.jquery.com/jquery-3.2.1.min.js
// ==/UserScript==

(function() {
    'use strict';

    //
    var author = $('.authorName')[0].text;
    var url = document.location.href.split('/');  // ex: https://ck101.com/thread-3673404-1-1.html
    var thread = url[3].split('-'); // ex: thread-3673404-1-1.html
    var current = thread[2];
    var maxpage = $('.last').attr('href').split('/')[3].split('-')[2];

    console.clear();

    //移除廣告
    function removeAD() {
        $('.side').remove();              //隱藏右半廣告
        $('.viewthread').width(1000);     //調整版面寬度
        $('.a_t').remove();
        $('.adTopBox').remove();
        $('.ad728Top').remove();
        $('.ad728Btm').remove();
        $('.side_ad').remove();
        $('.a_cn').remove();
        $('.adBox').remove();
        $('.threadBottom').remove();
        $('.wrapper').remove();
        $('.viewthread_announcements').remove();
    }
    removeAD();

    //拉到底時,開始載入下一頁
    $(window).scroll(function(){
        if ($(document).scrollTop() + $(window).height() >= $(document).height()) {
            if (current <= maxpage) {
                current++;
                $.get(`${url[0]}//${url[1]}${url[2]}/${thread[0]}-${thread[1]}-${current}-${thread[3]}`, function(data) {
                    var page = $(data).find('#postlist');
                    $('.mainBox').append(page);
                    removeAD();
                });
            }
        }
    });
})();

QingJ © 2025

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