73 lines
2.7 KiB
Go
73 lines
2.7 KiB
Go
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
|
//go:build plus
|
|
|
|
package uam
|
|
|
|
// JSCode source code
|
|
const JSCode = `function loadFunc() {
|
|
var cookie = document.cookie
|
|
var count = 5
|
|
if (cookie == null) {
|
|
window.setTimeout(function () {
|
|
window.location.reload()
|
|
}, sleepMs);
|
|
return;
|
|
}
|
|
var cookieString = cookie.toString()
|
|
var cookies = cookieString.split(";")
|
|
var key = ""
|
|
for (var i = 0; i < cookies.length; i ++) {
|
|
var cookie = cookies[i].trim();
|
|
var pieces = cookie.split("=");
|
|
if (pieces.length == 2 && pieces[0] == cpk) {
|
|
key = pieces[1];
|
|
break;
|
|
}
|
|
}
|
|
if (key.length == 0) {
|
|
return;
|
|
}
|
|
|
|
var sum = 0;
|
|
for (var i = 0; i < key.length; i ++) {
|
|
var c = key[i];
|
|
if (/^[a-zA-Z0-9]$/.test(c)) {
|
|
sum += key.charCodeAt(i) * (nonce+i);
|
|
}
|
|
}
|
|
|
|
var u = window.location.toString();
|
|
var req = new XMLHttpRequest();
|
|
req.open("POST", u, true);
|
|
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
|
req.setRequestHeader("X-GE-UA-Step", step);
|
|
req.onreadystatechange = function() {
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
window.setTimeout(function () {
|
|
window.location.reload()
|
|
}, count * 1000);
|
|
window.setInterval(function () {
|
|
if (count <= 0) {
|
|
return;
|
|
}
|
|
var counterElements = document.getElementsByClassName("ui-counter");
|
|
if (counterElements.length > 0) {
|
|
for (var i = 0; i < counterElements.length; i ++) {
|
|
counterElements[i].innerHTML = count.toString();
|
|
count --;
|
|
}
|
|
}
|
|
}, 1000);
|
|
}
|
|
};
|
|
req.send("sum=" + sum + "&nonce=" + nonce);
|
|
}
|
|
if (window.addEventListener) {
|
|
window.addEventListener("load", loadFunc);
|
|
} else {
|
|
window.onload = loadFunc;
|
|
}`
|
|
|
|
// JSMinifyCode generated on site: https://jscompress.com/
|
|
const JSMinifyCode = `function loadFunc(){var e=document.cookie,t=5;if(null!=e){for(var n=e.toString().split(";"),o="",i=0;i<n.length;i++){var a=(e=n[i].trim()).split("=");if(2==a.length&&a[0]==cpk){o=a[1];break}}if(0!=o.length){for(var d=0,i=0;i<o.length;i++){var r=o[i];/^[a-zA-Z0-9]$/.test(r)&&(d+=o.charCodeAt(i)*(nonce+i))}var l=window.location.toString(),s=new XMLHttpRequest;s.open("POST",l,!0),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),s.setRequestHeader("X-GE-UA-Step",step),s.onreadystatechange=function(){4==this.readyState&&200==this.status&&(window.setTimeout(function(){window.location.reload()},1e3*t),window.setInterval(function(){if(!(t<=0)){var e=document.getElementsByClassName("ui-counter");if(0<e.length)for(var n=0;n<e.length;n++)e[n].innerHTML=t.toString(),t--}},1e3))},s.send("sum="+d+"&nonce="+nonce)}}else window.setTimeout(function(){window.location.reload()},sleepMs)}window.addEventListener?window.addEventListener("load",loadFunc):window.onload=loadFunc;`
|