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

Function getCookie

Lanzou-Enhanced.user.js:632–638  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

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 年)

Callers 1

RememberLoginStatusFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected