| 409 | |
| 410 | // 一键复制所有分享链接 |
| 411 | function copyAllfileSha() { |
| 412 | var f_data = '', tmep_data = []; |
| 413 | let f_tp = mainframe.document.getElementById('f_tp'); |
| 414 | //console.log(f_tp, mainframe.document.location.href) |
| 415 | 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>`); |
| 416 | mainframe.document.getElementById('f_copyAll').onclick = function() { |
| 417 | f_data = ''; tmep_data = []; |
| 418 | mainframe.document.querySelectorAll('.f_tb').forEach(function (_this) { |
| 419 | //console.log(_this, _this.id.indexOf('fol') > -1) |
| 420 | if (_this.id.indexOf('fol') > -1) { |
| 421 | //console.log(`task=18&folder_id=${_this.id.replace('fol','')}`) |
| 422 | tmep_data.push([`${_this.querySelector('span[id^="folname"]').textContent}`, `task=18&folder_id=${_this.id.replace('fol','')}`]) |
| 423 | } else { |
| 424 | //console.log(`task=22&file_id=${_this.id.replace('f','')}`) |
| 425 | tmep_data.push([`${_this.querySelector('span[id^="filename"]').textContent}`, `task=22&file_id=${_this.id.replace('f','')}`]) |
| 426 | } |
| 427 | }) |
| 428 | //console.log(tmep_data) |
| 429 | if (tmep_data.length > 0) { |
| 430 | getUrl(0); |
| 431 | GM_notification({text: '获取所有分享链接需要一些时间(取决于有多少文件),在此期间请不要关闭网页!', timeout: 5000}); |
| 432 | } |
| 433 | }; |
| 434 | |
| 435 | |
| 436 | function getUrl(i) { |
| 437 | //console.log(i) |
| 438 | GM_xmlhttpRequest({ |
| 439 | url: 'https://pc.woozooo.com/doupload.php', |
| 440 | method: 'POST', |
| 441 | data: tmep_data[i][1], |
| 442 | responseType: 'json', |
| 443 | overrideMimeType: 'application/json; charset=utf-8', |
| 444 | headers: { |
| 445 | 'Referer': mainframe.document.location.href, |
| 446 | 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' |
| 447 | }, |
| 448 | timeout: 5000, |
| 449 | onload: function (response) { |
| 450 | try { |
| 451 | //console.log('返回内容:',response.response) |
| 452 | if (response.response && response.response.zt === 1) { |
| 453 | //console.log(response.response) |
| 454 | if (response.response.info.f_id) { |
| 455 | //console.log('文件 1',f_data) |
| 456 | f_data += `${tmep_data[i][0]} ` |
| 457 | if (menu_value('menu_customFileSha')) { |
| 458 | f_data += `https://${menu_value('menu_customFileSha')}/${response.response.info.f_id} ` |
| 459 | } else { |
| 460 | f_data += `${response.response.info.is_newd}/${response.response.info.f_id} ` |
| 461 | } |
| 462 | if (response.response.info.onof == '1') f_data += `密码:${response.response.info.pwd}` |
| 463 | f_data += `\n` |
| 464 | //console.log('文件 2',f_data) |
| 465 | } else { |
| 466 | //console.log('目录 1',f_data) |
| 467 | f_data += `${response.response.info.name} ` |
| 468 | if (menu_value('menu_customFileSha')) { |