// ==UserScript== // @name 文库下载器 // @version 1.3.7 // @namespace https://waahah.gitee.io // @description 百度文库、豆丁网、道客巴巴解析下载功能 解除百度文库复制限制【保持原格式】界面简洁,脚本仅限学习,请大家支持正版。 // @author waahah // @antifeature membership 百度文库需要输入验证码之后才能下载,豆丁网和道客巴巴可直接导出PDF // @require https://cdn.bootcss.com/jquery/3.5.1/jquery.min.js // @require https://cdn.staticfile.org/jspdf/2.5.1/jspdf.umd.min.js // @require https://cdn.staticfile.org/html2canvas/1.4.1/html2canvas.min.js // @match *://wenku.baidu.com/view/* // @match *://wenku.baidu.com/tfview/* // @match *://wenku.baidu.com/link?url* // @match *://wenku.baidu.com/share/* // @match *://www.doc88.com/p-* // @match *://www.docin.com/p-* // @match *://jz.docin.com/p-* // @license Apache-2.0 // @icon data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3Cpath d='M13 13v5.585l1.828-1.828 1.415 1.415L12 22.414l-4.243-4.242 1.415-1.415L11 18.585V13h2zM12 2a7.001 7.001 0 0 1 6.954 6.194 5.5 5.5 0 0 1-.953 10.784v-2.014a3.5 3.5 0 1 0-1.112-6.91 5 5 0 1 0-9.777 0 3.5 3.5 0 0 0-1.292 6.88l.18.03v2.014a5.5 5.5 0 0 1-.954-10.784A7 7 0 0 1 12 2z'/%3E%3C/svg%3E // @grant unsafeWindow // @grant GM_openInTab // @grant GM.openInTab // @grant GM_getValue // @grant GM.getValue // @grant GM_setValue // @grant GM.setValue // @grant GM_xmlhttpRequest // @grant GM.xmlHttpRequest // @grant GM_registerMenuCommand // @downloadURL none // ==/UserScript== (function () { /** * 遵循开源协议,转载请注明出处谢谢 */ 'use strict'; $(function () { let webUrl = window.location.href; let webUrl2; const path = window.location.pathname.split("/")[1]; const host = location.host; const tfpath = location.href.split("/"); const title = document.title.split(' - ')[0]; const InterfaceList = [ { "host": "wkdownload", "url": "http://www.mmhtml.com/zh/?url=" }, { "host": "wenku.baidu.com", "func": "bdwk()", "el": "bdwk_ele" }, { "host": "www.doc88.com", "func": "doc()", "el": "doc_ele" }, { "host": "www.docin.com", "func": "docin()", "el": "docin_ele" }, { "host":"jz.docin.com", "func":"docin()", "el":"docin_ele" } ] function GMxmlhttpRequest(obj) { if (typeof GM_xmlhttpRequest === "function") { GM_xmlhttpRequest(obj); } else { GM.xmlhttpRequest(obj); } } function GMopenInTab(url, open_in_background) { if (typeof GM_openInTab === "function") { GM_openInTab(url, open_in_background); } else { GM.openInTab(url, open_in_background); } } const after = obj => { return obj.replace('/view/', '/share/').replace('.html', '') + '?share_api=1&width=800'; } const css = css => { const myStyle = document.createElement('style'); myStyle.textContent = css; const doc = document.head || document.documentElement; doc.appendChild(myStyle); } css(`#zuihuitao {cursor:pointer; position:fixed; top:100px; left:0px; width:0px; z-index:2147483647; font-size:12px; text-align:left;} #zuihuitao .logo { position: absolute;right: 0; width: 1.375rem;padding: 10px 2px;text-align: center;color: #fff;cursor: auto;user-select: none;border-radius: 0 4px 4px 0;transform: translate3d(100%, 5%, 0);background: deepskyblue;} #zuihuitao .die {display:none; position:absolute; left:28px; top:0; text-align:center;background-color:#04B4AE; border:1px solid gray;} #zuihuitao .die li{font-size:12px; color:#fff; text-align:center; width:60px; line-height:21px; float:left; border:1px solid gray;border-radius: 6px 6px 6px 6px; padding:0 4px; margin:4px 2px;list-style-type: none;} #zuihuitao .die li:hover{color:#fff;background:#FE2E64;} @media print {body {display: block !important;}} *{-webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text;} .add{background-color:#FE2E64;} .btn-success{position: fixed;font-weight: 400;color: #fff;background-color: #28a745;border-color: #28a745;text-align: center;vertical-align: middle;border: 1px solid transparent;padding: .375rem .75rem;font-size: 1rem;line-height: 1.5;border-radius: .25rem; z-index:2147483647;cursor: pointer;}`); const html = $(`