更新
This commit is contained in:
parent
95ca6914a9
commit
49933f7a7e
10
CHANGELOG.md
10
CHANGELOG.md
@ -4,6 +4,16 @@
|
|||||||
|
|
||||||
# CHANGE
|
# CHANGE
|
||||||
|
|
||||||
|
## 0.6.9
|
||||||
|
|
||||||
|
2022年11月8日
|
||||||
|
|
||||||
|
### 添加
|
||||||
|
|
||||||
|
- 搜索页-可选添加底部空白占位区
|
||||||
|
- 全屏菜单
|
||||||
|
- 自定义CSS
|
||||||
|
|
||||||
## 0.6.8
|
## 0.6.8
|
||||||
|
|
||||||
2022年11月4日
|
2022年11月4日
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wuhu-torn-helper",
|
"name": "wuhu-torn-helper",
|
||||||
"version": "0.6.8",
|
"version": "0.6.9",
|
||||||
"description": "芜湖助手",
|
"description": "芜湖助手",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -6,9 +6,12 @@ import WuhuConfig from "./WuhuConfig";
|
|||||||
import CompanyHelper from "./action/CompanyHelper";
|
import CompanyHelper from "./action/CompanyHelper";
|
||||||
import AttackHelper from "./action/AttackHelper";
|
import AttackHelper from "./action/AttackHelper";
|
||||||
import SidebarHelper from "./action/SidebarHelper";
|
import SidebarHelper from "./action/SidebarHelper";
|
||||||
|
import CommonUtils from "./utils/CommonUtils";
|
||||||
|
import Log from "./Log";
|
||||||
|
|
||||||
export class Common extends WuhuBase {
|
export class Common extends WuhuBase {
|
||||||
className = 'Common';
|
className = 'Common';
|
||||||
|
|
||||||
public resolve() {
|
public resolve() {
|
||||||
let glob = Common.glob;
|
let glob = Common.glob;
|
||||||
// 价格监控
|
// 价格监控
|
||||||
@ -37,5 +40,11 @@ export class Common extends WuhuBase {
|
|||||||
|
|
||||||
// 公司助手
|
// 公司助手
|
||||||
CompanyHelper.getInstance();
|
CompanyHelper.getInstance();
|
||||||
|
|
||||||
|
// 自定义CSS
|
||||||
|
if (WuhuConfig.get('CustomCss')) {
|
||||||
|
Log.info('应用自定义CSS');
|
||||||
|
CommonUtils.addStyle(WuhuConfig.get('CustomCss'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18,6 +18,7 @@ import StackHelper from "./action/StackHelper";
|
|||||||
import BuyBeerHelper from "./action/BuyBeerHelper";
|
import BuyBeerHelper from "./action/BuyBeerHelper";
|
||||||
import XZMZ from "./action/XZMZ";
|
import XZMZ from "./action/XZMZ";
|
||||||
import ProfileHelper from "./action/ProfileHelper";
|
import ProfileHelper from "./action/ProfileHelper";
|
||||||
|
import SearchHelper from "./action/SearchHelper";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO 去除jq
|
* TODO 去除jq
|
||||||
@ -252,5 +253,8 @@ 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();
|
||||||
|
|
||||||
|
// 搜索助手
|
||||||
|
if (href.includes('page.php?sid=UserList')) SearchHelper.getInstance().init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,6 +113,8 @@ export default class WuhuConfig extends WuhuBase {
|
|||||||
{ key: 'HideSidebar', val: false },
|
{ key: 'HideSidebar', val: false },
|
||||||
// 添加隐藏边栏按钮
|
// 添加隐藏边栏按钮
|
||||||
{ key: 'HideSidebarBtn', val: true },
|
{ key: 'HideSidebarBtn', val: true },
|
||||||
|
// 搜索页占位区
|
||||||
|
{ key: 'SearchPagePlaceholder', val: true },
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 危险行为⚠️
|
* 危险行为⚠️
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
import loadGS from "../func/module/loadGS";
|
|
||||||
import adHelper from "../func/module/adHelper";
|
import adHelper from "../func/module/adHelper";
|
||||||
import safeKeeper from "../func/module/safeKeeper";
|
import safeKeeper from "../func/module/safeKeeper";
|
||||||
import initMiniProf from "../func/utils/initMiniProf";
|
import initMiniProf from "../func/utils/initMiniProf";
|
||||||
import WuhuBase from "./WuhuBase";
|
import WuhuBase from "./WuhuBase";
|
||||||
import Log from "./Log";
|
import Log from "./Log";
|
||||||
import CommonUtils from "./utils/CommonUtils";
|
import CommonUtils from "./utils/CommonUtils";
|
||||||
import WuhuConfig from "./WuhuConfig";
|
|
||||||
import Alert from "./utils/Alert";
|
import Alert from "./utils/Alert";
|
||||||
import * as EVENTS from "../static/json/event.json";
|
import * as EVENTS from "../static/json/event.json";
|
||||||
import * as FEST from "../static/json/fest.json";
|
import * as FEST from "../static/json/fest.json";
|
||||||
@ -15,15 +13,12 @@ import ZHONG_MENU_HTML from "../static/html/zhong/zhong_menu.html";
|
|||||||
import ZHONG_UPDATE_HTML from "../static/html/zhong/zhong_update.html";
|
import ZHONG_UPDATE_HTML from "../static/html/zhong/zhong_update.html";
|
||||||
import ZHONG_LOOT_HTML from "../static/html/zhong/zhong_loot.html";
|
import ZHONG_LOOT_HTML from "../static/html/zhong/zhong_loot.html";
|
||||||
import Test from "../test/Test";
|
import Test from "../test/Test";
|
||||||
import TornStyleSwitch from "./utils/TornStyleSwitch";
|
|
||||||
import Global from "./Global";
|
import Global from "./Global";
|
||||||
import Timer from "./utils/Timer";
|
import Timer from "./utils/Timer";
|
||||||
import DialogMsgBox from "./utils/DialogMsgBox";
|
|
||||||
import QuickFlyBtnHandler from "./handler/QuickFlyBtnHandler";
|
import QuickFlyBtnHandler from "./handler/QuickFlyBtnHandler";
|
||||||
import NNB from "./handler/NNB";
|
import NNB from "./handler/NNB";
|
||||||
import QuickLinksHandler from "./handler/QuickLinksHandler";
|
import QuickLinksHandler from "./handler/QuickLinksHandler";
|
||||||
import ItemPriceWatcherHandler from "./handler/ItemPriceWatcherHandler";
|
import ItemPriceWatcherHandler from "./handler/ItemPriceWatcherHandler";
|
||||||
import IFrameCrimeHandler from "./handler/IFrameCrimeHandler";
|
|
||||||
import ChangeLogHandler from "./handler/ChangeLogHandler";
|
import ChangeLogHandler from "./handler/ChangeLogHandler";
|
||||||
import SettingsHandler from "./handler/SettingsHandler";
|
import SettingsHandler from "./handler/SettingsHandler";
|
||||||
|
|
||||||
@ -249,13 +244,6 @@ export default class ZhongIcon extends WuhuBase {
|
|||||||
domId: 'wh-trans-event-cont',
|
domId: 'wh-trans-event-cont',
|
||||||
domHTML: eventObj.html,
|
domHTML: eventObj.html,
|
||||||
});
|
});
|
||||||
// 飞花库存
|
|
||||||
list.push({
|
|
||||||
domType: 'button',
|
|
||||||
domId: 'wh-foreign-stock-btn',
|
|
||||||
domText: '🌸 飞花库存',
|
|
||||||
clickFunc: () => TravelItem.getInstance().clickHandler().then(),
|
|
||||||
});
|
|
||||||
// 一键起飞
|
// 一键起飞
|
||||||
list.push({
|
list.push({
|
||||||
domType: 'button',
|
domType: 'button',
|
||||||
@ -263,6 +251,13 @@ export default class ZhongIcon extends WuhuBase {
|
|||||||
domText: '✈️ 一键起飞',
|
domText: '✈️ 一键起飞',
|
||||||
clickFunc: () => QuickFlyBtnHandler.getInstance().handle(),
|
clickFunc: () => QuickFlyBtnHandler.getInstance().handle(),
|
||||||
});
|
});
|
||||||
|
// 飞花库存
|
||||||
|
list.push({
|
||||||
|
domType: 'button',
|
||||||
|
domId: 'wh-foreign-stock-btn',
|
||||||
|
domText: '🌸 飞花库存',
|
||||||
|
clickFunc: () => TravelItem.getInstance().clickHandler().then(),
|
||||||
|
});
|
||||||
// NPC LOOT
|
// NPC LOOT
|
||||||
list.push({
|
list.push({
|
||||||
domType: 'button',
|
domType: 'button',
|
||||||
@ -289,13 +284,14 @@ export default class ZhongIcon extends WuhuBase {
|
|||||||
clickFunc: () => QuickLinksHandler.getInstance().handle()
|
clickFunc: () => QuickLinksHandler.getInstance().handle()
|
||||||
});
|
});
|
||||||
// 飞贼
|
// 飞贼
|
||||||
list.push({
|
// list.push({
|
||||||
domType: 'button',
|
// domType: 'button',
|
||||||
domId: 'wh-gs-btn',
|
// domId: 'wh-gs-btn',
|
||||||
domText: '🐏 飞贼小助手',
|
// domText: '🐏 飞贼小助手',
|
||||||
clickFunc: () => loadGS(CommonUtils.getScriptEngine()),
|
// clickFunc: () => loadGS(CommonUtils.getScriptEngine()),
|
||||||
tip: '加载从PC端移植的伞佬的油猴版飞贼小助手',
|
// tip: '加载从PC端移植的伞佬的油猴版飞贼小助手',
|
||||||
});
|
// });
|
||||||
|
|
||||||
// 物品价格监视
|
// 物品价格监视
|
||||||
list.push({
|
list.push({
|
||||||
domType: 'button',
|
domType: 'button',
|
||||||
@ -303,32 +299,39 @@ export default class ZhongIcon extends WuhuBase {
|
|||||||
domText: '💊 价格监视',
|
domText: '💊 价格监视',
|
||||||
clickFunc: () => ItemPriceWatcherHandler.getInstance().handle()
|
clickFunc: () => ItemPriceWatcherHandler.getInstance().handle()
|
||||||
});
|
});
|
||||||
|
// 全屏
|
||||||
|
list.push({
|
||||||
|
domType: 'button', domId: '', domText: '🖥 进入全屏', clickFunc() {
|
||||||
|
document.documentElement.requestFullscreen().then();
|
||||||
|
}
|
||||||
|
});
|
||||||
// 小窗犯罪
|
// 小窗犯罪
|
||||||
list.push({
|
// list.push({
|
||||||
domType: 'button',
|
// domType: 'button',
|
||||||
domId: 'wh-crime-iframe-btn',
|
// domId: 'wh-crime-iframe-btn',
|
||||||
domText: '🤑 小窗犯罪',
|
// domText: '🤑 小窗犯罪',
|
||||||
clickFunc: () => IFrameCrimeHandler.getInstance().handle()
|
// clickFunc: () => IFrameCrimeHandler.getInstance().handle()
|
||||||
});
|
// });
|
||||||
// 危险行为开关⚠️
|
// 危险行为开关⚠️
|
||||||
list.push({
|
// list.push({
|
||||||
domType: 'button',
|
// domType: 'button',
|
||||||
domId: 'wh-danger-zone',
|
// domId: 'wh-danger-zone',
|
||||||
domText: '⚠️ 危险功能',
|
// domText: '⚠️ 危险功能',
|
||||||
clickFunc: () => {
|
// clickFunc: () => {
|
||||||
new DialogMsgBox(
|
// new DialogMsgBox(
|
||||||
`打开危险功能,使用这些功能可能会造成账号封禁<br/>${ new TornStyleSwitch('知道了,开启', WuhuConfig.get('dangerZone')).getHtml() }`,
|
// `打开危险功能,使用这些功能可能会造成账号封禁<br/>${ new TornStyleSwitch('知道了,开启', WuhuConfig.get('dangerZone')).getHtml() }`,
|
||||||
{
|
// {
|
||||||
callback(dom) {
|
// callback(dom) {
|
||||||
let before = WuhuConfig.get('dangerZone');
|
// let before = WuhuConfig.get('dangerZone');
|
||||||
let checked = dom.querySelector('input').checked
|
// let checked = dom.querySelector('input').checked
|
||||||
WuhuConfig.set('dangerZone', checked, true);
|
// WuhuConfig.set('dangerZone', checked, true);
|
||||||
if (!before && checked) window.location.reload();
|
// if (!before && checked) window.location.reload();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
)
|
// )
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
// 传单助手
|
// 传单助手
|
||||||
list.push({
|
list.push({
|
||||||
domType: 'button',
|
domType: 'button',
|
||||||
@ -349,7 +352,7 @@ export default class ZhongIcon extends WuhuBase {
|
|||||||
list.push({
|
list.push({
|
||||||
domType: 'button',
|
domType: 'button',
|
||||||
domId: '',
|
domId: '',
|
||||||
domText: '🌲寻找木桩',
|
domText: '🌲 寻找木桩',
|
||||||
clickFunc: () => window.location.href = 'https://www.torn.com/item.php?temp=4#xunzhaomuzhuang'
|
clickFunc: () => window.location.href = 'https://www.torn.com/item.php?temp=4#xunzhaomuzhuang'
|
||||||
});
|
});
|
||||||
// 更新历史
|
// 更新历史
|
||||||
@ -406,6 +409,7 @@ export interface MenuItemConfig {
|
|||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
isHide?: boolean;
|
isHide?: boolean;
|
||||||
|
isTornBtn?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EventWrapper {
|
interface EventWrapper {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import CommonUtils from "../utils/CommonUtils";
|
|||||||
import FetchUtils from "../utils/FetchUtils";
|
import FetchUtils from "../utils/FetchUtils";
|
||||||
import InfoUtils from "../utils/InfoUtils";
|
import InfoUtils from "../utils/InfoUtils";
|
||||||
import Alert from "../utils/Alert";
|
import Alert from "../utils/Alert";
|
||||||
|
import TRAVEL_STATE from "../../enum/TravelState";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司助手
|
* 公司助手
|
||||||
@ -34,6 +35,9 @@ export default class CompanyHelper extends WuhuBase {
|
|||||||
// 检测是否过了一天
|
// 检测是否过了一天
|
||||||
if (CommonUtils.getInstance().isNewDay(lastDetect, -6)) {
|
if (CommonUtils.getInstance().isNewDay(lastDetect, -6)) {
|
||||||
WuhuConfig.set('CHTrainsDetect', Date.now());
|
WuhuConfig.set('CHTrainsDetect', Date.now());
|
||||||
|
let travelStage = CommonUtils.getInstance().getTravelStage(),
|
||||||
|
userStatus = (await InfoUtils.getInstance().getUserState()).status;
|
||||||
|
if (travelStage === TRAVEL_STATE.IN_TORN && userStatus === 'ok')
|
||||||
FetchUtils.getInstance().fetchText('/companies.php')
|
FetchUtils.getInstance().fetchText('/companies.php')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
let tmp: HTMLElement = document.createElement('div');
|
let tmp: HTMLElement = document.createElement('div');
|
||||||
@ -54,6 +58,7 @@ export default class CompanyHelper extends WuhuBase {
|
|||||||
Log.error('火车检测出错', error);
|
Log.error('火车检测出错', error);
|
||||||
WuhuConfig.set('CHTrainsDetect', 0);
|
WuhuConfig.set('CHTrainsDetect', 0);
|
||||||
});
|
});
|
||||||
|
else Log.warn('[火车检测] 用户状态错误,跳过火车检测', { travelStage, userStatus });
|
||||||
} else {
|
} else {
|
||||||
Log.info('火车检测:今日已提醒,跳过');
|
Log.info('火车检测:今日已提醒,跳过');
|
||||||
}
|
}
|
||||||
|
|||||||
36
src/class/action/SearchHelper.ts
Normal file
36
src/class/action/SearchHelper.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import WuhuBase from "../WuhuBase";
|
||||||
|
import TornStyleBlock from "../utils/TornStyleBlock";
|
||||||
|
import TornStyleSwitch from "../utils/TornStyleSwitch";
|
||||||
|
import CommonUtils from "../utils/CommonUtils";
|
||||||
|
import WuhuConfig from "../WuhuConfig";
|
||||||
|
|
||||||
|
export default class SearchHelper extends WuhuBase {
|
||||||
|
className = 'SearchHelper';
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public init(): void {
|
||||||
|
let block = new TornStyleBlock('搜索助手');
|
||||||
|
let placeholderSwitch = new TornStyleSwitch('底部空白占位区');
|
||||||
|
block.append(placeholderSwitch.getBase()).insert2Dom();
|
||||||
|
CommonUtils.addStyle('body.WHSearchPagePlaceholder .content.logged-in {margin-bottom: 340px;}');
|
||||||
|
let config = WuhuConfig.get('SearchPagePlaceholder');
|
||||||
|
placeholderSwitch.getInput().checked = config || false;
|
||||||
|
config ? this.enable() : this.disable();
|
||||||
|
placeholderSwitch.getInput().addEventListener('change', () => {
|
||||||
|
placeholderSwitch.getInput().checked ? this.enable() : this.disable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private enable(): void {
|
||||||
|
document.body.classList.add('WHSearchPagePlaceholder');
|
||||||
|
WuhuConfig.set('SearchPagePlaceholder', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private disable(): void {
|
||||||
|
document.body.classList.remove('WHSearchPagePlaceholder');
|
||||||
|
WuhuConfig.set('SearchPagePlaceholder', false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,16 +2,40 @@ import WuhuBase from "../WuhuBase";
|
|||||||
import Popup from "../utils/Popup";
|
import Popup from "../utils/Popup";
|
||||||
import Alert from "../utils/Alert";
|
import Alert from "../utils/Alert";
|
||||||
import DialogMsgBox from "../utils/DialogMsgBox";
|
import DialogMsgBox from "../utils/DialogMsgBox";
|
||||||
|
import CommonUtils from "../utils/CommonUtils";
|
||||||
|
import { MenuItemConfig } from "../ZhongIcon";
|
||||||
|
import IFrameCrimeHandler from "./IFrameCrimeHandler";
|
||||||
|
import loadGS from "../../func/module/loadGS";
|
||||||
|
|
||||||
export default class AdditionalSettingsHandler extends WuhuBase {
|
export default class AdditionalSettingsHandler extends WuhuBase {
|
||||||
className = 'AdditionalSettingsHandler';
|
className = 'AdditionalSettingsHandler';
|
||||||
|
|
||||||
public handle(): void {
|
public handle(): void {
|
||||||
let pop = new Popup('', '更多设定');
|
let pop = new Popup('', '更多设定');
|
||||||
let insertHtml = '<p><button class="torn-btn">清空设置</button></p><p><button class="torn-btn">通知权限</button></p><p><button class="torn-btn">外部数据权限</button></p>';
|
// let insertHtml = '<p><button class="torn-btn">清空设置</button></p><p><button class="torn-btn">通知权限</button></p><p><button class="torn-btn">外部数据权限</button></p>';
|
||||||
pop.getElement().insertAdjacentHTML('beforeend', insertHtml);
|
// pop.getElement().insertAdjacentHTML('beforeend', insertHtml);
|
||||||
let [btn1, btn2, btn3] = Array.from(pop.getElement().querySelectorAll('button'));
|
// let [btn1, btn2, btn3] = Array.from(pop.getElement().querySelectorAll('button'));
|
||||||
btn1.addEventListener('click', () => {
|
// btn1.addEventListener('click', () => {
|
||||||
|
// new DialogMsgBox('将清空所有芜湖助手相关设置并刷新页面,确定?', {
|
||||||
|
// callback: () => {
|
||||||
|
// localStorage.removeItem('wh_trv_alarm');
|
||||||
|
// localStorage.removeItem('wh_trans_settings');
|
||||||
|
// localStorage.removeItem('whuuid');
|
||||||
|
// localStorage.removeItem('wh-gs-storage');
|
||||||
|
// localStorage.removeItem('WHTEST');
|
||||||
|
// new Alert('已清空,刷新页面');
|
||||||
|
// window.location.reload();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// btn2.addEventListener('click', () => {
|
||||||
|
// });
|
||||||
|
// btn3.addEventListener('click', () => {
|
||||||
|
// });
|
||||||
|
|
||||||
|
let menuList: MenuItemConfig[] = [
|
||||||
|
{
|
||||||
|
domType: 'button', domId: '', domText: '清空设置', clickFunc() {
|
||||||
new DialogMsgBox('将清空所有芜湖助手相关设置并刷新页面,确定?', {
|
new DialogMsgBox('将清空所有芜湖助手相关设置并刷新页面,确定?', {
|
||||||
callback: () => {
|
callback: () => {
|
||||||
localStorage.removeItem('wh_trv_alarm');
|
localStorage.removeItem('wh_trv_alarm');
|
||||||
@ -23,10 +47,31 @@ export default class AdditionalSettingsHandler extends WuhuBase {
|
|||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
btn2.addEventListener('click', () => {
|
},
|
||||||
});
|
{
|
||||||
btn3.addEventListener('click', () => {
|
domType: "button", domId: '', domText: '通知权限', clickFunc() {
|
||||||
});
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
domType: 'button', domId: '', domText: '第三方API通信权限', clickFunc() {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
domType: 'button', domId: '', domText: '小窗犯罪', clickFunc() {
|
||||||
|
IFrameCrimeHandler.getInstance().handle()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
domType: 'button',
|
||||||
|
domId: '',
|
||||||
|
domText: '飞贼小助手',
|
||||||
|
tip: '加载从PC端移植的伞佬的油猴版飞贼小助手',
|
||||||
|
clickFunc() {
|
||||||
|
loadGS(CommonUtils.getScriptEngine())
|
||||||
|
}
|
||||||
|
},
|
||||||
|
];
|
||||||
|
menuList.forEach(i => pop.getElement().append(CommonUtils.getInstance().elemGenerator(i, pop.getElement())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
21
src/class/handler/CustomCssHandler.ts
Normal file
21
src/class/handler/CustomCssHandler.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import WuhuBase from "../WuhuBase";
|
||||||
|
import Popup from "../utils/Popup";
|
||||||
|
import WuhuConfig from "../WuhuConfig";
|
||||||
|
|
||||||
|
export default class CustomCssHandler extends WuhuBase {
|
||||||
|
className = 'CustomCssHandler';
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public handle(): void {
|
||||||
|
let pop = new Popup('<div><textarea></textarea><button class="torn-btn">保存</button><style>#wh-popup textarea{display: block;}</style></div>', '自定义CSS');
|
||||||
|
let textarea = pop.getElement().querySelector('textarea');
|
||||||
|
let button = pop.getElement().querySelector('button');
|
||||||
|
textarea.value = WuhuConfig.get('CustomCss') || '';
|
||||||
|
button.addEventListener('click', () => {
|
||||||
|
WuhuConfig.set('CustomCss', textarea.value || '', true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,6 +10,7 @@ import ViewLogsHandler from "./ViewLogsHandler";
|
|||||||
import AdditionalSettingsHandler from "./AdditionalSettingsHandler";
|
import AdditionalSettingsHandler from "./AdditionalSettingsHandler";
|
||||||
import Popup from "../utils/Popup";
|
import Popup from "../utils/Popup";
|
||||||
import CommonUtils from "../utils/CommonUtils";
|
import CommonUtils from "../utils/CommonUtils";
|
||||||
|
import CustomCssHandler from "./CustomCssHandler";
|
||||||
|
|
||||||
export default class SettingsHandler extends WuhuBase {
|
export default class SettingsHandler extends WuhuBase {
|
||||||
className = 'SettingsHandler';
|
className = 'SettingsHandler';
|
||||||
@ -93,6 +94,7 @@ export default class SettingsHandler extends WuhuBase {
|
|||||||
domType: 'button',
|
domType: 'button',
|
||||||
domId: '',
|
domId: '',
|
||||||
domText: '更新翻译词库',
|
domText: '更新翻译词库',
|
||||||
|
isTornBtn: true,
|
||||||
clickFunc: () => UpdateTranslateDict.getInstance().handle()
|
clickFunc: () => UpdateTranslateDict.getInstance().handle()
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -277,7 +279,10 @@ export default class SettingsHandler extends WuhuBase {
|
|||||||
tip: '海外落地后每30秒通知警告',
|
tip: '海外落地后每30秒通知警告',
|
||||||
});
|
});
|
||||||
// 落地转跳
|
// 落地转跳
|
||||||
list.push({ domType: 'button', domId: '', domText: '落地转跳', clickFunc: landedRedirect });
|
list.push({
|
||||||
|
domType: 'button', domId: '',
|
||||||
|
isTornBtn: true, domText: '落地转跳', clickFunc: landedRedirect
|
||||||
|
});
|
||||||
|
|
||||||
// 公司
|
// 公司
|
||||||
list.push({
|
list.push({
|
||||||
@ -338,7 +343,7 @@ export default class SettingsHandler extends WuhuBase {
|
|||||||
list.push({
|
list.push({
|
||||||
domType: 'checkbox',
|
domType: 'checkbox',
|
||||||
domId: 'wh-qua-alarm-check',
|
domId: 'wh-qua-alarm-check',
|
||||||
domText: '<span> 啤酒提醒 </span><button id="wh-qua-alarm-check-btn">今日不提醒</button>',
|
domText: '<span> 啤酒提醒 </span><button id="wh-qua-alarm-check-btn" class="torn-btn">今日不提醒</button>',
|
||||||
dictName: '_15Alarm',
|
dictName: '_15Alarm',
|
||||||
tip: '每小时的整15分钟的倍数时通知提醒抢啤酒或者血包',
|
tip: '每小时的整15分钟的倍数时通知提醒抢啤酒或者血包',
|
||||||
isHide: true,
|
isHide: true,
|
||||||
@ -350,6 +355,7 @@ export default class SettingsHandler extends WuhuBase {
|
|||||||
list.push({
|
list.push({
|
||||||
domType: 'button',
|
domType: 'button',
|
||||||
domId: '',
|
domId: '',
|
||||||
|
isTornBtn: true,
|
||||||
domText: '啤酒提醒状态',
|
domText: '啤酒提醒状态',
|
||||||
clickFunc: function () {
|
clickFunc: function () {
|
||||||
new Alert(`啤酒提醒${ beer.status() }`);
|
new Alert(`啤酒提醒${ beer.status() }`);
|
||||||
@ -360,6 +366,7 @@ export default class SettingsHandler extends WuhuBase {
|
|||||||
domType: 'button',
|
domType: 'button',
|
||||||
domId: '',
|
domId: '',
|
||||||
domText: '啤酒提醒时间设定',
|
domText: '啤酒提醒时间设定',
|
||||||
|
isTornBtn: true,
|
||||||
// tip: '通知提前时间',
|
// tip: '通知提前时间',
|
||||||
clickFunc: () => BuyBeerHelper.getInstance().setTimeHandler()
|
clickFunc: () => BuyBeerHelper.getInstance().setTimeHandler()
|
||||||
});
|
});
|
||||||
@ -460,6 +467,13 @@ export default class SettingsHandler extends WuhuBase {
|
|||||||
tip: 'PT市场页面购买时跳过确认',
|
tip: 'PT市场页面购买时跳过确认',
|
||||||
isHide: true,
|
isHide: true,
|
||||||
});
|
});
|
||||||
|
// 搜索页空白占位区
|
||||||
|
list.push({
|
||||||
|
domType: 'checkbox',
|
||||||
|
domId: null,
|
||||||
|
domText: ' 搜索页空白占位区',
|
||||||
|
dictName: 'SearchPagePlaceholder',
|
||||||
|
});
|
||||||
// 清除多余的脚本
|
// 清除多余的脚本
|
||||||
// list.push({
|
// list.push({
|
||||||
// domType: 'checkbox',
|
// domType: 'checkbox',
|
||||||
@ -468,6 +482,7 @@ export default class SettingsHandler extends WuhuBase {
|
|||||||
// dictName: 'removeScripts',
|
// dictName: 'removeScripts',
|
||||||
// tip: '清除Google相关脚本、顶部横幅等',
|
// tip: '清除Google相关脚本、顶部横幅等',
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// dev
|
// dev
|
||||||
list.push({
|
list.push({
|
||||||
domType: 'checkbox',
|
domType: 'checkbox',
|
||||||
@ -477,15 +492,25 @@ export default class SettingsHandler extends WuhuBase {
|
|||||||
isHide: true,
|
isHide: true,
|
||||||
});
|
});
|
||||||
// 查看logs
|
// 查看logs
|
||||||
|
list.push({
|
||||||
|
domType: 'button',
|
||||||
|
domId: null,
|
||||||
|
domText: '自定义CSS',
|
||||||
|
isTornBtn: true,
|
||||||
|
clickFunc: () => CustomCssHandler.getInstance().handle()
|
||||||
|
});
|
||||||
|
// 查看logs
|
||||||
list.push({
|
list.push({
|
||||||
domType: 'button',
|
domType: 'button',
|
||||||
domId: null,
|
domId: null,
|
||||||
domText: '查看日志',
|
domText: '查看日志',
|
||||||
|
isTornBtn: true,
|
||||||
clickFunc: () => ViewLogsHandler.getInstance().handle()
|
clickFunc: () => ViewLogsHandler.getInstance().handle()
|
||||||
});
|
});
|
||||||
// 更多设定
|
// 更多设定
|
||||||
list.push({
|
list.push({
|
||||||
domType: 'button', domId: 'wh-otherBtn', domText: '更多设定',
|
domType: 'button', domId: 'wh-otherBtn', domText: '更多设定',
|
||||||
|
isTornBtn: true,
|
||||||
clickFunc: () => AdditionalSettingsHandler.getInstance().handle()
|
clickFunc: () => AdditionalSettingsHandler.getInstance().handle()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -277,11 +277,12 @@ export default class CommonUtils extends WuhuBase {
|
|||||||
}
|
}
|
||||||
case 'button': {
|
case 'button': {
|
||||||
new_node = document.createElement('div');
|
new_node = document.createElement('div');
|
||||||
let { domId, domText, clickFunc } = setting;
|
let { domId, domText, isTornBtn, clickFunc } = setting;
|
||||||
let btn = document.createElement('button');
|
let btn = document.createElement('button');
|
||||||
(tip) && (btn.setAttribute('title', tip));
|
(tip) && (btn.setAttribute('title', tip));
|
||||||
btn.id = domId;
|
btn.id = domId;
|
||||||
btn.innerHTML = domText;
|
btn.innerHTML = domText;
|
||||||
|
if (isTornBtn) btn.classList.add('torn-btn');
|
||||||
btn.addEventListener('click', clickFunc);
|
btn.addEventListener('click', clickFunc);
|
||||||
new_node.appendChild(btn);
|
new_node.appendChild(btn);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -140,12 +140,12 @@ div#wh-popup::after {
|
|||||||
margin: 2px 0;
|
margin: 2px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#wh-popup-cont .gSetting button {
|
/*#wh-popup-cont .gSetting button {*/
|
||||||
cursor: pointer;
|
/* cursor: pointer;*/
|
||||||
border: 0;
|
/* border: 0;*/
|
||||||
color: #2196f3;
|
/* color: #2196f3;*/
|
||||||
padding: 2px;
|
/* padding: 2px;*/
|
||||||
}
|
/*}*/
|
||||||
|
|
||||||
#wh-popup-cont p {
|
#wh-popup-cont p {
|
||||||
padding: 0.25em 0;
|
padding: 0.25em 0;
|
||||||
@ -165,7 +165,7 @@ div#wh-popup::after {
|
|||||||
padding: 0.5em 0;
|
padding: 0.5em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#wh-popup-cont button {
|
#wh-popup-cont button:not(.torn-btn) {
|
||||||
margin: 0 4px 0 0;
|
margin: 0 4px 0 0;
|
||||||
padding: 5px 8px;
|
padding: 5px 8px;
|
||||||
border: solid 2px black;
|
border: solid 2px black;
|
||||||
@ -201,6 +201,13 @@ div#wh-popup::after {
|
|||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#wh-popup-cont textarea {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 4em;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.wh-display-none {
|
.wh-display-none {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import WuhuBase from "../class/WuhuBase";
|
import WuhuBase from "../class/WuhuBase";
|
||||||
import Log from "../class/Log";
|
import Log from "../class/Log";
|
||||||
import CommonUtils from "../class/utils/CommonUtils";
|
import CommonUtils from "../class/utils/CommonUtils";
|
||||||
import TornStyleBlock from "../class/utils/TornStyleBlock";
|
|
||||||
import Popup from "../class/utils/Popup";
|
import Popup from "../class/utils/Popup";
|
||||||
|
|
||||||
export default class Test extends WuhuBase {
|
export default class Test extends WuhuBase {
|
||||||
@ -51,6 +50,6 @@ export default class Test extends WuhuBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async case3() {
|
private async case3() {
|
||||||
new TornStyleBlock('1').insert2Dom();
|
// CustomCssHandler.getInstance().handle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user