|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 蓝奏云网盘增强 |
3 | | -// @version 1.1.1 |
| 3 | +// @version 1.1.2 |
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/* |
| 9 | +// @match *://pan.lanzou.com/* |
9 | 10 | // @match *://www.lanzou.com/account.php |
10 | 11 | // @match *://www.lanzou.com/u |
11 | 12 | // @match *://up.woozooo.com/u |
|
29 | 30 | var menu_open_fileSha = GM_getValue('xiu2_menu_open_fileSha'), |
30 | 31 | menu_copy_fileSha = GM_getValue('xiu2_menu_copy_fileSha'), |
31 | 32 | menu_refreshCorrection = GM_getValue('xiu2_menu_refreshCorrection'), |
32 | | - menu_rightClickMenu = GM_getValue('xiu2_menu_rightClickMenu'); |
33 | | - var menu_open_fileSha_ID, menu_copy_fileSha_ID, menu_refreshCorrection_ID, menu_rightClickMenu_ID, menu_feedBack_ID; |
| 33 | + menu_rightClickMenu = GM_getValue('xiu2_menu_rightClickMenu'), |
| 34 | + menu_urlRedirect = GM_getValue('xiu2_menu_urlRedirect'); |
| 35 | + var menu_open_fileSha_ID, menu_copy_fileSha_ID, menu_refreshCorrection_ID, menu_rightClickMenu_ID, menu_urlRedirect_ID, menu_feedBack_ID; |
34 | 36 | if (menu_open_fileSha == null){menu_open_fileSha = true; GM_setValue('xiu2_menu_open_fileSha', menu_open_fileSha)}; |
35 | 37 | if (menu_copy_fileSha == null){menu_copy_fileSha = true; GM_setValue('xiu2_menu_copy_fileSha', menu_copy_fileSha)}; |
36 | 38 | if (menu_refreshCorrection == null){menu_refreshCorrection = true; GM_setValue('xiu2_menu_refreshCorrection', menu_refreshCorrection)}; |
37 | 39 | if (menu_rightClickMenu == null){menu_rightClickMenu = true; GM_setValue('xiu2_menu_rightClickMenu', menu_rightClickMenu)}; |
| 40 | + if (menu_urlRedirect == null){menu_urlRedirect = false; GM_setValue('xiu2_menu_urlRedirect', menu_urlRedirect)}; |
38 | 41 | registerMenuCommand(); |
39 | 42 |
|
40 | 43 | // 注册脚本菜单 |
41 | 44 | function registerMenuCommand() { |
42 | | - var menu_open_fileSha_, menu_copy_fileSha_, menu_refreshCorrection_, menu_rightClickMenu_; |
| 45 | + var menu_open_fileSha_, menu_copy_fileSha_, menu_refreshCorrection_, menu_rightClickMenu_, menu_urlRedirect_; |
43 | 46 | if (menu_feedBack_ID){ // 如果反馈菜单ID不是 null,则删除所有脚本菜单 |
44 | 47 | GM_unregisterMenuCommand(menu_open_fileSha_ID); |
45 | 48 | GM_unregisterMenuCommand(menu_copy_fileSha_ID); |
46 | 49 | GM_unregisterMenuCommand(menu_refreshCorrection_ID); |
47 | 50 | GM_unregisterMenuCommand(menu_rightClickMenu_ID); |
| 51 | + GM_unregisterMenuCommand(menu_urlRedirect_ID); |
48 | 52 | GM_unregisterMenuCommand(menu_feedBack_ID); |
49 | 53 | menu_open_fileSha = GM_getValue('xiu2_menu_open_fileSha'); |
50 | 54 | menu_copy_fileSha = GM_getValue('xiu2_menu_copy_fileSha'); |
51 | 55 | menu_refreshCorrection = GM_getValue('xiu2_menu_refreshCorrection'); |
52 | 56 | menu_rightClickMenu = GM_getValue('xiu2_menu_rightClickMenu'); |
| 57 | + menu_rightClickMenu = GM_getValue('xiu2_menu_urlRedirect'); |
53 | 58 | } |
54 | 59 |
|
55 | 60 | if (menu_open_fileSha){menu_open_fileSha_ = "√";}else{menu_open_fileSha_ = "×";} |
56 | 61 | if (menu_copy_fileSha){menu_copy_fileSha_ = "√";}else{menu_copy_fileSha_ = "×";} |
57 | 62 | if (menu_refreshCorrection){menu_refreshCorrection_ = "√";}else{menu_refreshCorrection_ = "×";} |
58 | 63 | if (menu_rightClickMenu){menu_rightClickMenu_ = "√";}else{menu_rightClickMenu_ = "×";} |
| 64 | + if (menu_urlRedirect){menu_urlRedirect_ = "√";}else{menu_urlRedirect_ = "×";} |
59 | 65 |
|
60 | 66 | menu_open_fileSha_ID = GM_registerMenuCommand(`[ ${menu_open_fileSha_} ] 自动打开分享链接`, function(){menu_switch(menu_open_fileSha,'xiu2_menu_open_fileSha','自动打开分享链接', true)}); |
61 | 67 | menu_copy_fileSha_ID = GM_registerMenuCommand(`[ ${menu_copy_fileSha_} ] 自动复制分享链接`, function(){menu_switch(menu_copy_fileSha,'xiu2_menu_copy_fileSha','自动复制分享链接', true)}); |
62 | 68 | menu_refreshCorrection_ID = GM_registerMenuCommand(`[ ${menu_refreshCorrection_} ] 刷新不返回根目录`, function(){if(menu_refreshCorrection){UNrefreshCorrection();}else{refreshCorrection();};menu_switch(menu_refreshCorrection,'xiu2_menu_refreshCorrection','刷新不返回根目录', false)}); |
63 | 69 | menu_rightClickMenu_ID = GM_registerMenuCommand(`[ ${menu_rightClickMenu_} ] 右键文件显示菜单`, function(){menu_switch(menu_rightClickMenu,'xiu2_menu_rightClickMenu','右键文件显示菜单', true)}); |
| 70 | + menu_urlRedirect_ID = GM_registerMenuCommand(`[ ${menu_urlRedirect_} ] 分享链接重定向(解决部分地区无法访问)`, function(){menu_switch(menu_urlRedirect,'xiu2_menu_urlRedirect','分享链接重定向', true)}); |
64 | 71 | menu_feedBack_ID = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});}); |
65 | 72 | } |
66 | 73 |
|
|
83 | 90 | }; |
84 | 91 |
|
85 | 92 |
|
| 93 | + urlRedirect(); // 分享链接重定向 |
86 | 94 | if(document.getElementById("infos")){ // 分享链接文件列表页 |
87 | 95 | setTimeout(fileMoreS, 300); // 自动显示更多文件 |
88 | 96 | }else if(document.querySelector("iframe.ifr2")){ // 分享链接文件下载页(暂时没有这方面的功能,先空着) |
|
140 | 148 | } |
141 | 149 |
|
142 | 150 |
|
| 151 | + // 分享链接重定向 |
| 152 | + function urlRedirect() { |
| 153 | + if(menu_urlRedirect){ |
| 154 | + if(/lanzou[s|x|i]\.com/.test(window.top.location.hostname)){ |
| 155 | + window.top.location.hostname = "pan.lanzou.com" |
| 156 | + } |
| 157 | + } |
| 158 | + } |
| 159 | + |
143 | 160 | // 右键文件显示菜单 |
144 | 161 | function rightClickMenu() { |
145 | 162 | if(menu_rightClickMenu){ // 脚本菜单开启时才继续 |
|
0 commit comments