wuhu-torn-helper/src/class/WuhuBase.ts
2022-10-09 17:56:16 +08:00

39 lines
1.3 KiB
TypeScript

import IGlobal from "../interface/IGlobal";
import IWHSettings from "../interface/IWHSettings";
import Log from "./Log";
import Provider from "./provider/Provider";
export default class WuhuBase extends Provider {
static glob: IGlobal = null;
protected static className = 'WuhuBase';
constructor() {
super();
// Log.info({ 'constructor': this.constructor, this: this, test: this.getClassName() });
Log.info('创建对象:', this);
}
static getLocal(): IWHSettings {
return JSON.parse(localStorage.getItem('wh_trans_settings')) || {};
}
static conditionInterrupt() {
let title: HTMLElement | { innerText: string } = (document.querySelector('#skip-to-content') ||
document.querySelector('[href*="#skip-to-content"]')) as HTMLElement || { innerText: '' };
let condition = (
document.title.toLowerCase().includes('just a moment') ||
title.innerText.toLowerCase().includes('please validate') ||
document.querySelector('div.container div.cf .iAmUnderAttack') !== null
);
if (condition) throw '芜湖';
}
static PDAExecute() {
if (window.WHTRANS) throw '已运行,退出';
window.WHTRANS = true;
}
// public toString() {
// return `[${ JSON.stringify(this) }]`;
// }
}