wuhu-torn-helper/src/class/action/StackHelper.ts
2022-10-17 15:19:18 +08:00

24 lines
895 B
TypeScript

import WuhuBase from "../WuhuBase";
import TornStyleBlock from "../utils/TornStyleBlock";
import WuhuConfig from "../WuhuConfig";
import TornStyleSwitch from "../utils/TornStyleSwitch";
export default class StackHelper extends WuhuBase {
className = 'StackHelper';
constructor() {
super();
let block = new TornStyleBlock('叠E保护').insert2Dom();
let switcher = new TornStyleSwitch('启用');
let input = switcher.getInput();
block.append(switcher.getBase());
input.checked = WuhuConfig.get('SEProtect');
if (input.checked) document.body.classList.add('wh-gym-stack');
// 绑定点击事件
input.onchange = e => {
let target = e.target as HTMLInputElement;
document.body.classList.toggle('wh-gym-stack');
WuhuConfig.set('SEProtect', target.checked, true);
};
}
}