次元W

百度秒传的脚本

其他分类 angles - 2

百度秒传的脚本(油猴上的秒链炸了,那几天丢了以后没再找,总算找到了,直接扒过来了)

从下面复制到创建页就行了

// ==UserScript==
// @name 秒传链接提取
// @version 2.2.2
// @author mengzonefire
// @description 用于提取和生成百度网盘秒传链接
// @homepage https://greasyfork.org/zh-CN/scripts/424574
// @supportURL https://github.com/mengzonefire/rapid-upload-userscript/issues
// @match *://pan.baidu.com/disk/home*
// @match *://pan.baidu.com/disk/main*
// @match *://yun.baidu.com/disk/home*
// @match *://yun.baidu.com/disk/main*
// @match *://wangpan.baidu.com/disk/home*
// @match *://wangpan.baidu.com/disk/main*
// @name:en rapidupload-userscript
// @license GPLv3
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABBUlEQVR4AZTTJRBUURTH4TtDwXuPdPrgbhHXiksf3CPucRNScHd3d3d3uO9bKeu7b79+fun8Q17CNHyMMUqaiPE4fEyYVjjGNKnNwQ4lpgV8lManEfwfosLHEGPU1N3ZnAv4qlT+NiQ56uPWSjKBrztUSnIaB66sY1vgxgxoMXB5NbsCB9rxcB5fN2M5/16nCFxeS6YTezpzsB1Pu/C2O7/78/99eYBYHXh+gqdHObGIK4GHgevjVIt1AgAnhvE4cGe8euoHbizgYuD2RGgx8O0RpwIPRmsmJDGqcrANd3pLo/qVr03hUlcpfSwf0/vD3JwkPdPK5/zhkOz+/f1FIDv/RcnOAEjywH/DhgADAAAAAElFTkSuQmCC
// @namespace moe.cangku.mengzonefire
// @homepageURL https://greasyfork.org/zh-CN/scripts/424574
// @contributionURL https://afdian.net/@mengzonefire
// @description:en input bdlink to get files or get bdlink for Baidu™ WebDisk.
// @compatible firefox Violentmdata-filter
// @compatible firefox Tampermdata-filter
// @compatible chrome Violentmdata-filter
// @compatible chrome Tampermdata-filter
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_deleteValue
// @grant GM_setClipboard
// @grant GM_getResourceText
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @resource swalCss https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css
// @resource swalCssBak https://unpkg.com/sweetalert2@11/dist/sweetalert2.min.css
// @require https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js
// @require https://cdn.staticfile.org/spark-md5/3.0.0/spark-md5.min.js
// @require https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.js
// @require https://cdn.jsdelivr.net/npm/js-base64@3.7.2/base64.min.js
// @require https://unpkg.com/sweetalert2@11/dist/sweetalert2.min.js
// @require https://unpkg.com/js-base64@3.7.2/base64.js
// @run-at document-start
// @connect baidu.com
// @connect baidupcs.com
// @connect cdn.jsdelivr.net
// @connect *
// ==/UserScript==

