道客88

以图片形式下载道客88文件

当前为 2022-10-30 提交的版本,查看 最新版本

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

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         道客88
// @namespace    Tampermonkey
// @version      0.1
// @description  以图片形式下载道客88文件
// @author       12321
// @match        https://www.doc88.com/*
// @icon         none
// @grant        none
// @require https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...


    var button = document.createElement("button"); //创建按钮
    button.innerHTML="下载";
    button.onclick =function(){
        //点击继续按钮
        try{
            var con_button = document.getElementById("continueButton");
            con_button.click();
        }catch(err){
            console.log(err);
        }
        var id = '#outer_page_';
        h2c(id,1);
    }

    //递归函数
    function h2c(id,i){
        try{
            //跳转界面
            window.location.hash = id+i;
            //等待加载
            window.setTimeout(function(){
                //转换并下载
                html2canvas($(id+i)[0],{
                useCORS: true,
                allowTaint:true,
            }).then(function (canvas) {
                //console.log(canvas.toDataURL());
                download(canvas.toDataURL(),i);
                h2c(id,i+1);
            })
            },1000)//等待时间1s
        }catch(err){
        console.log(err);
        }
    }

    function download(url,i){
    var a = document.createElement("a");
                    a.href=url;
                    a.download = i+".png";
                    a.click();
    }

    //网页加载1s后生成按钮
    window.setTimeout(function(){
        var x = document.getElementById("item-page-panel");
        var y=document.createElement("li");
        y.appendChild(button);
        x.appendChild( y);
    }, 1000);

})();