57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
import WuhuBase from "../class/WuhuBase";
|
|
import Log from "../class/Log";
|
|
import Popup from "../class/utils/Popup";
|
|
import WuhuConfig from "../class/WuhuConfig";
|
|
import Alert from "../class/utils/Alert";
|
|
|
|
export default class Test extends WuhuBase {
|
|
className = 'Test';
|
|
|
|
public test(): void {
|
|
let popup = new Popup('');
|
|
popup.getElement()['__POOL__'] = Test.getPool();
|
|
|
|
// this.case1()
|
|
// this.case2()
|
|
this.case3().then();
|
|
// window.fetch('/test').then(res=>res.text()).then(o=>Log.info(o))
|
|
}
|
|
|
|
private case1() {
|
|
const temp = document.createElement("DIV");
|
|
const temp2 = document.createElement("DIV");
|
|
|
|
// @ts-ignore
|
|
temp.append(...document.body.childNodes);
|
|
// @ts-ignore
|
|
temp2.append(...document.head.childNodes);
|
|
|
|
window.stop();
|
|
|
|
// document.body.outerHTML = document.body.outerHTML;
|
|
Log.info(document.body.outerHTML);
|
|
document.body.innerHTML = "";
|
|
document.head.innerHTML = "";
|
|
// @ts-ignore
|
|
document.body.append(...temp.childNodes);
|
|
// @ts-ignore
|
|
document.head.append(...temp2.childNodes);
|
|
}
|
|
|
|
private case2() {
|
|
document.head.insertAdjacentHTML(
|
|
"afterbegin",
|
|
// `<meta http-equiv="Content-Security-Policy" content="script-src 'none'">`
|
|
`<meta http-equiv="Content-Security-Policy" content="connect-src 'self'">`
|
|
);
|
|
}
|
|
|
|
private async case3() {
|
|
WuhuConfig.set('CHTrainsDetect', 0);
|
|
new Alert(`公司助手<br/>火车检测:火车明日将溢出!有${ 1 }个可用火车`, {
|
|
timeout: 15,
|
|
force: true,
|
|
sysNotify: true
|
|
});
|
|
}
|
|
} |