Greasy Fork is available in English.
自动续期cookie,使网页端,易刷,apt等工具保持登陆状态,by:放课后
当前为
// ==UserScript==
// @license MIT
// @name POE自动续期cookie
// @namespace http://tampermonkey.net/
// @version 0.1.3
// @description 自动续期cookie,使网页端,易刷,apt等工具保持登陆状态,by:放课后
// @author 放课后
// @match https://poe.game.qq.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=qq.com
// @grant none
// ==/UserScript==
(function() {
const today = new Date();
const nextYear = new Date();
nextYear.setFullYear(nextYear.getFullYear() + 1);
const expires = nextYear.toUTCString();
const cookieValues = document.cookie.match(`(^|;)\\s*p_uin\\s*=\\s*([^;]+)`);
const cookieValue = cookieValues ? cookieValues.pop() : '';
if(cookieValue){
document.cookie = `p_uin=${cookieValue}; expires=${expires}; path=/`;
}
if(window.location.href.indexOf("login") > -1){
// debugger
if(cookieValue){
clearAllCookies();
location.reload();
}
}
function clearAllCookies() {
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
}
})();