MCPcopy Create free account
hub / github.com/XIU2/UserScript / RememberLoginStatus

Function RememberLoginStatus

Lanzou-Enhanced.user.js:630–645  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

628
629 // 通过延长 cookie 到期时间来一直记住登录状态
630 function RememberLoginStatus() {
631 // 获取 Cookie
632 function getCookie(name) {
633 if (!name) return ''
634 let arr = document.cookie.split(';');
635 name += '=';
636 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);}
637 return '';
638 }
639
640 const ylogin = getCookie('ylogin'), phpdisk_info = getCookie('phpdisk_info')
641 if (ylogin !== '' && phpdisk_info !== '') { // 如果已登录(有相应 cookie),那么就延长至浏览器支持的到期时间上限(不同浏览器对到期时间的限制不一样,一般是 1-5 年)
642 document.cookie='ylogin=' + ylogin + '; domain=.woozooo.com; expires=Thu, 18 Dec 2099 12:00:00 GMT; path=/'
643 document.cookie='phpdisk_info=' + phpdisk_info + '; domain=pc.woozooo.com; expires=Thu, 18 Dec 2099 12:00:00 GMT; path=/'
644 }
645 }
646
647 // 文件排序
648 function filesSort() {

Callers 1

Calls 1

getCookieFunction · 0.70

Tested by

no test coverage detected