|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 蓝奏云网盘增强 |
3 | | -// @version 1.3.9 |
| 3 | +// @version 1.4.0 |
4 | 4 | // @author X.I.U |
5 | | -// @description 刷新不回根目录、后退返回上一级、右键文件显示菜单、点击直接下载文件、点击空白进入目录、自动显示更多文件、自定义分享链接域名、自动打开/复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、调整描述(话说)编辑框初始大小 |
| 5 | +// @description 刷新不回根目录、后退返回上一级、右键文件显示菜单、点击直接下载文件、点击空白进入目录、自动显示更多文件、一键复制所有分享链接、自定义分享链接域名、自动打开/复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、调整描述(话说)编辑框初始大小 |
6 | 6 | // @include /^https:\/\/.+\.lanzou[a-z]\.com\/.*$/ |
7 | 7 | // @match *://pan.lanzou.com/* |
8 | 8 | // @match *://lanzou.com/u |
|
131 | 131 |
|
132 | 132 | dragEnter(); // 拖入文件自动显示上传框 |
133 | 133 | setTimeout(viewTop,1000); // 监听并修改右键菜单 [外链分享地址] 为 [复制并打开分享链接] / [复制分享链接] / [打开分享链接] 之一 |
| 134 | + setTimeout(copyAllfileSha, 500); // 一键复制所有分享链接 |
134 | 135 | } |
135 | 136 | } |
136 | 137 |
|
|
345 | 346 | } |
346 | 347 |
|
347 | 348 |
|
| 349 | + // 一键复制所有分享链接 |
| 350 | + function copyAllfileSha() { |
| 351 | + var f_data = '', tmep_data = []; |
| 352 | + let f_tp = mainframe.document.getElementById('f_tp'); |
| 353 | + //console.log(f_tp, mainframe.document.location.href) |
| 354 | + f_tp.insertAdjacentHTML('afterend', `<a id="f_copyAll" class="f_sela" style="float: right; width: auto; font-size: 12px !important; font: inherit; padding: 2px 10px; margin-top: -25px;" title="获取所有分享链接需要一些时间(取决于有多少文件)。 因为分享链接没有显示在网页上,需要通过网页接口获取,因此为了避免太频繁被限制,所以设置了 300ms 间隔时间!">一键复制所有分享链接</a>`); |
| 355 | + mainframe.document.getElementById('f_copyAll').onclick = function() { |
| 356 | + f_data = ''; tmep_data = []; |
| 357 | + mainframe.document.querySelectorAll('.f_tb').forEach(function (_this) { |
| 358 | + //console.log(_this, _this.id.indexOf('fol') > -1) |
| 359 | + if (_this.id.indexOf('fol') > -1) { |
| 360 | + //console.log(`task=18&folder_id=${_this.id.replace('fol','')}`) |
| 361 | + tmep_data.push([`${_this.querySelector('span[id^="folname"]').textContent}`, `task=18&folder_id=${_this.id.replace('fol','')}`]) |
| 362 | + } else { |
| 363 | + //console.log(`task=22&file_id=${_this.id.replace('f','')}`) |
| 364 | + tmep_data.push([`${_this.querySelector('span[id^="filename"]').textContent}`, `task=22&file_id=${_this.id.replace('f','')}`]) |
| 365 | + } |
| 366 | + }) |
| 367 | + //console.log(tmep_data) |
| 368 | + if (tmep_data.length > 0) { |
| 369 | + getUrl(0); |
| 370 | + GM_notification({text: '获取所有分享链接需要一些时间(取决于有多少文件),在此期间请不要关闭网页!', timeout: 5000}); |
| 371 | + } |
| 372 | + }; |
| 373 | + |
| 374 | + |
| 375 | + function getUrl(i) { |
| 376 | + //console.log(i) |
| 377 | + GM_xmlhttpRequest({ |
| 378 | + url: 'https://pc.woozooo.com/doupload.php', |
| 379 | + method: 'POST', |
| 380 | + data: tmep_data[i][1], |
| 381 | + responseType: 'json', |
| 382 | + overrideMimeType: 'application/json; charset=utf-8', |
| 383 | + headers: { |
| 384 | + 'Referer': mainframe.document.location.href, |
| 385 | + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' |
| 386 | + }, |
| 387 | + timeout: 5000, |
| 388 | + onload: function (response) { |
| 389 | + try { |
| 390 | + //console.log('返回内容:',response.response) |
| 391 | + if (response.response && response.response.zt === 1) { |
| 392 | + //console.log(response.response) |
| 393 | + if (response.response.info.f_id) { |
| 394 | + //console.log('文件 1',f_data) |
| 395 | + f_data += `${tmep_data[i][0]} ` |
| 396 | + if (menu_value('menu_customFileSha')) { |
| 397 | + f_data += `https://${menu_value('menu_customFileSha')}/${response.response.info.f_id} ` |
| 398 | + } else { |
| 399 | + f_data += `${response.response.info.is_newd}/${response.response.info.f_id} ` |
| 400 | + } |
| 401 | + if (response.response.info.onof == '1') f_data += `密码:${response.response.info.pwd}` |
| 402 | + f_data += `\n` |
| 403 | + //console.log('文件 2',f_data) |
| 404 | + } else { |
| 405 | + //console.log('目录 1',f_data) |
| 406 | + f_data += `${response.response.info.name} ` |
| 407 | + if (menu_value('menu_customFileSha')) { |
| 408 | + f_data += `${response.response.info.new_url.replace(/\/\/.+\//i, '//' + menu_value('menu_customFileSha') + '/')} ` |
| 409 | + } else { |
| 410 | + f_data += `${response.response.info.new_url} ` |
| 411 | + } |
| 412 | + if (response.response.info.onof == '1') f_data += `密码:${response.response.info.pwd}` |
| 413 | + f_data += `\n` |
| 414 | + //console.log('目录 2',f_data) |
| 415 | + } |
| 416 | + if (++i < tmep_data.length) { |
| 417 | + setTimeout(function(){getUrl(i);}, 300); |
| 418 | + } else { |
| 419 | + console.log(f_data) |
| 420 | + GM_setClipboard(f_data, 'text'); |
| 421 | + GM_notification({text: '✅ 已复制所有文件/目录的分享链接到剪切板~', timeout: 2000}); |
| 422 | + } |
| 423 | + } else { |
| 424 | + GM_notification({text: '❌ 更新失败,请联系作者解决...', timeout: 5000}); |
| 425 | + } |
| 426 | + } catch (e) { |
| 427 | + console.log(e); |
| 428 | + } |
| 429 | + } |
| 430 | + }) |
| 431 | + } |
| 432 | + } |
| 433 | + |
348 | 434 | // 分享链接相关(点击文件时) |
349 | 435 | function fileSha() { |
350 | 436 | var f_sha = mainframe.document.getElementById('f_sha'); // 寻找分享链接(下载链接)信息框 |
|
0 commit comments