|
1 | 1 | // ==UserScript==
|
2 | 2 | // @name 蓝奏云网盘增强
|
3 |
| -// @version 1.5.5 |
| 3 | +// @version 1.5.6 |
4 | 4 | // @author X.I.U
|
5 | 5 | // @description 文件排序、刷新不回根目录、快捷返回上一级(右键网页空白处)、后退返回上一级、右键文件显示菜单、点击直接下载文件、点击空白进入目录、自动显示更多文件、一键复制所有分享链接、自定义分享链接域名、自动打开/复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、优化编辑框初始大小
|
6 | 6 | // @match *://lanzou.com/u
|
|
148 | 148 |
|
149 | 149 | if (window.top.location.pathname === '/u' || window.top.location.pathname.indexOf('account.php') > -1 || window.top.location.pathname.indexOf('mydisk.php') > -1) { // 后台页
|
150 | 150 | if (window.top.location.href != 'https://pc.woozooo.com/mydisk.php') window.top.location.href = 'https://pc.woozooo.com/mydisk.php';
|
| 151 | + RememberLoginStatus() // 通过延长 cookie 到期时间来一直记住登录状态 |
151 | 152 | var mainframe;
|
152 | 153 | iframe();
|
153 | 154 | } else if (window.top.location.pathname.indexOf('%') > -1) { // > 带密码的分享链接页面
|
|
197 | 198 | shareLink = location.origin + shareLink[0]
|
198 | 199 | let password = location.pathname.replace('%E5%AF%86%E7%A0%81',':').replace(/%([A-Z]|[0-9]){2}/ig, '').split(':')
|
199 | 200 | if (password.length > 0) {
|
200 |
| - location.replace(shareLink + '?password=' + password[password.length - 1]) |
| 201 | + location.replace(shareLink + '?pwd=' + password[password.length - 1]) |
201 | 202 | }
|
202 | 203 | }
|
203 | 204 | }
|
204 | 205 | }
|
205 | 206 |
|
206 | 207 |
|
207 |
| - // 自动输入密码(仅支持访问 带密码的分享链接 时) |
| 208 | + // 自动输入密码(仅支持访问 带密码的分享链接 时,比如上面 [带密码的分享链接自动输密码] 功能重定向后的链接) |
208 | 209 | function enterPassword() {
|
209 |
| - if (location.search.indexOf('?password=') > -1) { |
| 210 | + if (location.search.indexOf('?pwd=') > -1 || location.search.indexOf('?passwd=') > -1 || location.search.indexOf('?password=') > -1) { |
210 | 211 | let password = location.search.split('=')
|
211 | 212 | if (password.length > 0) {
|
212 | 213 | document.getElementById('pwd').value = password[password.length - 1]
|
|
624 | 625 | observer.observe(mainframe.document, { childList: true, subtree: true });
|
625 | 626 | }
|
626 | 627 |
|
| 628 | + // 通过延长 cookie 到期时间来一直记住登录状态 |
| 629 | + function RememberLoginStatus() { |
| 630 | + // 获取 Cookie |
| 631 | + function getCookie(name) { |
| 632 | + if (!name) return '' |
| 633 | + let arr = document.cookie.split(';'); |
| 634 | + name += '='; |
| 635 | + for (let i=0; i<arr.length; i++) {let now = arr[i].trim();if (now.indexOf(name) == 0) return now.substring(name.length, now.length);} |
| 636 | + return ''; |
| 637 | + } |
| 638 | + |
| 639 | + const ylogin = getCookie('ylogin'), phpdisk_info = getCookie('phpdisk_info') |
| 640 | + if (ylogin !== '' && phpdisk_info !== '') { // 如果已登录(有相应 cookie),那么就延长至浏览器支持的到期时间上限(不同浏览器对到期时间的限制不一样,一般是 1-5 年) |
| 641 | + document.cookie='ylogin=' + ylogin + '; domain=.woozooo.com; expires=Thu, 18 Dec 2099 12:00:00 GMT; path=/' |
| 642 | + document.cookie='phpdisk_info=' + phpdisk_info + '; domain=pc.woozooo.com; expires=Thu, 18 Dec 2099 12:00:00 GMT; path=/' |
| 643 | + } |
| 644 | + } |
| 645 | + |
627 | 646 | // 文件排序
|
628 | 647 | function filesSort() {
|
629 | 648 | const frame = mainframe;
|
|
0 commit comments