更新
This commit is contained in:
parent
d8631c8d7f
commit
d7aa4cf021
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/node_modules
|
||||
/bundle.min.js
|
||||
/bundle.js
|
||||
/.fleet
|
||||
4
.idea/torncity-zhcn-translate.iml
generated
4
.idea/torncity-zhcn-translate.iml
generated
@ -2,7 +2,9 @@
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.fleet" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
|
||||
12
CHANGELOG.md
12
CHANGELOG.md
@ -5,6 +5,18 @@
|
||||
|
||||
# CHANGE
|
||||
|
||||
## 0.5.8
|
||||
|
||||
2022年10月13日
|
||||
|
||||
### 修改
|
||||
|
||||
- UI调整
|
||||
|
||||
### 添加
|
||||
|
||||
- PT一键购买开关
|
||||
|
||||
## 0.5.7
|
||||
|
||||
2022年10月12日
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wuhu-torn-helper",
|
||||
"version": "0.5.7",
|
||||
"version": "0.5.8",
|
||||
"description": "芜湖助手",
|
||||
"dependencies": {},
|
||||
"scripts": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -5,6 +5,7 @@ import { Common } from "./Common";
|
||||
import UrlPattern from "./UrlMatch";
|
||||
import WuhuConfig from "./WuhuConfig";
|
||||
import translateMain from "../func/translate/translateMain";
|
||||
import Global from "./Global";
|
||||
|
||||
export default class Application {
|
||||
|
||||
@ -16,14 +17,14 @@ export default class Application {
|
||||
|
||||
let app = new WuHuTornHelper();
|
||||
app.init();
|
||||
let glob = WuhuBase.glob;
|
||||
ZhongIcon.getInstance().initialize();
|
||||
// let glob = WuhuBase.glob;
|
||||
ZhongIcon.getInstance();
|
||||
|
||||
Common.getInstance().resolve();
|
||||
|
||||
UrlPattern.resolve();
|
||||
UrlPattern.getInstance().resolve();
|
||||
|
||||
if (WuhuConfig.get('transEnable')) translateMain(glob.href);
|
||||
if (WuhuConfig.get('transEnable')) translateMain(Global.getInstance().href);
|
||||
|
||||
let runTime: number = (performance.now() - started) | 0;
|
||||
ZhongIcon.ZhongNode.initTimer.innerHTML = `助手加载时间 ${ runTime }ms`;
|
||||
|
||||
@ -5,6 +5,9 @@ import Log from "./Log";
|
||||
import InfoUtils from "./utils/InfoUtils";
|
||||
import BuyBeerHelper from "./action/BuyBeerHelper";
|
||||
|
||||
/**
|
||||
* 存储脚本用到的参数,单例存在
|
||||
*/
|
||||
export default class Global extends WuhuBase implements IGlobal {
|
||||
GM_xmlhttpRequest: Function = null;
|
||||
|
||||
|
||||
@ -15,53 +15,20 @@ import RW_RIDER_HTML from "../static/html/rw_rider.html";
|
||||
import christmasTownHelper from "../func/module/christmasTownHelper";
|
||||
import LotteryHelper from "./action/LotteryHelper";
|
||||
import TornStyleBlock from "./utils/TornStyleBlock";
|
||||
import PTHelper from "./action/PTHelper";
|
||||
import StackHelper from "./action/StackHelper";
|
||||
|
||||
export default class UrlPattern extends WuhuBase {
|
||||
static resolve() {
|
||||
public resolve(): void {
|
||||
let { href, beer } = UrlPattern.glob;
|
||||
// 捡垃圾助手
|
||||
if (href.includes('city.php') && WuhuConfig.get('cityFinder')) {
|
||||
cityFinder();
|
||||
}
|
||||
if (href.includes('city.php') && WuhuConfig.get('cityFinder')) cityFinder();
|
||||
|
||||
// pt一键购买
|
||||
if (WuhuConfig.get('ptQuickBuy') && href.includes('pmarket.php')) {
|
||||
new Alert('一键购买已开启');
|
||||
// ns脚本
|
||||
const rmv_cfm = (e) => {
|
||||
let el = e.firstElementChild;
|
||||
el.className += ' yes';
|
||||
let old_href = el.getAttribute('href');
|
||||
let new_href = old_href.replace(/=buy/, '=buy1').replace(/&points=\d{1,9}$/, '');
|
||||
el.setAttribute('href', new_href);
|
||||
};
|
||||
|
||||
let points_sales = document.querySelector('.users-point-sell');
|
||||
for (const index in points_sales.children) {
|
||||
'LI' === points_sales.children[index].tagName && rmv_cfm(points_sales.children[index])
|
||||
}
|
||||
new MutationObserver(e => {
|
||||
for (const t of e) {
|
||||
// for (const e of t.addedNodes) {
|
||||
// 'LI' === e.tagName && rmv_cfm(e)
|
||||
// }
|
||||
t.addedNodes.forEach(e => 'LI' === (e as HTMLElement).tagName && rmv_cfm(e))
|
||||
}
|
||||
}).observe(points_sales, { childList: true });
|
||||
}
|
||||
if (href.includes('pmarket.php')) PTHelper.getInstance();
|
||||
|
||||
// 叠e助手
|
||||
if (href.includes('gym.php')) {
|
||||
let block = new TornStyleBlock('叠E保护').insert2Dom();
|
||||
block.setContent(`<label class="non-selection"><input class="" type="checkbox" ${ WuhuConfig.get('SEProtect') ? 'checked' : '' }/> 启用</label>`);
|
||||
// 绑定点击事件
|
||||
block.querySelector('input').onchange = e => {
|
||||
let target = e.target as HTMLInputElement;
|
||||
document.body.classList.toggle('wh-gym-stack');
|
||||
WuhuConfig.set('SEProtect', target.checked, true);
|
||||
};
|
||||
if (WuhuConfig.get('SEProtect')) document.body.classList.add('wh-gym-stack');
|
||||
}
|
||||
if (href.includes('gym.php')) StackHelper.getInstance();
|
||||
|
||||
// 啤酒店
|
||||
if (href.includes('shops.php?step=bitsnbobs')) {
|
||||
@ -271,8 +238,6 @@ export default class UrlPattern extends WuhuBase {
|
||||
}
|
||||
|
||||
// 彩票助手
|
||||
if (href.includes('loader.php?sid=lottery')) {
|
||||
LotteryHelper.getInstance().init();
|
||||
}
|
||||
if (href.includes('loader.php?sid=lottery')) LotteryHelper.getInstance().init();
|
||||
}
|
||||
}
|
||||
@ -26,24 +26,23 @@ import QUICK_FLY_CSS from "../static/css/quick_fly.css";
|
||||
import QUICK_LINK_CSS from "../static/css/quick_link.css";
|
||||
import MDUtils from "./utils/MDUtils";
|
||||
import Test from "../test/Test";
|
||||
import TornStyleSwitch from "./utils/TornStyleSwitch";
|
||||
import Global from "./Global";
|
||||
|
||||
export default class ZhongIcon extends WuhuBase {
|
||||
public static ZhongNode: MyHTMLElement = null;
|
||||
private menuItemList: MenuItemConfig[] = null;
|
||||
private settingItemList: MenuItemConfig[] = null;
|
||||
|
||||
public initialize() {
|
||||
Log.info('ZhongIcon初始化');
|
||||
public constructor() {
|
||||
Log.info('ZhongIcon初始化, 设置图标开始');
|
||||
super();
|
||||
this.setDefaultSettings()
|
||||
.constructWuhuSettingList()
|
||||
.constructMenuList()
|
||||
.insert2Dom();
|
||||
|
||||
this.setDefaultSettings();
|
||||
|
||||
Log.info('设置图标开始');
|
||||
this.setSettingItems();
|
||||
this.setMenuItems();
|
||||
this.initIcon();
|
||||
Log.info('设置图标结束');
|
||||
|
||||
Log.info('ZhongIcon初始化结束');
|
||||
Log.info('设置图标结束, ZhongIcon初始化结束');
|
||||
}
|
||||
|
||||
private elemGenerator(setting: MenuItemConfig, root_node: Node) {
|
||||
@ -52,20 +51,18 @@ export default class ZhongIcon extends WuhuBase {
|
||||
switch (domType) {
|
||||
case 'checkbox': {
|
||||
new_node = document.createElement('div');
|
||||
let { domId, dictName, domText } = setting;
|
||||
let label = document.createElement('label');
|
||||
(tip) && (label.setAttribute('title', tip));
|
||||
let input = document.createElement('input');
|
||||
input.type = 'checkbox';
|
||||
input.id = domId;
|
||||
input.checked = WuhuConfig.get(dictName);
|
||||
input.onchange = e => {
|
||||
WuhuConfig.set(dictName, (e.target as HTMLInputElement).checked, true);
|
||||
if (setting.changeEv) setting.changeEv(e);
|
||||
let { domId, dictName, domText, changeEv } = setting;
|
||||
|
||||
let switcher = new TornStyleSwitch(domText);
|
||||
let _input = switcher.getInput();
|
||||
switcher.getBase().id = domId;
|
||||
(tip) && (switcher.getBase().setAttribute('title', tip));
|
||||
_input.checked = WuhuConfig.get(dictName);
|
||||
_input.onchange = e => {
|
||||
WuhuConfig.set(dictName, _input.checked, true);
|
||||
if (changeEv) changeEv(e);
|
||||
};
|
||||
label.innerHTML = domText;
|
||||
label.prepend(input);
|
||||
new_node.appendChild(label);
|
||||
new_node.appendChild(switcher.getBase());
|
||||
break;
|
||||
}
|
||||
case 'button': {
|
||||
@ -118,7 +115,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
/**
|
||||
* 添加左侧图标
|
||||
*/
|
||||
private initIcon(): MyHTMLElement {
|
||||
private insert2Dom() {
|
||||
let zhong_node: MyHTMLElement = document.querySelector('div#wh-trans-icon');
|
||||
let settings = this.menuItemList;
|
||||
let { version } = WuhuBase.glob;
|
||||
@ -129,9 +126,6 @@ export default class ZhongIcon extends WuhuBase {
|
||||
zhong_node.innerHTML = ZHONG_MENU_HTML.replace('{{}}', version.slice(-1) === '$' ? 'DEV' : version);
|
||||
// 助手菜单
|
||||
const menu_cont = zhong_node.querySelector('#wh-gSettings');
|
||||
// 设置选项
|
||||
zhong_node.setting_root = document.createElement('div');
|
||||
zhong_node.setting_root.classList.add('gSetting');
|
||||
// 遍历菜单node设置、生成node、插入dom
|
||||
this.menuItemList.forEach(setting => this.elemGenerator(setting, menu_cont));
|
||||
// 计时node
|
||||
@ -208,19 +202,19 @@ export default class ZhongIcon extends WuhuBase {
|
||||
// 加载torn mini profile
|
||||
initMiniProf('#wh-trans-icon');
|
||||
ZhongIcon.ZhongNode = zhong_node;
|
||||
return zhong_node;
|
||||
// return zhong_node;
|
||||
}
|
||||
|
||||
// 菜单
|
||||
private setMenuItems(): MenuItemConfig[] {
|
||||
let glob = WuhuBase.glob;
|
||||
private constructMenuList(): ZhongIcon {
|
||||
let glob = Global.getInstance();
|
||||
const date = new Date();
|
||||
|
||||
const menu_list: MenuItemConfig[] = [];
|
||||
let list: MenuItemConfig[] = [];
|
||||
|
||||
// 欢迎 显示玩家id
|
||||
if (glob.player_info.userID !== 0) {
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'plain',
|
||||
domId: 'wh-trans-welcome',
|
||||
domHTML: `<span>欢迎 <a href="/profiles.php?XID=${ glob.player_info.userID }" target="_blank">${ glob.player_info.playername }</a>[${ glob.player_info.userID }] 大佬</span>`,
|
||||
@ -231,8 +225,8 @@ export default class ZhongIcon extends WuhuBase {
|
||||
{
|
||||
// 节日字典
|
||||
const dict = FEST.val;
|
||||
menu_list.fest_date_dict = dict;
|
||||
menu_list.fest_date_list = Object.keys(dict);
|
||||
list.fest_date_dict = dict;
|
||||
list.fest_date_list = Object.keys(dict);
|
||||
const formatMMDD = (m, d) => {
|
||||
const MM = m < 10 ? `0${ m }` : m.toString();
|
||||
const DD = d < 10 ? `0${ d }` : d.toString();
|
||||
@ -260,7 +254,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
fest_date_html += `${ left }天后 - ${ next_fest_date.name }(<button title="${ next_fest_date.eff }">效果</button>)`;
|
||||
}
|
||||
}
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'plain',
|
||||
domId: 'wh-trans-fest-date',
|
||||
domHTML: fest_date_html,
|
||||
@ -271,7 +265,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
daysLeft: Infinity,
|
||||
events: EVENTS.default,
|
||||
};
|
||||
menu_list.events = eventObj.events;
|
||||
list.events = eventObj.events;
|
||||
eventObj.events.forEach((obj, index) => {
|
||||
if (eventObj.onEv) return;
|
||||
// 当前年份
|
||||
@ -304,13 +298,13 @@ export default class ZhongIcon extends WuhuBase {
|
||||
eventObj.onEv
|
||||
? eventObj.html += `${ eventObj.current.name }(<button title="${ eventObj.current.eff }">详情</button>) - 剩余${ eventObj.daysLeft }天`
|
||||
: eventObj.html += `${ eventObj.daysLeft }天后 - ${ eventObj.next.name }(<button title="${ eventObj.next.eff }">详情</button>)`;
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'plain',
|
||||
domId: 'wh-trans-event-cont',
|
||||
domHTML: eventObj.html,
|
||||
});
|
||||
// 飞花库存
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: 'wh-foreign-stock-btn',
|
||||
domText: '🌸 飞花库存',
|
||||
@ -321,7 +315,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
},
|
||||
});
|
||||
// 一键起飞
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: 'wh-quick-fly-btn',
|
||||
domText: '✈️ 一键起飞',
|
||||
@ -382,7 +376,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
},
|
||||
});
|
||||
// NPC LOOT
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: 'wh-npc-loot-btn',
|
||||
domText: '🔫 LOOT',
|
||||
@ -394,7 +388,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
tip: '显示5个可击杀NPC的开打时间',
|
||||
});
|
||||
// 查看NNB
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: 'wh-nnb-info',
|
||||
domText: '👮 查看NNB',
|
||||
@ -453,7 +447,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
},
|
||||
});
|
||||
// 常用链接
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: 'wh-link-collection',
|
||||
domText: '🔗 常用链接',
|
||||
@ -536,7 +530,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
},
|
||||
});
|
||||
// 飞贼
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: 'wh-gs-btn',
|
||||
domText: '🐏 飞贼小助手',
|
||||
@ -547,7 +541,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
tip: '加载从PC端移植的伞佬的油猴版飞贼小助手',
|
||||
});
|
||||
// 物品价格监视
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: 'wh-price-watcher-btn',
|
||||
domText: '💊 价格监视',
|
||||
@ -570,7 +564,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
}
|
||||
});
|
||||
// 小窗犯罪
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: 'wh-crime-iframe-btn',
|
||||
domText: '🤑 小窗犯罪',
|
||||
@ -662,7 +656,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
}
|
||||
});
|
||||
// 危险行为开关⚠️
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: 'wh-danger-zone',
|
||||
domText: '⚠️ 危险功能',
|
||||
@ -681,14 +675,14 @@ export default class ZhongIcon extends WuhuBase {
|
||||
},
|
||||
});
|
||||
// 传单助手
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: '',
|
||||
domText: '📜️ 传单助手',
|
||||
clickFunc: adHelper
|
||||
});
|
||||
// 守望者
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: '',
|
||||
domText: '🛡️ 守望者',
|
||||
@ -697,7 +691,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
},
|
||||
});
|
||||
// 更新历史
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button', domId: '', domText: '🐞 更新历史', clickFunc: async () => {
|
||||
let popup = new Popup(
|
||||
'更新历史:<br/><a target="_blank" href="https://gitlab.com/JJins/wuhu-torn-helper/-/blob/dev/CHANGELOG.md">https://gitlab.com/JJins/wuhu-torn-helper/-/blob/dev/CHANGELOG.md</a><br/>',
|
||||
@ -730,19 +724,18 @@ export default class ZhongIcon extends WuhuBase {
|
||||
},
|
||||
});
|
||||
// 助手设置
|
||||
menu_list.push({
|
||||
list.push({
|
||||
domType: 'button', domId: '', domText: '⚙️ 助手设置', clickFunc: () => {
|
||||
let $zhongNode = ZhongIcon.ZhongNode;
|
||||
$zhongNode.setting_root = document.createElement('div');
|
||||
$zhongNode.setting_root.classList.add('gSetting');
|
||||
// ZhongIcon.getSettingItems(glob).forEach(set => ZhongIcon.elemGenerator(set, $zhongNode.setting_root));
|
||||
let startTime = performance.now();
|
||||
Log.info('构造设置开始');
|
||||
this.settingItemList.forEach(set => this.elemGenerator(set, $zhongNode.setting_root));
|
||||
let pop = new Popup('', '芜湖助手设置');
|
||||
pop.getElement().appendChild($zhongNode.setting_root);
|
||||
let pop = new Popup(CommonUtils.loading_gif_html(), '芜湖助手设置');
|
||||
let tmp = document.createElement('div');
|
||||
tmp.classList.add('gSetting');
|
||||
this.settingItemList.forEach(set => this.elemGenerator(set, tmp));
|
||||
pop.getElement().innerHTML = '';
|
||||
pop.getElement().appendChild(tmp);
|
||||
// 本日不提醒
|
||||
$zhongNode.setting_root.querySelector('#wh-qua-alarm-check-btn').addEventListener('click', glob.beer.skip_today);
|
||||
pop.getElement().querySelector('#wh-qua-alarm-check-btn').addEventListener('click', () => glob.beer.skip_today());
|
||||
// 开发详情按钮
|
||||
// if (Log.debug()) $zhongNode.setting_root.querySelector('button#wh-devInfo').onclick = () => {
|
||||
// const date = new Date();
|
||||
@ -760,7 +753,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
},
|
||||
});
|
||||
// 测试
|
||||
if (Log.debug()) menu_list.push({
|
||||
if (Log.debug()) list.push({
|
||||
domType: 'button',
|
||||
domId: '',
|
||||
domText: '📐️ 测试',
|
||||
@ -777,34 +770,34 @@ export default class ZhongIcon extends WuhuBase {
|
||||
},
|
||||
});
|
||||
|
||||
this.menuItemList = menu_list;
|
||||
return menu_list;
|
||||
this.menuItemList = list;
|
||||
return this;
|
||||
}
|
||||
|
||||
// 设置
|
||||
private setSettingItems(): MenuItemConfig[] {
|
||||
private constructWuhuSettingList(): ZhongIcon {
|
||||
const date = new Date();
|
||||
|
||||
let { beer, popup_node } = ZhongIcon.glob;
|
||||
|
||||
let setting_list: MenuItemConfig[] = [];
|
||||
let list: MenuItemConfig[] = [];
|
||||
|
||||
// 12月时加入圣诞小镇选项
|
||||
if (date.getMonth() === 11) {
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'plain',
|
||||
domId: '',
|
||||
domHTML: '圣诞小镇',
|
||||
tagName: 'h4',
|
||||
})
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-xmastown-wt',
|
||||
domText: ' 圣诞小镇攻略',
|
||||
dictName: 'xmasTownWT',
|
||||
isHide: true,
|
||||
});
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-xmastown-notify',
|
||||
domText: ' 圣诞小镇物品提示',
|
||||
@ -814,14 +807,14 @@ export default class ZhongIcon extends WuhuBase {
|
||||
}
|
||||
|
||||
// 翻译
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'plain',
|
||||
domId: '',
|
||||
domHTML: '翻译',
|
||||
tagName: 'h4',
|
||||
});
|
||||
// 开启翻译
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-trans-enable',
|
||||
domText: ' 开启翻译',
|
||||
@ -829,7 +822,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
isHide: true,
|
||||
});
|
||||
// 更新翻译词库
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: '',
|
||||
domText: '更新翻译词库',
|
||||
@ -837,14 +830,14 @@ export default class ZhongIcon extends WuhuBase {
|
||||
});
|
||||
|
||||
// 战斗优化
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'plain',
|
||||
domId: '',
|
||||
domHTML: '战斗优化',
|
||||
tagName: 'h4',
|
||||
});
|
||||
// 光速拔刀
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'select',
|
||||
domId: 'wh-quick-attack-index',
|
||||
domText: '光速拔刀 ',
|
||||
@ -883,7 +876,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
tip: '将Start Fight按钮移动到指定格子上',
|
||||
});
|
||||
// 光速跑路
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'select',
|
||||
domId: 'wh-quick-mug',
|
||||
domText: '光速跑路 ',
|
||||
@ -910,7 +903,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
tip: '将结束后指定按钮移动到上面指定的格子上',
|
||||
});
|
||||
// 攻击链接转跳
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-attack-relocate',
|
||||
domText: ' 真·攻击界面转跳',
|
||||
@ -920,14 +913,14 @@ export default class ZhongIcon extends WuhuBase {
|
||||
});
|
||||
|
||||
// 飞行
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'plain',
|
||||
domId: '',
|
||||
domHTML: '飞行',
|
||||
tagName: 'h4',
|
||||
});
|
||||
// 起飞警告
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-energy-alert',
|
||||
domText: ' 起飞爆E警告',
|
||||
@ -936,7 +929,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
isHide: true,
|
||||
});
|
||||
// 飞行闹钟
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-trv-alarm-check',
|
||||
domText: ' 飞行闹钟',
|
||||
@ -945,7 +938,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
isHide: true,
|
||||
});
|
||||
// 海外警告
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: '',
|
||||
domText: ' 海外警告',
|
||||
@ -953,17 +946,17 @@ export default class ZhongIcon extends WuhuBase {
|
||||
tip: '海外落地后每30秒通知警告',
|
||||
});
|
||||
// 落地转跳
|
||||
setting_list.push({ domType: 'button', domId: '', domText: '落地转跳', clickFunc: landedRedirect });
|
||||
list.push({ domType: 'button', domId: '', domText: '落地转跳', clickFunc: landedRedirect });
|
||||
|
||||
// 公司
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'plain',
|
||||
domId: '',
|
||||
domHTML: '公司',
|
||||
tagName: 'h4',
|
||||
});
|
||||
// 浮动存钱框
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: '',
|
||||
domText: ' 浮动存钱框',
|
||||
@ -971,7 +964,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
tip: '打开公司或帮派的存钱页面后存钱框将浮动显示',
|
||||
});
|
||||
// 公司转跳存钱
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: '',
|
||||
domText: ' 公司转跳存钱',
|
||||
@ -979,7 +972,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
tip: '打开公司页面时自动打开存钱选项卡',
|
||||
});
|
||||
// 收起公司冰蛙效率表
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: '',
|
||||
domText: ' 收起公司冰蛙效率表',
|
||||
@ -987,7 +980,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
tip: '开启后可手动显示隐藏冰蛙公司表格',
|
||||
});
|
||||
// 任何位置一键存钱
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: '',
|
||||
domText: ' 任何位置一键存钱',
|
||||
@ -996,14 +989,14 @@ export default class ZhongIcon extends WuhuBase {
|
||||
});
|
||||
|
||||
// 啤酒
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'plain',
|
||||
domId: '',
|
||||
domHTML: '啤酒',
|
||||
tagName: 'h4',
|
||||
});
|
||||
// 啤酒提醒
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-qua-alarm-check',
|
||||
domText: '<span> 啤酒提醒 </span><button id="wh-qua-alarm-check-btn">今日不提醒</button>',
|
||||
@ -1015,7 +1008,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
},
|
||||
});
|
||||
// 啤酒提醒状态
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: '',
|
||||
domText: '啤酒提醒状态',
|
||||
@ -1024,7 +1017,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
}
|
||||
});
|
||||
// 啤酒提醒时间
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: '',
|
||||
domText: '啤酒提醒时间设定',
|
||||
@ -1051,14 +1044,14 @@ export default class ZhongIcon extends WuhuBase {
|
||||
});
|
||||
|
||||
// 其他
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'plain',
|
||||
domId: '',
|
||||
domHTML: '其他',
|
||||
tagName: 'h4',
|
||||
});
|
||||
// 任务助手
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-mission-lint',
|
||||
domText: ' 任务助手',
|
||||
@ -1067,7 +1060,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
isHide: true,
|
||||
});
|
||||
// 捡垃圾助手
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-city-finder',
|
||||
domText: ' 捡垃圾助手',
|
||||
@ -1076,7 +1069,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
isHide: true,
|
||||
});
|
||||
// 快速crime
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-quick-crime',
|
||||
domText: ' 快速犯罪',
|
||||
@ -1085,7 +1078,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
isHide: true,
|
||||
});
|
||||
// 叠E保护
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-SEProtect-check',
|
||||
domText: ' 叠E保护',
|
||||
@ -1094,7 +1087,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
isHide: true,
|
||||
});
|
||||
// PT一键购买
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-ptQuickBuy-check',
|
||||
domText: ' PT一键购买',
|
||||
@ -1103,7 +1096,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
isHide: true,
|
||||
});
|
||||
// 4条转跳
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: '',
|
||||
domText: ' 4条转跳',
|
||||
@ -1111,7 +1104,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
tip: '点击4条时转跳对应页面',
|
||||
});
|
||||
// 清除多余的脚本
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: '',
|
||||
domText: ' 清除多余的脚本',
|
||||
@ -1121,7 +1114,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
// 危险行为⚠️
|
||||
if (WuhuConfig.get('dangerZone') === true) {
|
||||
// 攻击界面自刷新
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'select',
|
||||
domId: 'wh-attack-reload',
|
||||
domText: '⚠️攻击界面自动刷新 ',
|
||||
@ -1160,7 +1153,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
tip: '危险功能:接机时常用,将自动刷新页面直到目标落地',
|
||||
});
|
||||
// 自动开打和结束
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-auto-start-finish',
|
||||
domText: ' ⚠️自动开打和结束',
|
||||
@ -1173,7 +1166,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
WuhuConfig.set('attReload', 6)
|
||||
}
|
||||
// dev
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'checkbox',
|
||||
domId: 'wh-dev-mode',
|
||||
domText: ` 开发者模式${ Log.debug() ? ' <button id="wh-devInfo">详情</button>' : '' }`,
|
||||
@ -1181,7 +1174,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
isHide: true,
|
||||
});
|
||||
// 查看logs
|
||||
setting_list.push({
|
||||
list.push({
|
||||
domType: 'button',
|
||||
domId: null,
|
||||
domText: '查看日志',
|
||||
@ -1194,7 +1187,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
}
|
||||
});
|
||||
// 更多设定
|
||||
if (Log.debug()) setting_list.push({
|
||||
if (Log.debug()) list.push({
|
||||
domType: 'button', domId: 'wh-otherBtn', domText: '更多设定',
|
||||
clickFunc: () => {
|
||||
new Popup(`清空设置数据、请求通知权限、测试跨域请求`, '更多设定');
|
||||
@ -1202,12 +1195,12 @@ export default class ZhongIcon extends WuhuBase {
|
||||
isHide: true,
|
||||
});
|
||||
|
||||
this.settingItemList = setting_list;
|
||||
return setting_list;
|
||||
this.settingItemList = list;
|
||||
return this;
|
||||
}
|
||||
|
||||
// 默认设置
|
||||
private setDefaultSettings(): void {
|
||||
private setDefaultSettings(): ZhongIcon {
|
||||
Log.info('设置默认值开始');
|
||||
let count = 0;
|
||||
[
|
||||
@ -1275,6 +1268,7 @@ export default class ZhongIcon extends WuhuBase {
|
||||
}
|
||||
});
|
||||
Log.info('设置默认值结束,新:' + count);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
65
src/class/action/PTHelper.ts
Normal file
65
src/class/action/PTHelper.ts
Normal file
@ -0,0 +1,65 @@
|
||||
import WuhuBase from "../WuhuBase";
|
||||
import TornStyleBlock from "../utils/TornStyleBlock";
|
||||
import WuhuConfig from "../WuhuConfig";
|
||||
import Alert from "../utils/Alert";
|
||||
import TornStyleSwitch from "../utils/TornStyleSwitch";
|
||||
|
||||
export default class PTHelper extends WuhuBase {
|
||||
private readonly observer;
|
||||
private readonly usersPointSell;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.observer = new MutationObserver(e => {
|
||||
for (const t of e) {
|
||||
t.addedNodes.forEach(e => 'LI' === (e as HTMLElement).tagName && this.removeConfirm(e))
|
||||
}
|
||||
});
|
||||
this.usersPointSell = document.querySelector('.users-point-sell');
|
||||
|
||||
let block = new TornStyleBlock('PT一键购买').insert2Dom();
|
||||
let switcher = new TornStyleSwitch('开启');
|
||||
block.append(switcher.getBase());
|
||||
let toggle = switcher.getInput();
|
||||
toggle.checked = WuhuConfig.get('ptQuickBuy');
|
||||
if (toggle.checked) {
|
||||
new Alert('一键购买已开启');
|
||||
for (const index in this.usersPointSell.children) {
|
||||
'LI' === this.usersPointSell.children[index].tagName && this.removeConfirm(this.usersPointSell.children[index])
|
||||
}
|
||||
this.observer.observe(this.usersPointSell, { childList: true })
|
||||
}
|
||||
toggle.addEventListener('change', () => {
|
||||
WuhuConfig.set('ptQuickBuy', toggle.checked, false);
|
||||
if (toggle.checked) {
|
||||
for (const index in this.usersPointSell.children) {
|
||||
'LI' === this.usersPointSell.children[index].tagName && this.removeConfirm(this.usersPointSell.children[index])
|
||||
}
|
||||
this.observer.observe(this.usersPointSell, { childList: true });
|
||||
new Alert('一键购买已开启');
|
||||
} else {
|
||||
for (const index in this.usersPointSell.children) {
|
||||
'LI' === this.usersPointSell.children[index].tagName && this.rollbackConfirm(this.usersPointSell.children[index])
|
||||
}
|
||||
this.observer.disconnect();
|
||||
new Alert('一键购买已关闭');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private removeConfirm(elem): void {
|
||||
let el = elem.firstElementChild;
|
||||
el.classList.add('yes');
|
||||
let old_href = el.getAttribute('href');
|
||||
let new_href = old_href.replace(/=buy/, '=buy1').replace(/&points=\d{1,9}$/, '');
|
||||
el.setAttribute('href', new_href);
|
||||
}
|
||||
|
||||
private rollbackConfirm(elem): void {
|
||||
let el = elem.firstElementChild;
|
||||
el.classList.remove('yes');
|
||||
let old_href = el.getAttribute('href');
|
||||
let new_href = old_href.replace(/=buy1/, '=buy');
|
||||
el.setAttribute('href', new_href);
|
||||
}
|
||||
}
|
||||
23
src/class/action/StackHelper.ts
Normal file
23
src/class/action/StackHelper.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import WuhuBase from "../WuhuBase";
|
||||
import TornStyleBlock from "../utils/TornStyleBlock";
|
||||
import WuhuConfig from "../WuhuConfig";
|
||||
import TornStyleSwitch from "../utils/TornStyleSwitch";
|
||||
|
||||
export default class StackHelper extends WuhuBase {
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@ -28,6 +28,9 @@ export default class Popup extends WuhuBase {
|
||||
this.showChat();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {HTMLElement} id=wh-popup-cont
|
||||
*/
|
||||
public getElement(): HTMLElement {
|
||||
return this.node;
|
||||
}
|
||||
|
||||
22
src/class/utils/TornStyleSwitch.ts
Normal file
22
src/class/utils/TornStyleSwitch.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import MathUtils from "./MathUtils";
|
||||
|
||||
export default class TornStyleSwitch {
|
||||
private readonly baseElement;
|
||||
private readonly randomId;
|
||||
|
||||
constructor(label: string) {
|
||||
this.randomId = MathUtils.getInstance().getRandomInt(0, 100)
|
||||
this.baseElement = document.createElement('span');
|
||||
this.baseElement.id = 'WHSwitch' + this.randomId;
|
||||
this.baseElement.innerHTML = `<input class="checkbox-css" type="checkbox" name="searchConditionNot" id="WHCheck${ this.randomId }">
|
||||
<label for="WHCheck${ this.randomId }" class="non-selection marker-css search-condition-not">${ label }</label>`;
|
||||
}
|
||||
|
||||
public getBase() {
|
||||
return this.baseElement
|
||||
};
|
||||
|
||||
public getInput(): HTMLInputElement {
|
||||
return this.baseElement.querySelector('input');
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,13 @@
|
||||
import WuhuBase from "../class/WuhuBase";
|
||||
import Log from "../class/Log";
|
||||
import Popup from "../class/utils/Popup";
|
||||
import TornStyleSwitch from "../class/utils/TornStyleSwitch";
|
||||
|
||||
export default class Test extends WuhuBase {
|
||||
public test(): void {
|
||||
Log.info(Test.getPool());
|
||||
let popup = new Popup('test');
|
||||
popup.getElement()['__POOL__'] = Test.getPool();
|
||||
popup.getElement().append(new TornStyleSwitch('123').getBase());
|
||||
|
||||
// this.case2()
|
||||
// this.case3();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user