(() => {
var __webpack_modules__ = {
119: module => {
module.exports = ‘.mzf_btn{text-align:center;font-size:.85em;color:#09aaff;border:2px solid #c3eaff;border-radius:4px;margin:0 5px;padding:10px;padding-top:5px;padding-bottom:5px;cursor:pointer}.mzf_link{font-family:inherit;color:#09aaff;text-decoration:none;vertical-align:baseline}.mzf_text{font-feature-settings:”lnum”;-webkit-font-smoothing:antialiased;font-family:inherit;color:#545454;font-weight:400;word-break:break-word;-webkit-tap-highlight-color:transparent;margin:0;padding:0;width:100%;height:34px;display:block;line-height:34px;text-align:center}.mzf_new_btn{-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent;vertical-align:middle;font:inherit;overflow:visible;text-transform:none;font-family:SFUIText,PingFangSC-Regular,Helvetica Neue,Helvetica,Arial,sans-serif;display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;text-align:center;box-sizing:border-box;outline:0;margin:0;transition:.1s;color:#fff;background-color:#06a7ff;font-weight:700;padding:8px 24px;height:32px;font-size:14px;border-radius:16px;border:none}svg{margin-right:5px;transform:rotate(180deg);transition:transform .2s;fill:none;stroke:gray}.mzf_details{cursor:pointer}.mzf_content{max-height:0;margin:0;transition:max-height .5s;overflow:hidden}.mzf_details[open]>summary>svg{transform:rotate(0deg)}.mzf_details[open]+.mzf_content{max-height:100%}.mzf_html_container{grid-template-columns:minmax(0, 100%);align-self:center;justify-self:center;width:32em;max-width:100%}.mzf_updateInfo{border:1px #000;width:100%;margin:0 auto}.mzf_updateInfo span{vertical-align:baseline}’;
},
197: module => {
module.exports = ‘input[type=”checkbox”],rninput[type=”radio”] {rn  –active: #275efe;rn  –active-inner: #fff;rn  –focus: 2px rgba(39, 94, 254, 0.3);rn  –border: #bbc1e1;rn  –border-hover: #275efe;rn  –background: #fff;rn  –disabled: #f6f8ff;rn  –disabled-inner: #e1e6f9;rn  -webkit-appearance: none;rn  -moz-appearance: none;rn  height: 21px;rn  outline: none;rn  display: inline-block;rn  vertical-align: top;rn  position: relative;rn  margin: 0;rn  cursor: pointer;rn  border: 1px solid var(–bc, var(–border));rn  background: var(–b, var(–background));rn  -webkit-transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;rn  transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;rn}rninput[type=”checkbox”]:after,rninput[type=”radio”]:after {rn  content: “”;rn  display: block;rn  left: 0;rn  top: 0;rn  position: absolute;rn  -webkit-transition: opacity var(–d-o, 0.2s),rn    -webkit-transform var(–d-t, 0.3s) var(–d-t-e, ease);rn  transition: opacity var(–d-o, 0.2s),rn    -webkit-transform var(–d-t, 0.3s) var(–d-t-e, ease);rn  transition: transform var(–d-t, 0.3s) var(–d-t-e, ease),rn    opacity var(–d-o, 0.2s);rn  transition: transform var(–d-t, 0.3s) var(–d-t-e, ease),rn    opacity var(–d-o, 0.2s),rn    -webkit-transform var(–d-t, 0.3s) var(–d-t-e, ease);rn}rninput[type=”checkbox”]:checked,rninput[type=”radio”]:checked {rn  –b: var(–active);rn  –bc: var(–active);rn  –d-o: 0.3s;rn  –d-t: 0.6s;rn  –d-t-e: cubic-bezier(0.2, 0.85, 0.32, 1.2);rn}rninput[type=”checkbox”]:disabled,rninput[type=”radio”]:disabled {rn  –b: var(–disabled);rn  cursor: not-allowed;rn  opacity: 0.9;rn}rninput[type=”checkbox”]:disabled:checked,rninput[type=”radio”]:disabled:checked {rn  –b: var(–disabled-inner);rn  –bc: var(–border);rn}rninput[type=”checkbox”]:disabled + label,rninput[type=”radio”]:disabled + label {rn  cursor: not-allowed;rn}rninput[type=”checkbox”]:hover:not(:checked):not(:disabled),rninput[type=”radio”]:hover:not(:checked):not(:disabled) {rn  –bc: var(–border-hover);rn}rninput[type=”checkbox”]:focus,rninput[type=”radio”]:focus {rn  box-shadow: 0 0 0 var(–focus);rn}rninput[type=”checkbox”]:not(.switch),rninput[type=”radio”]:not(.switch) {rn  width: 21px;rn}rninput[type=”checkbox”]:not(.switch):after,rninput[type=”radio”]:not(.switch):after {rn  opacity: var(–o, 0);rn}rninput[type=”checkbox”]:not(.switch):checked,rninput[type=”radio”]:not(.switch):checked {rn  –o: 1;rn}rninput[type=”checkbox”] + label,rninput[type=”radio”] + label {rn  font-size: 18px;rn  line-height: 21px;rn  display: inline-block;rn  vertical-align: top;rn  cursor: pointer;rn  margin-left: 4px;rn}rnrninput[type=”checkbox”]:not(.switch) {rn  border-radius: 7px;rn}rninput[type=”checkbox”]:not(.switch):after {rn  width: 5px;rn  height: 9px;rn  border: 2px solid var(–active-inner);rn  border-top: 0;rn  border-left: 0;rn  left: 7px;rn  top: 4px;rn  -webkit-transform: rotate(var(–r, 20deg));rn  transform: rotate(var(–r, 20deg));rn}rninput[type=”checkbox”]:not(.switch):checked {rn  –r: 43deg;rn}rninput[type=”checkbox”].switch {rn  width: 38px;rn  border-radius: 11px;rn}rninput[type=”checkbox”].switch:after {rn  left: 2px;rn  top: 2px;rn  border-radius: 50%;rn  width: 15px;rn  height: 15px;rn  background: var(–ab, var(–border));rn  -webkit-transform: translateX(var(–x, 0));rn  transform: translateX(var(–x, 0));rn}rninput[type=”checkbox”].switch:checked {rn  –ab: var(–active-inner);rn  –x: 17px;rn}rninput[type=”checkbox”].switch:disabled:not(:checked):after {rn  opacity: 0.6;rn}rn’;
},
184: module => {
module.exports = ‘<div class=”panel-body” style=”height: 250px; overflow-y: scroll”>rn  <div class=”mzf_updateInfo”>rn    <span>rn      <p>rn        若喜欢该脚本可前往rn        <a href=”https://afdian.net/@mengzonefire” class=”mzf_link” rel=”noopener noreferrer” target=”_blank”>赞助页</a>rn        支持作者rn      </p>rnrn      <p>rn        若出现任何问题请前往rn        <a href=”https://greasyfork.org/zh-CN/scripts/424574″ class=”mzf_link” rel=”noopener noreferrer”rn          target=”_blank”>脚本主页</a>rn        反馈rn      </p>rnrn      <p><br /></p>rnrn      <p>2.2.0 更新内容(22.3.24):</p>rnrn      <p>1.修复重复弹窗时出现的背景闪屏问题</p>rnrn      <p>2.将输入秒传和保存路径的窗口整合, 减少弹窗步骤</p>rnrn      <p>3.设置页新增 “<span style=”color: red”>监听剪贴板</span>” 功能, 开启后可自动粘贴秒传</p>rnrn      <p><br /></p>rnrn      <p>2.1.5 更新内容(22.3.17):</p>rnrn      <p>转存完成后同时显示成功和失败列表折叠框</p>rnrn      <img src=”https://pic3.58cdn.com.cn/nowater/webim/big/n_v2227bef15f950440bae9e4b710fb42eb5.gif” />rnrn      <p><br /></p>rnrn      <p>2.1.3 更新内容(22.2.24):</p>rnrn      <p>1. 修复新版度盘页面下的按钮样式</p>rnrn      <p>2. 修复新版度盘页面下的 “打开目录” 功能</p>rnrn      <p><br /></p>rnrn      <p>2.1.0 更新内容(22.1.22):</p>rnrn      <p>支持 新版度盘页面 下的 “生成秒传” 功能</p>rnrn      <img src=”https://pic.rmb.bdstatic.com/bjh/8c05bf7c7ba44cb6f7e0a68c3e17ab54.png” />rnrn      <p><br /></p>rnrn      <p>2.0.20 更新内容(22.1.22):</p>rnrn      <p>rn        修复部分生成秒传时提示 “请求失败…(#514)” 的问题, 生成时若弹出跨域提示,rn        请选择允许rn      </p>rnrn      <p><br /></p>rnrn      <p>2.0.12 更新内容(21.11.9):</p>rnrn      <p>rn        修复所有失效的文档链接, 见rn        <a href=”https://mengzonefire.code.misakanet.cn/rapid-upload-userscript-doc” class=”mzf_link”rn          rel=”noopener noreferrer” target=”_blank”>文档目录</a>rn      </p>rnrn      <p>修复在目标目录下点击”打开目录”按钮, 文件列表不刷新的问题</p>rnrn      <p><br /></p>rnrn      <p>2.0.11 更新内容(21.10.18):</p>rnrn      <p>移除一处可能导致生成错误秒传的代码</p>rnrn      <p><br /></p>rnrn      <p>2.0.10 更新内容(21.10.1):</p>rnrn      <p>修复失效的教程文档地址</p>rnrn      <p>*部分地区打开显示石墨文档正在升级</p>rnrn      <p><br /></p>rnrn      <p>2.0.5 更新内容(21.9.1):</p>rnrn      <p>rn        转存路径留空现改为默认转存到 <span style=”color: red”>当前目录</span>rn      </p>rnrn      <p><br /></p>rnrn      <p><span style=”color: red”>2.0.0</span> 更新内容(21.8.30):</p>rnrn      <p>1.移除游侠秒传格式的支持</p>rnrn      <p>2.重构代码, 全面优化, 提升使用体验</p>rnrn      <p><br /></p>rnrn      <p>1.8.5 更新内容(21.7.30):</p>rnrn      <p>rn        修复了部分转存提示 “<span style=”color: red”>转存失败(尝试…)(#2)</span>” 的问题rn      </p>rnrn      <p><br /></p>rnrn      <p>1.8.4 更新内容(21.7.18):</p>rnrn      <p>rn        修复了部分生成提示 “<span style=”color: red”>md5获取失败</span>” 的问题rn      </p>rnrn      <p><br /></p>rnrn      <p>1.8.1 更新内容(21.7.6):</p>rnrn      <p>支持转存与生成 <span style=”color: red”>20G以上</span> 文件的秒传</p>rnrn      <p><br /></p>rnrn      <p>1.7.9 更新内容(21.6.28):</p>rnrn      <p>1.大幅提升非会员账号生成秒传的速度</p>rnrn      <p>rn        2.修复生成4G以上文件提示”<span style=”color: red”>服务器错误(#500)</span>”的问题rn      </p>rnrn      <p><br /></p>rnrn      <p>1.7.8 更新内容(21.6.25):</p>rnrn      <p>rn        修复了绝大部分转存提示 “<span style=”color: red”>文件不存在(秒传未生效)(#404)</span>” 的问题rn      </p>rnrn      <p><br /></p>rnrn      <p>1.7.3 更新内容(21.6.23):</p>rnrn      <p>升级样式&主题, 提升观感, 修复了设置内的主题适配</p>rnrn      <p><br /></p>rnrn      <p>1.6.8 更新内容(21.6.18)</p>rnrn      <p>rn        移除 <span style=”color: red”>修复下载</span> 功能(已在21年4月上旬失效),rn        后续不会再考虑修复该功能rn      </p>rnrn      <p><br /></p>rnrn      <p>1.6.7 更新内容(21.3.30)</p>rnrn      <p>修复部分秒传转存时提示 “文件不存在(秒传无效)”</p>rnrn      <p><br /></p>rnrn      <p>1.6.1 更新内容(21.3.29)</p>rnrn      <p>rn        新增 <span style=”color: red”>直接修复下载</span> 的功能,rn        选中网盘内文件, 再点击上方rn        <span style=”color: red”>修复下载</span> 按钮即可生成可正常下载的新文件rn      </p>rnrn      <img src=”https://pic.rmb.bdstatic.com/bjh/5e05f7c1f772451b8efce938280bcaee.png” />rnrn      <p><br /></p>rnrn      <p>1.5.7 更新内容(21.3.9)</p>rnrn      <p>rn        修复部分文件转存后 <span style=”color: red”>无法下载</span> 的问题,rn        可尝试 <span style=”color: red”>重新转存</span> 之前无法下载文件.rn        且转存新增了 <span style=”color: red”>修复下载</span> 功能rn      </p>rnrn      <p><br /></p>rnrn      <p>1.5.4 更新内容(21.2.11)</p>rnrn      <p>rn        面向分享者的rn        <a href=”https://mengzonefire.code.misakanet.cn/rapid-upload-userscript-doc/generate-bdcode/”rn          rel=”noopener noreferrer” target=”_blank”>分享教程</a>rn        的防和谐方法更新:rn      </p>rnrn      <p>rn        经测试, 原教程的 “固实压缩+加密文件名”rn        已无法再防和谐(在度盘移动端依旧可以在线解压),rn        目前有效的防和谐方法请参考教程内的rn        <span style=”color: red”>”双层压缩”</span>rn      </p>rnrn      <p><br /></p>rnrn      <p>1.4.3 更新内容(21.2.6):</p>rnrn      <p>修复了生成秒传时, 秒传有效, 仍提示”md5获取失败(#996)”的问题</p>rnrn      <p><br /></p>rnrn      <p>1.4.9 更新内容(21.1.28):</p>rnrn      <p>1. 重新兼容了暴力猴插件, 感谢Trendymen提供的代码</p>rnrn      <p>rn        2. 新增更换主题的功能, 在秒传输入框中输入setting进入设置页,rn        更换为其他主题, 即可避免弹窗时的背景变暗rn      </p>rnrn      <p>3. 修改了部分代码逻辑, 秒传按钮不会再出现在最左边了</p>rnrn      <p><br /></p>rnrn      <p>1.4.6 更新内容(21.1.14):</p>rnrn      <p>本次更新针对生成功能做了优化:</p>rnrn      <p>rn        1. 使用超会账号进行10个以上的批量秒传生成时, 会弹窗提示设置生成间隔,rn        防止生成过快导致接口被限制(#403)rn      </p>rnrn      <p>rn        2. 为秒传分享者提供了一份<a href=”https://mengzonefire.code.misakanet.cn/rapid-upload-userscript-doc/generate-bdcode/”rn          rel=”noopener noreferrer” target=”_blank”>分享教程</a>用于参考rn      </p>rnrn      <p><br /></p>rnrn      <p>1.4.5 更新内容(21.1.12):</p>rnrn      <p>修复了1.4.0后可能出现的秒传按钮无效、显示多个秒传按钮的问题</p>rnrn      <p><br /></p>rnrn      <p>1.3.7 更新内容(21.1.3):</p>rnrn      <p>修复了会员账号生成50M以下文件时提示 “md5获取失败” 的问题</p>rnrn      <p><br /></p>rnrn      <p>1.3.3 更新内容(20.12.1):</p>rnrn      <p>rn        秒传生成完成后点击复制按钮之前都可以继续任务,防止误操作关闭页面导致生成结果丢失rn      </p>rnrn      <p>修改代码执行顺序防止秒传按钮出现在最左端</p>rnrn      <p>修复了跨域提示中失效的说明图片</p>rnrn      <p><br /></p>rnrn      <p>1.2.9 更新内容(20.11.11):</p>rnrn      <p>生成秒传的弹窗添加了关闭按钮</p>rnrn      <p>删除了全部生成失败时的复制和测试按钮</p>rnrn      <p>秒传生成后加了一个导出文件路径的选项(默认不导出)</p>rnrn      <p>在输入保存路径的弹窗添加了校验, 防止输入错误路径</p>rnrn      <p><br /></p>rnrn      <p>1.2.5 更新内容(20.11.4):</p>rnrn      <p>优化按钮样式, 添加了md5获取失败的报错</p>rnrn      <p>修复从pan.baidu.com进入后不显示生成按钮的问题</p>rnrn      <p><br /></p>rnrn      <p>1.2.4 更新内容(20.11.2):</p>rnrn      <p>新增生成秒传:</p>rnrn      <p>选择文件或文件夹后点击 “生成秒传” 即可开始生成</p>rnrn      <p><br /></p>rnrn      <p>继续未完成任务:</p>rnrn      <p>若生成秒传期间关闭了网页, 再次点击 “生成秒传” 即可继续任务</p>rnrn      <p><br /></p>rnrn      <p>测试秒传功能:</p>rnrn      <p>rn        生成完成后, 点击”测试”按钮, 会自动转存并覆盖文件(文件内容不变),rn        以检测秒传有效性, 以及修复md5错误防止秒传失效rn      </p>rn    </span>rn  </div>rn</div>’;
}
};
var __webpack_module_cache__ = {};
function __webpack_require__(moduleId) {
var cachedModule = __webpack_module_cache__[moduleId];
if (cachedModule !== undefined) {
return cachedModule.exports;
}
var module = __webpack_module_cache__[moduleId] = {
exports: {}
};
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
return module.exports;
}
(() => {
__webpack_require__.n = module => {
var getter = module && module.__esModule ? () => module[“default”] : () => module;
__webpack_require__.d(getter, {
a: getter
});
return getter;
};
})();
(() => {
__webpack_require__.d = (exports, definition) => {
for (var key in definition) {
if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
Object.defineProperty(exports, key, {
enumerable: true,
get: definition[key]
});
}
}
};
})();
(() => {
__webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
})();
var __webpack_exports__ = {};
(() => {
“use strict”;
var updateInfoVer = “2.2.0”;
var swalCssVer = “1.7.4”;
var donateVer = “2.1.0”;
var feedbackVer = “2.1.0”;
var locUrl = location.href;
var baiduNewPage = “baidu.com/disk/main”;
var TAG = “[秒传链接提取 by mengzonefire]”;
var homePage = “https://greasyfork.org/zh-CN/scripts/424574”;
var donatePage = “https://afdian.net/@mengzonefire”;
var ajaxError = 514;
var extCssUrl = {
Default: “https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css”,
Dark: “https://cdn.jsdelivr.net/npm/@sweetalert2/theme-dark@5/dark.min.css”,
“WordPress Admin”: “https://cdn.jsdelivr.net/npm/@sweetalert2/theme-wordpress-admin@5/wordpress-admin.min.css”,
“Material UI”: “https://cdn.jsdelivr.net/npm/@sweetalert2/theme-material-ui@5/material-ui.min.css”,
Bulma: “https://cdn.jsdelivr.net/npm/@sweetalert2/theme-bulma@5/bulma.min.css”,
“Bootstrap 4”: “https://cdn.jsdelivr.net/npm/@sweetalert2/theme-bootstrap-4/bootstrap-4.min.css”
};
var appError = {
missDepend: “外部资源加载失败, 请前往脚本页反馈:n” + homePage,
SwalCssInvalid: “样式包数据错误, 请前往脚本页反馈:n” + homePage,
SwalCssErrReq: “样式包加载失败, 请前往脚本页反馈:n” + homePage + “n错误代码: ”
};
var doc = {
shareDoc: “https://mengzonefire.code.misakanet.cn/rapid-upload-userscript-doc/generate-bdcode/”,
linkTypeDoc: “https://mengzonefire.code.misakanet.cn/rapid-upload-userscript-doc/format-support/”
};
var linkStyle = ‘class=”mzf_link” rel=”noopener noreferrer” target=”_blank”‘;
var btnStyle = ‘class=”mzf_btn” rel=”noopener noreferrer” target=”_blank”‘;
var bdlinkPattern = /#bdlink=([da-zA-Z+/=]+)/;
var htmlCheckMd5 = ‘<p class=”mzf_text”>测试秒传 可防止秒传失效<a id=”check_md5_btn” class=”mzf_btn”><span class=”text” style=”width: auto;”>测试</span></a></p>’;
var htmlDocument = ‘<p class=”mzf_text”>秒传无效/md5获取失败/防和谐等 可参考<a href=”‘ + doc.shareDoc + ‘” ‘ + btnStyle + ‘><span class=”text” style=”width: auto;”>分享教程</span></a></p>’;
var htmlDonate = ‘<p id=”mzf_donate” class=”mzf_text”>若喜欢该脚本, 可前往 <a href=”‘ + donatePage + ‘” ‘ + linkStyle + ‘>赞助页</a> 支持作者<a id=”kill_donate” class=”mzf_btn”>不再显示</a></p>’;
var htmlFeedback = ‘<p id=”mzf_feedback” class=”mzf_text”>若有任何疑问, 可前往 <a href=”‘ + homePage + ‘” ‘ + linkStyle + ‘>脚本主页</a> 反馈<a id=”kill_feedback” class=”mzf_btn”>不再显示</a></p>’;
function initQueryLink() {
var bdlinkB64 = locUrl.match(bdlinkPattern);
return bdlinkB64 ? bdlinkB64[1].fromBase64() : “”;
}
function DuParser() {}
DuParser.parse = function generalDuCodeParse(szUrl) {
var r;
if (szUrl.indexOf(“bdpan”) === 0) {
r = DuParser.parseDu_v1(szUrl);
r.ver = “PanDL”;
} else if (szUrl.indexOf(“BaiduPCS-Go”) === 0) {
r = DuParser.parseDu_v2(szUrl);
r.ver = “PCS-Go”;
} else if (szUrl.indexOf(“BDLINK”) === 0) {
r = DuParser.parseDu_v3(szUrl);
r.ver = “游侠 v1”;
} else {
r = DuParser.parseDu_v4(szUrl);
r.ver = “梦姬标准”;
}
return r;
};
DuParser.parseDu_v1 = function parseDu_v1(szUrl) {
return szUrl.replace(/s*bdpan:///g, ” “).trim().split(” “).map((function(z) {
return z.trim().fromBase64().match(/([sS]+)|([d]{1,20})|([dA-Fa-f]{32})|([dA-Fa-f]{32})/);
})).filter((function(z) {
return z;
})).map((function(info) {
return {
md5: info[3],
md5s: info[4],
size: info[2],
path: info[1]
};
}));
};
DuParser.parseDu_v2 = function parseDu_v2(szUrl) {
return szUrl.split(“n”).map((function(z) {
return z.trim().match(/-length=([d]{1,20}) -md5=([dA-Fa-f]{32}) -slicemd5=([dA-Fa-f]{32})[sS]+”([sS]+)”/);
})).filter((function(z) {
return z;
})).map((function(info) {
return {
md5: info[2],
md5s: info[3],
size: info[1],
path: info[4]
};
}));
};
DuParser.parseDu_v3 = function parseDu_v3(szUrl) {
var raw = atob(szUrl.slice(6).replace(/s/g, “”));
if (raw.slice(0, 5) !== “BDFS”) {
return null;
}
var buf = new SimpleBuffer(raw);
var ptr = 9;
var arrFiles = [];
var fileInfo, nameSize;
var total = buf.readUInt(5);
var i;
for (i = 0; i < total; i++) {
fileInfo = {};
fileInfo.size = buf.readULong(ptr + 0);
fileInfo.md5 = buf.readHex(ptr + 8, 16);
fileInfo.md5s = buf.readHex(ptr + 24, 16);
nameSize = buf.readUInt(ptr + 40) << 1;
fileInfo.nameSize = nameSize;
ptr += 44;
fileInfo.path = buf.readUnicode(ptr, nameSize);
arrFiles.push(fileInfo);
ptr += nameSize;
}
return arrFiles;
};
DuParser.parseDu_v4 = function parseDu_v3(szUrl) {
return szUrl.split(“n”).map((function(z) {
return z.trim().match(/^([dA-Fa-f]{32})#(?:([dA-Fa-f]{32})#)?([d]{1,20})#([sS]+)/);
})).filter((function(z) {
return z;
})).map((function(info) {
return {
md5: info[1],
md5s: info[2] || “”,
size: info[3],
path: info[4]
};
}));
};
function SimpleBuffer(str) {
this.fromString(str);
}
SimpleBuffer.toStdHex = function toStdHex(n) {
return (“0” + n.toString(16)).slice(-2);
};
SimpleBuffer.prototype.fromString = function fromString(str) {
var len = str.length;
this.buf = new Uint8Array(len);
for (var i = 0; i < len; i++) {
this.buf[i] = str.charCodeAt(i);
}
};
SimpleBuffer.prototype.readUnicode = function readUnicode(index, size) {
if (size & 1) {
size++;
}
var bufText = Array.prototype.slice.call(this.buf, index, index + size).map(SimpleBuffer.toStdHex);
var buf = [ “” ];
for (var i = 0; i < size; i += 2) {
buf.push(bufText[i + 1] + bufText[i]);
}
return JSON.parse(‘”‘ + buf.join(“\u”) + ‘”‘);
};
SimpleBuffer.prototype.readNumber = function readNumber(index, size) {
var ret = 0;
for (var i = index + size; i > index; ) {
ret = this.buf[–i] + ret * 256;
}
return ret;
};
SimpleBuffer.prototype.readUInt = function readUInt(index) {
return this.readNumber(index, 4);
};
SimpleBuffer.prototype.readULong = function readULong(index) {
return this.readNumber(index, 8);
};
SimpleBuffer.prototype.readHex = function readHex(index, size) {
return Array.prototype.slice.call(this.buf, index, index + size).map(SimpleBuffer.toStdHex).join(“”);
};
var updateInfo = __webpack_require__(184);
var updateInfo_default = __webpack_require__.n(updateInfo);
var SwalConfig = {
inputView: {
title: “请输入秒传&保存路径”,
showCancelButton: true,
html: ‘<textarea id=”mzf-rapid-input” class=”swal2-textarea” placeholder=”[支持批量(换行分隔)]n[支持PanDL/游侠/标准码/GO格式]n[可在设置页开启监听剪贴板,自动输入秒传]n[输入set进入设置页][输入gen进入生成页]” style=”display: flex;”></textarea>n    <input id=”mzf-path-input” class=”swal2-input” placeholder=”保存路径, 示例: /GTA5/, 留空保存在当前目录” style=”display: flex;margin-top: 10px;”>’,
confirmButtonText: “确定”,
cancelButtonText: “取消”,
customClass: {
htmlContainer: “mzf_html_container”
}
},
processView: {
showCloseButton: true,
showConfirmButton: false,
allowOutsideClick: false
},
finishView: {
showCloseButton: true,
allowOutsideClick: false
},
genUnfinish: {
title: “检测到未完成的秒传任务”,
text: “是否继续进行?”,
showCancelButton: true,
allowOutsideClick: false,
confirmButtonText: “是”,
cancelButtonText: “否”
},
genView: {
title: “请输入需要生成的文件路径”,
input: “textarea”,
showCancelButton: true,
showCloseButton: true,
inputPlaceholder: “[支持批量(换行分隔)]”,
confirmButtonText: “确定”,
cancelButtonText: “取消”,
inputValidator: function(value) {
if (!value) {
return “文件路径不能为空”;
}
}
},
updateInfo: {
title: “秒传链接提取 更新内容”,
showCloseButton: true,
allowOutsideClick: false,
confirmButtonText: “知道了”,
html: updateInfo_default()
},
checkRecursive: {
icon: “info”,
title: “包含文件夹, 是否递归生成?”,
text: “若选是, 将同时生成各级子文件夹下的文件”,
allowOutsideClick: false,
focusCancel: true,
showCancelButton: true,
reverseButtons: true,
showCloseButton: true,
confirmButtonText: “是”,
cancelButtonText: “否”
},
checkMd5Warning: {
title: “使用前请注意”,
text: “测试秒传会转存并覆盖文件,若在生成期间修改过同名文件,为避免修改的文件丢失,请不要使用此功能!”,
input: “checkbox”,
inputPlaceholder: “不再显示”,
showCancelButton: true,
allowOutsideClick: false,
confirmButtonText: “确定”,
cancelButtonText: “返回”
},
settingView: {
title: “秒传链接提取 设置页”,
showCloseButton: true,
showCancelButton: true,
confirmButtonText: “确定”,
cancelButtonText: “取消”,
allowOutsideClick: false,
html: ‘<select class=”swal2-select” id=”mzf-theme” style=”display: flex;border-width: 1px;border-style: solid;”><option value=”Default”>Default 白色主题(默认)</option><option value=”Bulma”>Bulma 白色简约</option><option value=”Bootstrap 4″>Bootstrap4 白色简约</option><option value=”Material UI”>MaterialUI 白色主题</option><option value=”Dark”>Dark 黑色主题</option><option value=”WordPress Admin”>WordPressAdmin 灰色主题</option></select>n    <label for=”swal2-checkbox” class=”swal2-checkbox” style=”display: flex;”><span class=”swal2-label”>监听剪贴板 (需要允许剪贴板权限)</span><input type=”checkbox” value=”1″ id=”mzf-listen-clipboard” style=”margin-left: 20px;”></label>’
},
settingWarning: {
title: “设置成功 刷新页面生效”,
showCloseButton: true,
allowOutsideClick: false,
confirmButtonText: “知道了”
},
selectNoFileWarning: {
title: “请勾选要生成秒传的文件/文件夹”,
icon: “error”,
showCloseButton: true,
confirmButtonText: “知道了”
}
};
var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P((function(resolve) {
resolve(value);
}));
}
return new (P || (P = Promise))((function(resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator[“throw”](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
}));
};
var __generator = undefined && undefined.__generator || function(thisArg, body) {
var _ = {
label: 0,
sent: function() {
if (t[0] & 1) throw t[1];
return t[1];
},
trys: [],
ops: []
}, f, y, t, g;
return g = {
next: verb(0),
throw: verb(1),
return: verb(2)
}, typeof Symbol === “function” && (g[Symbol.iterator] = function() {
return this;
}), g;
function verb(n) {
return function(v) {
return step([ n, v ]);
};
}
function step(op) {
if (f) throw new TypeError(“Generator is already executing.”);
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y[“return”] : op[0] ? y[“throw”] || ((t = y[“return”]) && t.call(y),
0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [ op[0] & 2, t.value ];
switch (op[0]) {
case 0:
case 1:
t = op;
break;

case 4:
_.label++;
return {
value: op[1],
done: false
};

case 5:
_.label++;
y = op[1];
op = [ 0 ];
continue;

case 7:
op = _.ops.pop();
_.trys.pop();
continue;

default:
if (!(t = _.trys, t = t.length > 0 && t[t.length – 1]) && (op[0] === 6 || op[0] === 2)) {
_ = 0;
continue;
}
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
_.label = op[1];
break;
}
if (op[0] === 6 && _.label < t[1]) {
_.label = t[1];
t = op;
break;
}
if (t && _.label < t[2]) {
_.label = t[2];
_.ops.push(op);
break;
}
if (t[2]) _.ops.pop();
_.trys.pop();
continue;
}
op = body.call(thisArg, _);
} catch (e) {
op = [ 6, e ];
y = 0;
} finally {
f = t = 0;
}
if (op[0] & 5) throw op[1];
return {
value: op[0] ? op[1] : void 0,
done: true
};
}
};
function showAlert(text) {
alert(TAG + “:n” + text);
}
function randomStringTransform(string) {
var tempString = [];
for (var _i = 0, string_1 = string; _i < string_1.length; _i++) {
var i = string_1[_i];
if (!Math.round(Math.random())) {
tempString.push(i.toLowerCase());
} else {
tempString.push(i.toUpperCase());
}
}
return tempString.join(“”);
}
function parsefileInfo(fileInfoList) {
var bdcode = “”;
var successInfo = “”;
var failedInfo = “”;
var failedCount = 0;
var successList = [];
fileInfoList.forEach((function(item) {
if (item.errno) {
failedCount++;
failedInfo += “<p>文件:” + item.path + “</p><p>失败原因:” + baiduErrno(item.errno) + “(#” + item.errno + “)</p>”;
} else {
successInfo += “<p>文件:” + item.path + “</p>”;
bdcode += item.md5 + “#” + item.md5s + “#” + item.size + “#” + item.path + “n”;
successList.push(item);
}
}));
if (failedInfo) failedInfo = ‘<details class=”mzf_details”><summary><svg width=”16″ height=”7″><polyline points=”0,0 8,7 16,0″/></svg><b>失败文件列表(点击展开):</b></summary></details><div class=”mzf_content”>’ + failedInfo + “</div>”;
if (successInfo) successInfo = ‘<details class=”mzf_details”><summary><svg width=”16″ height=”7″><polyline points=”0,0 8,7 16,0″/></svg><b>成功文件列表(点击展开):</b></summary></details><div class=”mzf_content”>’ + successInfo + “</div>”;
bdcode = bdcode.trim();
return {
htmlInfo: successInfo && failedInfo ? successInfo + “<p><br /></p>” + failedInfo : successInfo + failedInfo,
failedCount,
bdcode,
successList
};
}
function getSelectedFileListLegacy() {
return unsafeWindow.require(“system-core:context/context.js”).instanceForSystem.list.getSelected();
}
function getSelectedFileListNew() {
return document.querySelector(“.nd-main-list”).__vue__.selectedList;
}
function convertData(data) {
var query = “”;
for (var key in data) query += “&” + key + “=” + encodeURIComponent(data[key]);
return query;
}
function parseClipboard() {
return __awaiter(this, void 0, void 0, (function() {
var bdlink, error_1;
return __generator(this, (function(_a) {
switch (_a.label) {
case 0:
_a.trys.push([ 0, 2, , 3 ]);
return [ 4, navigator.clipboard.readText() ];

case 1:
bdlink = _a.sent();
if (!DuParser.parse(bdlink).length) return [ 2, “” ];
return [ 2, bdlink ];

case 2:
error_1 = _a.sent();
showAlert(‘使用 “监听剪贴板” 功能需要允许剪贴板权限!’);
return [ 2, “” ];

case 3:
return [ 2 ];
}
}));
}));
}
var __assign = undefined && undefined.__assign || function() {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var swalBase_awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P((function(resolve) {
resolve(value);
}));
}
return new (P || (P = Promise))((function(resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator[“throw”](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
}));
};
var swalBase_generator = undefined && undefined.__generator || function(thisArg, body) {
var _ = {
label: 0,
sent: function() {
if (t[0] & 1) throw t[1];
return t[1];
},
trys: [],
ops: []
}, f, y, t, g;
return g = {
next: verb(0),
throw: verb(1),
return: verb(2)
}, typeof Symbol === “function” && (g[Symbol.iterator] = function() {
return this;
}), g;
function verb(n) {
return function(v) {
return step([ n, v ]);
};
}
function step(op) {
if (f) throw new TypeError(“Generator is already executing.”);
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y[“return”] : op[0] ? y[“throw”] || ((t = y[“return”]) && t.call(y),
0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [ op[0] & 2, t.value ];
switch (op[0]) {
case 0:
case 1:
t = op;
break;

case 4:
_.label++;
return {
value: op[1],
done: false
};

case 5:
_.label++;
y = op[1];
op = [ 0 ];
continue;

case 7:
op = _.ops.pop();
_.trys.pop();
continue;

default:
if (!(t = _.trys, t = t.length > 0 && t[t.length – 1]) && (op[0] === 6 || op[0] === 2)) {
_ = 0;
continue;
}
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
_.label = op[1];
break;
}
if (op[0] === 6 && _.label < t[1]) {
_.label = t[1];
t = op;
break;
}
if (t && _.label < t[2]) {
_.label = t[2];
_.ops.push(op);
break;
}
if (t[2]) _.ops.pop();
_.trys.pop();
continue;
}
op = body.call(thisArg, _);
} catch (e) {
op = [ 6, e ];
y = 0;
} finally {
f = t = 0;
}
if (op[0] & 5) throw op[1];
return {
value: op[0] ? op[1] : void 0,
done: true
};
}
};
var __spreadArray = undefined && undefined.__spreadArray || function(to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i];
return to;
};
var Swalbase = function() {
function Swalbase(rapiduploadTask, generatebdlinkTask) {
this.rapiduploadTask = rapiduploadTask;
this.generatebdlinkTask = generatebdlinkTask;
}
Swalbase.prototype.mergeArg = function() {
var inputArgs = [];
for (var _i = 0; _i < arguments.length; _i++) {
inputArgs[_i] = arguments[_i];
}
var output = {};
var swalCfgArgs = {
showClass: {
backdrop: “swal2-noanimation”
},
hideClass: {
backdrop: “swal2-noanimation”
}
};
$.extend.apply($, __spreadArray([ output, this.swalGlobalArgs, swalCfgArgs ], inputArgs));
return output;
};
Swalbase.prototype.inputView = function(bdlink) {
if (bdlink === void 0) {
bdlink = “”;
}
return swalBase_awaiter(this, void 0, void 0, (function() {
var rapidValue, pathValue, preConfirm, willOpen;
var _this = this;
return swalBase_generator(this, (function(_a) {
switch (_a.label) {
case 0:
rapidValue = bdlink;
console.log(GM_getValue(“listen-clipboard”));
if (!(GM_getValue(“listen-clipboard”) && !rapidValue)) return [ 3, 2 ];
return [ 4, parseClipboard() ];

case 1:
rapidValue = _a.sent();
_a.label = 2;

case 2:
pathValue = GM_getValue(“last_dir”) || “”;
preConfirm = function() {
rapidValue = $(“#mzf-rapid-input”)[0].value;
pathValue = $(“#mzf-path-input”)[0].value;
if (!rapidValue) {
Swal.showValidationMessage(“秒传不能为空”);
return false;
}
if (rapidValue === “set”) {
return;
}
if (rapidValue === “gen”) {
return;
}
if (!DuParser.parse(rapidValue).length) {
Swal.showValidationMessage(‘<p>未识别到正确的链接 <a href=”‘ + doc.linkTypeDoc + ‘” ‘ + linkStyle + “>查看支持格式</a></p>”);
return false;
}
if (pathValue.match(illegalPathPattern)) {
Swal.showValidationMessage(‘保存路径不能含有字符\”:*?<>|, 示例:/GTA5/’);
return false;
}
};
willOpen = function() {
$(“#swal2-html-container”).css(“font-size”, “1rem”).css(“display”, “grid”).css(“margin”, “0”);
$(“#mzf-rapid-input”)[0].value = rapidValue;
$(“#mzf-path-input”)[0].value = pathValue;
};
Swal.fire(this.mergeArg(SwalConfig.inputView, {
preConfirm,
willOpen
})).then((function(result) {
if (result.isConfirmed) {
if (rapidValue === “set”) _this.settingView(); else if (rapidValue === “gen”) _this.genView(); else {
_this.rapiduploadTask.reset();
_this.rapiduploadTask.fileInfoList = DuParser.parse(rapidValue);
GM_setValue(“last_dir”, pathValue);
if (!pathValue) {
_this.rapiduploadTask.isDefaultPath = true;
var nowPath = location.href.match(/path=(.+?)(?:&|$)/);
if (nowPath) pathValue = decodeURIComponent(nowPath[1]); else pathValue = “/”;
}
if (pathValue.charAt(pathValue.length – 1) !== “/”) pathValue += “/”;
console.log(“秒传文件保存到: ” + pathValue);
_this.rapiduploadTask.savePath = pathValue;
_this.processView(false);
}
}
}));
return [ 2 ];
}
}));
}));
};
Swalbase.prototype.processView = function(isGen) {
var _this = this;
var swalArg = {
title: isGen ? “秒传生成中” : “文件” + (this.rapiduploadTask.checkMode ? “测试” : “提取”) + “中”,
html: isGen ? “<p>正在生成第 <file_num>0</file_num> 个</p><p><gen_prog>正在获取文件列表…</gen_prog></p>” : “正在” + (this.rapiduploadTask.checkMode ? “测试” : “转存”) + “第 <file_num>0</file_num> 个”,
willOpen: function() {
Swal.showLoading();
isGen || _this.saveFileWork();
}
};
Swal.fire(this.mergeArg(SwalConfig.processView, swalArg));
};
Swalbase.prototype.finishView = function(isGen) {
var _this = this;
var action = isGen ? “生成” : this.rapiduploadTask.checkMode ? “测试” : “转存”;
var fileInfoList = isGen ? this.generatebdlinkTask.fileInfoList : this.rapiduploadTask.fileInfoList;
var parseResult = parsefileInfo(fileInfoList);
if (isGen) this.rapiduploadTask.fileInfoList = parseResult.successList;
var checkboxArg = parseResult.failedCount === fileInfoList.length ? {} : {
input: “checkbox”,
inputValue: GM_getValue(“with_path”),
inputPlaceholder: “导出文件夹目录结构”
};
var html = (isGen ? (parseResult.failedCount === fileInfoList.length ? “” : htmlCheckMd5) + htmlDocument : “”) + (parseResult.htmlInfo && isGen ? “<p><br></p>” : “”) + parseResult.htmlInfo;
var htmlFooter = “”;
if (!GM_getValue(donateVer + “_kill_donate”)) htmlFooter += htmlDonate;
if (!GM_getValue(feedbackVer + “_kill_donate”)) htmlFooter += htmlFeedback;
if (htmlFooter) htmlFooter = “<p><br></p>” + htmlFooter;
var swalArg = __assign(__assign({
title: action + “完毕 共” + fileInfoList.length + “个, 失败” + parseResult.failedCount + “个!”,
confirmButtonText: parseResult.failedCount !== fileInfoList.length && (isGen || this.rapiduploadTask.checkMode) ? “复制秒传代码” : “确认”,
html: html + htmlFooter
}, (isGen || this.rapiduploadTask.checkMode) && checkboxArg), {
willOpen: function() {
if (!isGen && !_this.rapiduploadTask.checkMode) _this.addOpenDirBtn();
}
});
Swal.fire(this.mergeArg(SwalConfig.finishView, swalArg)).then((function(result) {
if (result.isConfirmed) {
if (isGen || _this.rapiduploadTask.checkMode) {
GM_setValue(“with_path”, result.value);
if (!result.value) GM_setClipboard(parseResult.bdcode.replace(//.+//g, “”)); else GM_setClipboard(parseResult.bdcode);
GM_deleteValue(“unfinish”);
} else {
refreshList();
}
}
}));
};
Swalbase.prototype.checkRecursive = function() {
var _this = this;
Swal.fire(this.mergeArg(SwalConfig.checkRecursive)).then((function(result) {
if (result.isConfirmed) {
_this.generatebdlinkTask.recursive = true;
} else if (result.dismiss === Swal.DismissReason.cancel) _this.generatebdlinkTask.recursive = false; else return;
_this.processView(true);
_this.generatebdlinkTask.scanFile(0);
}));
};
Swalbase.prototype.settingView = function() {
var _this = this;
var willOpen = function() {
$(“#swal2-html-container”).css(“font-size”, “1rem”).css(“display”, “grid”).css(“margin”, “0”);
$(“#mzf-theme”)[0].value = GM_getValue(“swalThemes”) || “Default”;
$(“#mzf-listen-clipboard”)[0].checked = Boolean(GM_getValue(“listen-clipboard”));
};
var preConfirm = function() {
return swalBase_awaiter(_this, void 0, void 0, (function() {
var error_1;
return swalBase_generator(this, (function(_a) {
switch (_a.label) {
case 0:
GM_setValue(“swalThemes”, $(“#mzf-theme”)[0].value);
if (!$(“#mzf-listen-clipboard”)[0].checked) return [ 3, 4 ];
_a.label = 1;

case 1:
_a.trys.push([ 1, 3, , 4 ]);
return [ 4, navigator.clipboard.readText() ];

case 2:
_a.sent();
return [ 3, 4 ];

case 3:
error_1 = _a.sent();
showAlert(‘开启 “监听剪贴板” 功能需要允许剪贴板权限!’);
return [ 2 ];

case 4:
GM_setValue(“listen-clipboard”, $(“#mzf-listen-clipboard”)[0].checked);
return [ 2 ];
}
}));
}));
};
Swal.fire(this.mergeArg(SwalConfig.settingView, {
willOpen,
preConfirm
})).then((function(result) {
if (result.isConfirmed) Swal.fire(_this.mergeArg(SwalConfig.settingWarning));
}));
};
Swalbase.prototype.genView = function() {
var _this = this;
Swal.fire(this.mergeArg(SwalConfig.genView)).then((function(result) {
if (result.isConfirmed) {
_this.generatebdlinkTask.reset();
result.value.split(“n”).forEach((function(item) {
if (item.charAt(0) !== “/”) item = “/” + item;
_this.generatebdlinkTask.fileInfoList.push({
path: item
});
}));
_this.processView(true);
_this.genFileWork(false, true);
_this.generatebdlinkTask.generateBdlink(0);
}
}));
};
Swalbase.prototype.genUnfinishi = function(onConfirm, onCancel) {
Swal.fire(this.mergeArg(SwalConfig.genUnfinish)).then((function(result) {
if (result.isConfirmed) onConfirm(); else if (result.dismiss === Swal.DismissReason.cancel) onCancel();
}));
};
Swalbase.prototype.checkMd5Warning = function(onConfirm, onCancel) {
Swal.fire(this.mergeArg(SwalConfig.checkMd5Warning)).then((function(result) {
if (result.isConfirmed) {
GM_setValue(“check_md5_warning”, result.value);
onConfirm();
} else if (result.dismiss === Swal.DismissReason.cancel) onCancel();
}));
};
Swalbase.prototype.selectNoFileWarning = function() {
Swal.fire(this.mergeArg(SwalConfig.selectNoFileWarning));
};
Swalbase.prototype.updateInfo = function(onConfirm) {
Swal.fire(this.mergeArg(SwalConfig.updateInfo)).then((function(result) {
if (result.isConfirmed) onConfirm();
}));
};
Swalbase.prototype.saveFileWork = function() {
var _this = this;
this.rapiduploadTask.onFinish = function() {
_this.finishView(false);
};
this.rapiduploadTask.onProcess = function(i, fileInfoList) {
Swal.getHtmlContainer().querySelector(“file_num”).textContent = i + 1 + ” / ” + fileInfoList.length;
};
this.rapiduploadTask.start();
};
Swalbase.prototype.genFileWork = function(isUnfinish, isGenView) {
var _this = this;
if (!isGenView) this.generatebdlinkTask.selectList = getSelectedFileList();
if (!this.generatebdlinkTask.selectList.length) {
this.selectNoFileWarning();
return;
}
this.generatebdlinkTask.onProcess = function(i, fileInfoList) {
Swal.getHtmlContainer().querySelector(“file_num”).textContent = i + 1 + ” / ” + fileInfoList.length;
Swal.getHtmlContainer().querySelector(“gen_prog”).textContent = “0%”;
};
this.generatebdlinkTask.onProgress = function(e) {
if (typeof e.total !== “number”) return;
Swal.getHtmlContainer().querySelector(“gen_prog”).textContent = (e.loaded / e.total * 100).toFixed() + “%”;
};
this.generatebdlinkTask.onHasNoDir = function() {
_this.processView(true);
_this.generatebdlinkTask.generateBdlink(0);
};
this.generatebdlinkTask.onHasDir = function() {
_this.checkRecursive();
};
this.generatebdlinkTask.onFinish = function() {
_this.finishView(true);
};
if (!isUnfinish && !isGenView) this.generatebdlinkTask.start();
};
Swalbase.prototype.checkUnfinish = function() {
var _this = this;
if (GM_getValue(“unfinish”)) {
this.genUnfinishi((function() {
_this.processView(true);
_this.genFileWork(true, false);
var unfinishInfo = GM_getValue(“unfinish”);
_this.generatebdlinkTask.fileInfoList = unfinishInfo.file_info_list;
_this.generatebdlinkTask.generateBdlink(unfinishInfo.file_id);
}), (function() {
GM_deleteValue(“unfinish”);
_this.genFileWork(false, false);
}));
} else {
this.genFileWork(false, false);
}
};
Swalbase.prototype.checkMd5 = function() {
var _this = this;
this.rapiduploadTask.checkMode = true;
if (!GM_getValue(“check_md5_warning”)) {
this.checkMd5Warning((function() {
_this.processView(false);
}), (function() {
_this.finishView(true);
}));
} else this.processView(false);
};
Swalbase.prototype.addOpenDirBtn = function() {
if (!this.rapiduploadTask.isDefaultPath) {
var _dir_1 = (this.rapiduploadTask.savePath || “”).replace(//$/, “”);
if (_dir_1.charAt(0) !== “/”) _dir_1 = “/” + _dir_1;
var cBtn = Swal.getConfirmButton();
var btn = cBtn.cloneNode();
btn.textContent = “打开目录”;
btn.style.backgroundColor = “#ecae3c”;
btn.data-filter = function() {
var path = location.href.match(/(path=(.+?))(?:&|$)/);
if (path) {
if (path[2] !== encodeURIComponent(_dir_1)) location.href = location.href.replace(path[1], “path=” + encodeURIComponent(_dir_1)); else refreshList();
} else {
var connectChar = location.href.indexOf(“?”) === -1 ? “?” : “&”;
location.href += connectChar + “path=” + encodeURIComponent(_dir_1);
}
Swal.close();
};
cBtn.before(btn);
}
};
return Swalbase;
}();
const swalBase = Swalbase;
var ajax_assign = undefined && undefined.__assign || function() {
ajax_assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return ajax_assign.apply(this, arguments);
};
function ajax(config, callback, failback) {
GM_xmlhttpRequest(ajax_assign(ajax_assign({}, config), {
data-filter: function(r) {
if (Math.floor(r.status / 100) === 2) callback(r); else failback(r.status);
},
data-filter: function() {
failback(ajaxError);
}
}));
}
var GeneratebdlinkTask = function() {
function GeneratebdlinkTask() {}
GeneratebdlinkTask.prototype.reset = function() {
this.recursive = false;
this.dirList = [];
this.selectList = [];
this.fileInfoList = [];
this.onFinish = function() {};
this.onProcess = function() {};
this.onProgress = function() {};
this.onHasDir = function() {};
this.onHasNoDir = function() {};
};
GeneratebdlinkTask.prototype.start = function() {
var _this = this;
this.selectList.forEach((function(item) {
if (item.isdir) _this.dirList.push(item.path); else {
_this.fileInfoList.push({
path: item.path,
size: item.size
});
}
}));
if (this.dirList.length) this.onHasDir(); else this.onHasNoDir();
};
GeneratebdlinkTask.prototype.scanFile = function(i) {
var _this = this;
if (i >= this.dirList.length) {
this.generateBdlink(0);
return;
}
ajax({
url: list_url + “&path=” + encodeURIComponent(this.dirList[i]) + “&recursion=” + (this.recursive ? 1 : 0),
method: “GET”,
responseType: “json”
}, (function(data) {
data = data.response;
if (!data.errno) {
data.list.forEach((function(item) {
item.isdir || _this.fileInfoList.push({
path: item.path
});
}));
} else _this.fileInfoList.push({
path: _this.dirList[i],
errno: data.errno
});
_this.scanFile(i + 1);
}), (function(statusCode) {
_this.fileInfoList.push({
path: _this.dirList[i],
errno: statusCode === 500 ? 901 : statusCode
});
_this.scanFile(i + 1);
}));
};
GeneratebdlinkTask.prototype.generateBdlink = function(i) {
GM_setValue(“unfinish”, {
file_info_list: this.fileInfoList,
file_id: i
});
if (i >= this.fileInfoList.length) {
this.onFinish(this.fileInfoList);
return;
}
this.onProcess(i, this.fileInfoList);
var file = this.fileInfoList[i];
if (file.errno) {
this.generateBdlink(i + 1);
return;
}
this.getFileInfo(i);
};
GeneratebdlinkTask.prototype.getFileInfo = function(i) {
var _this = this;
var file = this.fileInfoList[i];
ajax({
url: meta_url + encodeURIComponent(file.path),
responseType: “json”,
method: “GET”
}, (function(data) {
data = data.response;
if (!data.errno) {
console.log(data.list[0]);
if (data.list[0].isdir) {
file.errno = 900;
_this.generateBdlink(i + 1);
return;
}
file.size = data.list[0].size;
file.fs_id = data.list[0].fs_id;
if (data.list[0].block_list.length === 1) file.md5 = data.list[0].block_list[0].toLowerCase();
_this.getDlink(i);
} else {
file.errno = data.errno;
_this.generateBdlink(i + 1);
}
}), (function(statusCode) {
file.errno = statusCode === 404 ? 909 : statusCode;
_this.generateBdlink(i + 1);
}));
};
GeneratebdlinkTask.prototype.getDlink = function(i) {
var _this = this;
var file = this.fileInfoList[i];
ajax({
url: meta_url2 + JSON.stringify([ file.fs_id ]),
responseType: “json”,
method: “GET”
}, (function(data) {
data = data.response;
if (!data.errno) {
console.log(data.list[0]);
_this.downloadFileData(i, data.list[0].dlink);
} else {
file.errno = data.errno;
_this.generateBdlink(i + 1);
}
}), (function(statusCode) {
file.errno = statusCode;
_this.generateBdlink(i + 1);
}));
};
GeneratebdlinkTask.prototype.downloadFileData = function(i, dlink) {
var _this = this;
var file = this.fileInfoList[i];
var dlSize = file.size < 262144 ? file.size – 1 : 262143;
ajax({
url: dlink,
method: “GET”,
responseType: “arraybuffer”,
headers: {
Range: “bytes=0-” + dlSize,
“User-Agent”: UA
},
onprogress: this.onProgress
}, (function(data) {
_this.onProgress({
loaded: 100,
total: 100
});
_this.parseDownloadData(i, data);
}), (function(statusCode) {
if (statusCode === 404) file.errno = 909; else file.errno = statusCode;
_this.generateBdlink(i + 1);
}));
};
GeneratebdlinkTask.prototype.parseDownloadData = function(i, data) {
var _this = this;
console.log(“dl_url: ” + data.finalUrl);
var file = this.fileInfoList[i];
if (data.finalUrl.indexOf(“issuecdn.baidupcs.com”) !== -1) {
file.errno = 1919;
this.generateBdlink(i + 1);
return;
} else {
var fileMd5 = data.responseHeaders.match(/content-md5: ([da-f]{32})/i);
if (fileMd5) file.md5 = fileMd5[1].toLowerCase(); else if (!file.md5 && file.size <= 39e8 && !file.retry_996) {
file.retry_996 = true;
this.downloadFileData(i, pcs_url + (“&path=” + encodeURIComponent(file.path)));
return;
} else if (!file.md5) {
file.errno = 996;
this.generateBdlink(i + 1);
return;
}
var spark = new SparkMD5.ArrayBuffer;
spark.append(data.response);
var sliceMd5 = spark.end();
file.md5s = sliceMd5;
var interval = this.fileInfoList.length > 1 ? 2e3 : 1e3;
setTimeout((function() {
_this.generateBdlink(i + 1);
}), interval);
}
};
return GeneratebdlinkTask;
}();
const common_GeneratebdlinkTask = GeneratebdlinkTask;
var RapiduploadTask = function() {
function RapiduploadTask() {}
RapiduploadTask.prototype.reset = function() {
this.bdstoken = getBdstoken();
console.log(“bdstoken: “, this.bdstoken);
this.fileInfoList = [];
this.savePath = “”;
this.checkMode = false;
this.isDefaultPath = false;
this.onFinish = function() {};
this.onProcess = function() {};
};
RapiduploadTask.prototype.start = function() {
if (this.checkMode) this.savePath = “”;
this.saveFile(0, 0);
};
RapiduploadTask.prototype.saveFile = function(i, tryFlag) {
var _this = this;
if (i >= this.fileInfoList.length) {
this.onFinish(this.fileInfoList);
return;
}
this.onProcess(i, this.fileInfoList);
var file = this.fileInfoList[i];
if (file.path.match(/[“\:*?<>|]/) || file.path === “/”) {
file.errno = 2333;
this.saveFile(i + 1, 0);
return;
}
if (!file.md5s || file.size > 21474836480) {
file.md5 = file.md5.toLowerCase();
this.saveFileV2(i);
return;
}
switch (tryFlag) {
case 0:
console.log(“use UpperCase md5”);
file.md5 = file.md5.toUpperCase();
break;

case 1:
console.log(“use LowerCase md5”);
file.md5 = file.md5.toLowerCase();
break;

case 2:
console.log(“use randomCase md5”);
file.md5 = randomStringTransform(file.md5);
break;

case 3:
console.log(“use saveFile v2”);
file.md5 = file.md5.toLowerCase();
this.saveFileV2(i);
return;

default:
this.saveFile(i + 1, 0);
return;
}
ajax({
url: “” + rapid_url + (this.bdstoken && “?bdstoken=” + this.bdstoken),
method: “POST”,
responseType: “json”,
data: convertData({
rtype: this.checkMode ? 3 : 0,
path: this.savePath + file.path,
“content-md5”: file.md5,
“slice-md5”: file.md5s.toLowerCase(),
“content-length”: file.size
})
}, (function(data) {
data = data.response;
if (data.errno === 404) _this.saveFile(i, tryFlag + 1); else {
file.errno = data.errno;
_this.saveFile(i + 1, 0);
}
}), (function(statusCode) {
file.errno = statusCode;
_this.saveFile(i + 1, 0);
}));
};
RapiduploadTask.prototype.saveFileV2 = function(i) {
var _this = this;
var file = this.fileInfoList[i];
ajax({
url: “” + create_url + (this.bdstoken && “&bdstoken=” + this.bdstoken),
method: “POST”,
responseType: “json”,
data: convertData({
block_list: JSON.stringify([ file.md5 ]),
path: this.savePath + file.path,
size: file.size,
isdir: 0,
rtype: this.checkMode ? 3 : 0
})
}, (function(data) {
data = data.response;
file.errno = data.errno === 2 ? 404 : data.errno;
_this.saveFile(i + 1, 0);
}), (function(statusCode) {
file.errno = statusCode;
_this.saveFile(i + 1, 0);
}));
};
return RapiduploadTask;
}();
const common_RapiduploadTask = RapiduploadTask;
var host = location.host;
var rapid_url = “https://” + host + “/api/rapidupload”;
var create_url = “https://” + host + “/rest/2.0/xpan/file?method=create”;
var list_url = “https://” + host + “/rest/2.0/xpan/multimedia?method=listall&order=name&limit=10000”;
var meta_url = “https://” + host + “/rest/2.0/xpan/file?app_id=778750&method=meta&path=”;
var meta_url2 = “https://” + host + “/rest/2.0/xpan/multimedia?method=filemetas&dlink=1&fsids=”;
var pcs_url = “https://pcs.baidu.com/rest/2.0/pcs/file?app_id=778750&method=download”;
var UA = “netdisk;2.2.51.6;netdisk;10.0.63;PC;android-android;QTP/1.0.32.2″;
var illegalPathPattern = /[\”:*?<>|]/;
var getBdstoken;
function setGetBdstoken(func) {
getBdstoken = func;
}
var refreshList;
function setRefreshList(func) {
refreshList = func;
}
var getSelectedFileList;
function setGetSelectedFileList(func) {
getSelectedFileList = func;
}
var swalInstance = new swalBase(new common_RapiduploadTask, new common_GeneratebdlinkTask);
var htmlTagNew = “div.nd-file-list-toolbar__actions”;
var htmlTaglegacy = “div.tcuLAu”;
var htmlTag2legacy = “form.h5-uploader-form”;
var htmlBtnRapidNew = ‘<button id=”bdlink_btn” style=”margin-left: 8px;” class=”mzf_new_btn”></i><span>秒传</span></button>’;
var htmlBtnGenNew = ‘<button id=”gen_bdlink_btn” style=”margin-left: 8px;” class=”mzf_new_btn”></i><span>生成秒传</span></button>’;
var htmlBtnRapidLegacy = ‘<a class=”g-button g-button-blue” id=”bdlink_btn” title=”秒传链接” style=”display: inline-block;””><span class=”g-button-right”><em class=”icon icon-disk” title=”秒传链接提取”></em><span class=”text” style=”width: auto;”>秒传链接</span></span></a>’;
var htmlBtnGenLegacy = ‘<a class=”g-button” id=”gen_bdlink_btn”><span class=”g-button-right”><em class=”icon icon-share”></em><span class=”text” style=”width: auto;”>生成秒传</span></span></a>’;
function baiduErrno(errno) {
switch (errno) {
case -6:
return “认证失败(尝试刷新页面)”;

case -7:
return “秒传链接内的文件名/转存路径 包含非法字符, 请尝试更改”;

case -8:
return “路径下存在同名文件”;

case 400:
return “请求错误(尝试使用最新版Chrome浏览器/更新油猴插件)”;

case 403:
return ‘接口限制访问(请参考<a href=”‘ + doc.shareDoc + ‘” ‘ + linkStyle + “>分享教程</a>)”;

case 31190:
case 404:
return ‘秒传未生效(请参考<a href=”‘ + doc.shareDoc + ‘” ‘ + linkStyle + “>分享教程</a>)”;

case 2:
return “转存失败(尝试重新登录度盘账号/更换或重装浏览器)”;

case 2333:
return ‘秒传链接内的文件名错误, 不能含有字符\”:*?<>|, 且不能是”/”(空文件名)’;

case -10:
return “网盘容量已满”;

case 514:
return “请求失败(若弹出跨域提示,请选择允许/尝试关闭网络代理/更换浏览器)”;

case 1919:
return ‘文件已被和谐(请参考<a href=”‘ + doc.shareDoc + ‘” ‘ + linkStyle + “>分享教程</a>)”;

case 996:
return ‘md5获取失败(请参考<a href=”‘ + doc.shareDoc + ‘” ‘ + linkStyle + “>分享教程</a>)”;

case 500:
case 502:
case 503:
return ‘服务器错误(请参考<a href=”‘ + doc.shareDoc + ‘” ‘ + linkStyle + “>分享教程</a>)”;

case 909:
return “路径不存在”;

case 900:
return “路径为文件夹, 不支持生成秒传”;

case 901:
return “包含的文件数量超出限制(1w个)”;

default:
return “未知错误”;
}
}
function installNew() {
console.info(“%s DOM方式安装,若失效请报告。”, TAG);
$(htmlTagNew).append(htmlBtnRapidNew, htmlBtnGenNew);
$(document).on(“click”, “#bdlink_btn”, (function() {
swalInstance.inputView();
}));
$(document).on(“click”, “#gen_bdlink_btn”, (function() {
swalInstance.generatebdlinkTask.reset();
swalInstance.checkUnfinish();
}));
}
function getSystemContext() {
return unsafeWindow.require(“system-core:context/context.js”).instanceForSystem;
}
function addGenBtn() {
var listTools = getSystemContext().Broker.getButtonBroker(“listTools”);
if (listTools && listTools.$box) $(listTools.$box).children(“div”).after(htmlBtnGenLegacy); else setTimeout(addGenBtn, 300);
}
function addBtn() {
if ($(htmlTaglegacy).length) $(htmlTaglegacy).append(htmlBtnRapidLegacy); else setTimeout(addBtn, 100);
}
function installlegacy() {
console.info(“%s DOM方式安装,若失效请报告。”, TAG);
addBtn();
addGenBtn();
$(document).on(“click”, “#bdlink_btn”, (function() {
swalInstance.inputView();
}));
$(document).on(“click”, “#gen_bdlink_btn”, (function() {
swalInstance.generatebdlinkTask.reset();
swalInstance.checkUnfinish();
}));
}
function loaderBaidu() {
jQuery((function() {
if (locUrl.indexOf(baiduNewPage) !== -1) {
swalInstance.swalGlobalArgs = {
heightAuto: false,
scrollbarPadding: false
};
setRefreshList((function() {
document.querySelector(“.nd-main-list”).__vue__.reloadList();
}));
setGetSelectedFileList(getSelectedFileListNew);
setGetBdstoken((function() {
return document.querySelector(“.nd-main-list”).__vue__.yunData.bdstoken;
}));
installNew();
} else {
setRefreshList((function() {
unsafeWindow.require(“system-core:system/baseService/message/message.js”).trigger(“system-refresh”);
}));
setGetSelectedFileList(getSelectedFileListLegacy);
setGetBdstoken((function() {
return unsafeWindow.locals.get(“bdstoken”);
}));
installlegacy();
}
var bdlink = initQueryLink();
if (bdlink) {
swalInstance.inputView(bdlink);
} else if (!GM_getValue(updateInfoVer + “_no_first”)) swalInstance.updateInfo((function() {
GM_setValue(updateInfoVer + “_no_first”, true);
}));
$(document).on(“click”, “#kill_donate”, (function() {
GM_setValue(feedbackVer + “_kill_donate”, true);
$(“#mzf_donate”).remove();
}));
$(document).on(“click”, “#kill_feedback”, (function() {
GM_setValue(donateVer + “_kill_feedback”, true);
$(“#mzf_feedback”).remove();
}));
$(document).on(“click”, “#check_md5_btn”, (function() {
swalInstance.checkMd5();
}));
}));
}
var checkBox = __webpack_require__(197);
var checkBox_default = __webpack_require__.n(checkBox);
var app = __webpack_require__(119);
var app_default = __webpack_require__.n(app);
function injectStyle() {
GM_addStyle(app_default());
GM_addStyle(checkBox_default());
var swalThemes = GM_getValue(“swalThemes”) || “Default”;
var defaultThemesCss = GM_getResourceText(“swalCss”) || GM_getResourceText(“swalCssBak”);
if (swalThemes === “Default”) {
if (defaultThemesCss) {
GM_addStyle(defaultThemesCss);
} else {
getThemesCss(swalThemes);
}
return;
}
var ThemesCss = GM_getValue(“” + swalCssVer + swalThemes);
if (ThemesCss) {
GM_addStyle(ThemesCss);
} else {
getThemesCss(swalThemes);
}
return;
}
function getThemesCss(swalThemes) {
ajax({
url: extCssUrl[swalThemes],
method: “GET”
}, (function(data) {
var ThemesCss = data.responseText;
if (ThemesCss.length < 100) {
showAlert(appError.SwalCssInvalid + (“n错误数据:” + swalThemes + ” InvalidCss:n” + ThemesCss));
return;
}
GM_setValue(“” + swalCssVer + swalThemes, ThemesCss);
GM_addStyle(ThemesCss);
}), (function(statusCode) {
showAlert(appError.SwalCssErrReq + (“#” + statusCode));
}));
}
function app_app() {
if ([ typeof Base64, typeof $, typeof SparkMD5, typeof Swal ].indexOf(“undefined”) !== -1) showAlert(appError.missDepend); else {
Base64.extendString();
injectStyle();
loaderBaidu();
}
}
try {
app_app();
} catch (error) {
console.log(error);
}
})();
})();

到这上那一行就行,不用管提醒,能跑就行

嫌麻烦直接去这里(https://greasyfork.org/zh-CN)搜索    秒传链接提取    也行


DMCAWordPressThemeContact Us
Copyright © 2024 CYWACG. All Rights Reserved.