🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

电百网PDF在线下载

[电百网PDF在线下载] 注:本脚本仅是一个操作指导,并没有自动实现具体功能。脚本仅供学习研究计算机技术使用,严禁用于非法行为。

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         电百网PDF在线下载
// @namespace    https://userscript.snomiao.com/
// @version      v2020.08.14
// @description  [电百网PDF在线下载] 注:本脚本仅是一个操作指导,并没有自动实现具体功能。脚本仅供学习研究计算机技术使用,严禁用于非法行为。
// @author       [email protected]
// @match        https://www.ceppedu.com/home/pdf-preview-web/*
// @grant        none
// ==/UserScript==
//
// Copyright © 2020 snomiao 转载请注明出处
//

console.log(
  "[电百网PDF在线下载] 注:本脚本仅是一个操作指导,并没有自动实现具体功能。脚本仅供学习研究计算机技术使用,严禁用于非法行为。"
);

() => {
  ```
    打开开发者工具
    点 Source
    找到 UIExtension.full.****.js
    搜索 ZoomInAndOutController
    在后面的 handle 函数内部,配置 断点
    点一下缩小的放大镜,此时将停在断点处
    打开控制台,执行下面的代码
    ```;

  _this = this;

  ```
    然后点继续执行(离开断点)
    然后执行下面代码,即可下载到 pdf 文件
    ```;

  function createAndDownloadBlobFile(
    arrayBuffers,
    filename,
    extension = "pdf"
  ) {
    const blob = new Blob(arrayBuffers);
    const fileName = `${filename}.${extension}`;
    if (navigator.msSaveBlob) {
      // IE 10+
      navigator.msSaveBlob(blob, fileName);
    } else {
      const link = document.createElement("a");
      // Browsers that support HTML5 download attribute
      if (link.download !== undefined) {
        const url = URL.createObjectURL(blob);
        link.setAttribute("href", url);
        link.setAttribute("download", fileName);
        link.style.visibility = "hidden";
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
      }
    }
  }

  var o = (function () {
    return function (t, e) {
      if (Array.isArray(t)) return t;
      if (Symbol.iterator in Object(t))
        return (function (t, e) {
          var n = [],
            o = !0,
            r = !1,
            i = void 0;
          try {
            for (
              var a, s = t[Symbol.iterator]();
              !(o = (a = s.next()).done) &&
              (n.push(a.value), !e || n.length !== e);
              o = !0
            );
          } catch (t) {
            (r = !0), (i = t);
          } finally {
            try {
              !o && s.return && s.return();
            } finally {
              if (r) throw i;
            }
          }
          return n;
        })(t, e);
      throw new TypeError(
        "Invalid attempt to destructure non-iterable instance"
      );
    };
  })();

  Object.entries(window).map((e) => e[1].getPDFUI);
  _this
    .getPDFUI()
    .getPDFViewer()
    .then(function (t) {
      var e = [];
      return t.currentPDFDoc
        .getStream(function (t) {
          var n = t.arrayBuffer;
          e.push(n);
        })
        .then(function (n) {
          return [e, t.currentPDFDoc.getFileName()];
        });
    })
    .then(function (e) {
      var n = o(e, 2);
      createAndDownloadBlobFile(n[0], n[1]);
    });
};