|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 蓝奏云网盘增强 |
3 | | -// @version 1.3.4 |
| 3 | +// @version 1.3.5 |
4 | 4 | // @author X.I.U |
5 | | -// @description 刷新不回根目录、后退返回上一级、右键文件显示菜单、自动显示更多文件、自定义分享链接域名、自动打开/复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、调整描述(话说)编辑框初始大小 |
| 5 | +// @description 刷新不回根目录、后退返回上一级、右键文件显示菜单、点击直接下载文件、自动显示更多文件、自定义分享链接域名、自动打开/复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、调整描述(话说)编辑框初始大小 |
6 | 6 | // @match *://*.lanzous.com/* |
7 | 7 | // @match *://*.lanzoux.com/* |
8 | 8 | // @match *://*.lanzoui.com/* |
|
40 | 40 | ['menu_copy_fileSha', '自动复制分享链接', '自动复制分享链接', true], |
41 | 41 | ['menu_refreshCorrection', '刷新不返回根目录', '刷新不返回根目录', true], |
42 | 42 | ['menu_rightClickMenu', '右键文件显示菜单', '右键文件显示菜单', true], |
| 43 | + ['menu_directDownload', '点击直接下载文件', '点击直接下载文件', true], |
43 | 44 | ['menu_folderDescdesMenu', '调整描述(话说)编辑框大小', '调整描述(话说)编辑框大小', true] |
44 | 45 | ], menu_ID = [], lastFolderID; |
45 | 46 | for (let i=0;i<menu_ALL.length;i++){ // 如果读取到的值为 null 就写入默认值 |
|
113 | 114 | enterToPass(); // 输入密码后回车确认 |
114 | 115 | } |
115 | 116 | fileMoreS(); // 自动显示更多文件 |
| 117 | + directDownload(); // 点击直接下载文件(分享链接列表页) |
116 | 118 | } |
117 | 119 | }, 300); |
| 120 | + directDownload_(); // 点击直接下载文件(分享链接列表页) |
118 | 121 | } |
119 | 122 |
|
120 | 123 |
|
|
252 | 255 | } |
253 | 256 |
|
254 | 257 |
|
| 258 | + // 点击直接下载文件(分享链接列表页) |
| 259 | + function directDownload() { |
| 260 | + if (!menu_value('menu_directDownload')) return |
| 261 | + if (document.getElementById('infos')) { |
| 262 | + document.getElementById('infos').addEventListener('click', function(e) { |
| 263 | + if (e.target.tagName === 'A') { |
| 264 | + e.preventDefault(); // 阻止默认打开链接事件 |
| 265 | + GM_openInTab(e.target.href + '#download', {active: false, insert: true, setParent: true}); // 后台打开 |
| 266 | + } |
| 267 | + }); |
| 268 | + } |
| 269 | + } |
| 270 | + // 点击下载按钮 |
| 271 | + function directDownload_() { |
| 272 | + if (!menu_value('menu_directDownload')) return |
| 273 | + if (location.hash != '#download') return |
| 274 | + let iframe = document.querySelector('iframe.ifr2'); |
| 275 | + if (iframe) { // 只有找到 iframe 框架时才会继续运行脚本 |
| 276 | + iframe = iframe.contentWindow; |
| 277 | + let timer = setInterval(function(){ |
| 278 | + if (iframe.document.querySelector('#go a[href]')) { |
| 279 | + GM_openInTab(iframe.document.querySelector('#go a[href]').href, {active: false, insert: true, setParent: false}); // 后台打开 |
| 280 | + window.top.close(); // 关闭该后台标签页 |
| 281 | + clearInterval(timer); |
| 282 | + } |
| 283 | + }, 1); |
| 284 | + } |
| 285 | + } |
| 286 | + |
| 287 | + |
255 | 288 | // 滚动条事件 |
256 | 289 | function windowScroll(fn1) { |
257 | 290 | var beforeScrollTop = document.documentElement.scrollTop, |
|
317 | 350 | if (menu_value('menu_open_fileSha')) {f_sha.style.display = 'none';GM_openInTab(f_sha1.textContent, {active: true,insert: true,setParent: true});} |
318 | 351 | // 复制分享链接(并已复制的提示信息) |
319 | 352 | if (menu_value('menu_copy_fileSha')) {f_sha.style.display = 'none';GM_setClipboard(f_sha1.textContent, 'text');GM_notification({text: '已复制分享链接~', timeout: 2000});} |
| 353 | + // 直接下载文件 |
| 354 | + if (menu_value('menu_directDownload')) {f_sha.style.display = 'none';GM_openInTab(f_sha1.textContent + '#download', {active: false,insert: true,setParent: true});} |
320 | 355 | } |
321 | 356 | } |
322 | 357 | } |
|
338 | 373 | // 隐藏分享链接窗口(这样自动打开/复制分享链接时,不会一闪而过) |
339 | 374 | function hideSha(){ |
340 | 375 | if (menu_value('menu_open_fileSha') || menu_value('menu_copy_fileSha')) { // [自动复制分享链接] 或 [自动打开分享链接] 任意一个功能开启时才继续 |
341 | | - mainframe.document.head.appendChild(document.createElement('style')).textContent = '#f_sha {display: none !important;}'; |
| 376 | + mainframe.document.lastElementChild.appendChild(document.createElement('style')).textContent = '#f_sha {display: none !important;}'; |
342 | 377 | } |
343 | 378 | } |
344 | 379 |
|
|
0 commit comments