This commit is contained in:
Liwanyi 2022-10-01 15:38:24 +08:00
parent 60e2c96282
commit 842f69c691
8 changed files with 20 additions and 14 deletions

View File

@ -310,7 +310,7 @@ $<span class="total">1,000</span>
// 圣诞小镇
if (href.contains(/christmas_town\.php/)) {
let $root = document.querySelector('#christmastownroot');
const { xmasTownWT, xmasTownNotify } = getWhSettingObj()
const [xmasTownWT, xmasTownNotify] = WuhuConfig.get(['xmasTownWT', 'xmasTownNotify']);
// 解密攻略
if (xmasTownWT) {
const insert_html = `<div id="wh-xmas-cont">

View File

@ -3,8 +3,16 @@ import Alert from "./utils/Alert";
import Log from "./Log";
export default class WuhuConfig extends WuhuBase {
static get(key: string) {
return WuhuConfig.getLocal()[key];
static get(key: string | string[]) {
let localPool = this.getLocal();
if (typeof key === 'string') return localPool[key];
else {
let ret: string[] = [];
key.forEach(k => {
ret.push(localPool[k])
});
return ret;
}
}
static set(key: string, val: any, isNotify = false, callback: Function = () => null) {

View File

@ -3,7 +3,7 @@ import Log from "../Log";
import WuhuBase from "../WuhuBase";
import UserScriptEngine from "../../enum/UserScriptEngine";
import Popup from "../utils/Popup";
import * as STOCK_PNG from "../../json/github.io.stock.png.json";
import STOCK_IMG_HTML from "../../html/stock_img.html";
import * as FILTER from "../../json/ForStockItemFilter.json";
export default class TravelItem extends WuhuBase {
@ -35,7 +35,7 @@ export default class TravelItem extends WuhuBase {
// 呈现内容
public async clickHandler(): Promise<void> {
if (CommonUtils.getScriptEngine() === UserScriptEngine.RAW) {
new Popup(STOCK_PNG.html.replace('{{}}', performance.now().toString()), '飞花库存');
new Popup(STOCK_IMG_HTML.replace('{{}}', performance.now().toString()), '飞花库存');
} else {
const popup = new Popup("请稍后 " + CommonUtils.loading_gif_html(), '飞花库存');
let table = `<table><tr><th colspan="2">目的地 - 更新时间</th><th colspan="3">库存</th></tr>`;

View File

@ -4,7 +4,7 @@ import Log from "../Log";
import Device from "../../enum/Device";
import AjaxFetchOption from "../../interface/AjaxFetchOption";
import Alert from "./Alert";
import * as LOADING_JSON from "../../json/loading.json";
import LOADING_IMG_HTML from "../../html/loading_img.html";
export default class CommonUtils extends WuhuBase {
static getScriptEngine() {
@ -175,6 +175,6 @@ export default class CommonUtils extends WuhuBase {
}
static loading_gif_html(): string {
return LOADING_JSON.html;
return LOADING_IMG_HTML;
}
}

View File

@ -0,0 +1,3 @@
<img alt="LOADING"
src="data:image/svg+xml,%3Csvg t='1656084442571' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='3924' width='14' height='14'%3E%3Cpath d='M512.032002 237.105181a29.310168 29.310168 0 0 1-29.310168-29.246172V29.310168a29.310168 29.310168 0 0 1 58.620336 0v178.548841A29.310168 29.310168 0 0 1 512.032002 237.105181zM512.032002 1024a29.310168 29.310168 0 0 1-29.310168-29.310168v-178.484845a29.310168 29.310168 0 1 1 58.620336 0v178.548841A29.310168 29.310168 0 0 1 512.032002 1024z m482.657834-482.657834h-178.484845a29.310168 29.310168 0 1 1 0-58.620336h178.548841a29.310168 29.310168 0 1 1 0 58.620336z m-786.830823 0H29.310172a29.310168 29.310168 0 0 1 0-58.620336h178.548841a29.310168 29.310168 0 0 1 0 58.620336z m519.263546-215.090557a29.182176 29.182176 0 0 1-20.734704-49.980876l126.264108-126.264108a29.310168 29.310168 0 1 1 41.405412 41.405412l-126.264108 126.264108a29.182176 29.182176 0 0 1-20.670708 8.575464zM170.741333 882.568839a29.182176 29.182176 0 0 1-20.734704-49.980876l126.264108-126.264108a29.246172 29.246172 0 1 1 41.405412 41.405412L191.412041 874.057371a29.182176 29.182176 0 0 1-20.670708 8.575464z m682.581338 0a29.182176 29.182176 0 0 1-20.670708-8.575464l-126.264108-126.264108a29.310168 29.310168 0 1 1 41.405412-41.405412l126.264108 126.264108a29.310168 29.310168 0 0 1-20.734704 49.91688zM297.005441 326.251609a29.182176 29.182176 0 0 1-20.670708-8.575464L150.006629 191.412037a29.310168 29.310168 0 1 1 41.405412-41.405412l126.264108 126.264108a29.310168 29.310168 0 0 1-20.734704 49.91688z' p-id='3925'%3E%3C/path%3E%3C/svg%3E"
style="width:14px;height:14px;">

2
src/html/stock_img.html Normal file
View File

@ -0,0 +1,2 @@
<img alt="stock.png" src="https://jjins.github.io/t2i/stock.png?{{}}"
style="max-width:100%;display:block;margin:0 auto;"/>

View File

@ -1,3 +0,0 @@
{
"html": "<img alt=\"stock.png\" src=\"https://jjins.github.io/t2i/stock.png?{{}}\" style=\"max-width:100%;display:block;margin:0 auto;\" />"
}

View File

@ -1,4 +0,0 @@
{
"name": "loading gif html",
"html": "<img src=\"data:image/svg+xml,%3Csvg t='1656084442571' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='3924' width='14' height='14'%3E%3Cpath d='M512.032002 237.105181a29.310168 29.310168 0 0 1-29.310168-29.246172V29.310168a29.310168 29.310168 0 0 1 58.620336 0v178.548841A29.310168 29.310168 0 0 1 512.032002 237.105181zM512.032002 1024a29.310168 29.310168 0 0 1-29.310168-29.310168v-178.484845a29.310168 29.310168 0 1 1 58.620336 0v178.548841A29.310168 29.310168 0 0 1 512.032002 1024z m482.657834-482.657834h-178.484845a29.310168 29.310168 0 1 1 0-58.620336h178.548841a29.310168 29.310168 0 1 1 0 58.620336z m-786.830823 0H29.310172a29.310168 29.310168 0 0 1 0-58.620336h178.548841a29.310168 29.310168 0 0 1 0 58.620336z m519.263546-215.090557a29.182176 29.182176 0 0 1-20.734704-49.980876l126.264108-126.264108a29.310168 29.310168 0 1 1 41.405412 41.405412l-126.264108 126.264108a29.182176 29.182176 0 0 1-20.670708 8.575464zM170.741333 882.568839a29.182176 29.182176 0 0 1-20.734704-49.980876l126.264108-126.264108a29.246172 29.246172 0 1 1 41.405412 41.405412L191.412041 874.057371a29.182176 29.182176 0 0 1-20.670708 8.575464z m682.581338 0a29.182176 29.182176 0 0 1-20.670708-8.575464l-126.264108-126.264108a29.310168 29.310168 0 1 1 41.405412-41.405412l126.264108 126.264108a29.310168 29.310168 0 0 1-20.734704 49.91688zM297.005441 326.251609a29.182176 29.182176 0 0 1-20.670708-8.575464L150.006629 191.412037a29.310168 29.310168 0 1 1 41.405412-41.405412l126.264108 126.264108a29.310168 29.310168 0 0 1-20.734704 49.91688z' p-id='3925'%3E%3C/path%3E%3C/svg%3E\" alt=\"lgif\" style=\"width:14px;height:14px;\" />"
}