更新
This commit is contained in:
parent
44d6c283c7
commit
7d494b8757
926
misc/Christmas_Town_Helper_2.3.3_mobile.js
Normal file
926
misc/Christmas_Town_Helper_2.3.3_mobile.js
Normal file
File diff suppressed because one or more lines are too long
135
package-lock.json
generated
135
package-lock.json
generated
@ -4,6 +4,33 @@
|
|||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@rollup/plugin-typescript": {
|
||||||
|
"version": "8.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.5.0.tgz",
|
||||||
|
"integrity": "sha512-wMv1/scv0m/rXx21wD2IsBbJFba8wGF3ErJIr6IKRfRj49S85Lszbxb4DCo8iILpluTjk2GAAu9CoZt4G3ppgQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@rollup/pluginutils": "^3.1.0",
|
||||||
|
"resolve": "^1.17.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@rollup/pluginutils": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/estree": "0.0.39",
|
||||||
|
"estree-walker": "^1.0.1",
|
||||||
|
"picomatch": "^2.2.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@types/estree": {
|
||||||
|
"version": "0.0.39",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",
|
||||||
|
"integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/jquery": {
|
"@types/jquery": {
|
||||||
"version": "3.5.14",
|
"version": "3.5.14",
|
||||||
"resolved": "https://registry.npmmirror.com/@types/jquery/-/jquery-3.5.14.tgz",
|
"resolved": "https://registry.npmmirror.com/@types/jquery/-/jquery-3.5.14.tgz",
|
||||||
@ -25,10 +52,114 @@
|
|||||||
"integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==",
|
"integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"estree-walker": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"fsevents": {
|
||||||
|
"version": "2.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||||
|
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"function-bind": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"has": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"function-bind": "^1.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-core-module": {
|
||||||
|
"version": "2.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
|
||||||
|
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"has": "^1.0.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mime": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"opener": {
|
||||||
|
"version": "1.5.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
|
||||||
|
"integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"path-parse": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||||
|
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"picomatch": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
||||||
|
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"resolve": {
|
||||||
|
"version": "1.22.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
||||||
|
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"is-core-module": "^2.9.0",
|
||||||
|
"path-parse": "^1.0.7",
|
||||||
|
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rollup": {
|
||||||
|
"version": "2.79.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.0.tgz",
|
||||||
|
"integrity": "sha512-x4KsrCgwQ7ZJPcFA/SUu6QVcYlO7uRLfLAy0DSA4NS2eG8japdbpM50ToH7z4iObodRYOJ0soneF0iaQRJ6zhA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"fsevents": "~2.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rollup-plugin-serve": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/rollup-plugin-serve/-/rollup-plugin-serve-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-/9lnzylTMwbXNQUwWAO0DIxW145wl+rmikwFXgujLJ5N9bRfWcjP+qd1XM5wxSiw8ZlBAlFy/n2zRvzcG21bBw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"mime": ">=2.4.6",
|
||||||
|
"opener": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"supports-preserve-symlinks-flag": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"tslib": {
|
||||||
|
"version": "2.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
|
||||||
|
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "4.8.3",
|
"version": "4.8.3",
|
||||||
"resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.8.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.3.tgz",
|
||||||
"integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig=="
|
"integrity": "sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"uglify-js": {
|
"uglify-js": {
|
||||||
"version": "3.16.1",
|
"version": "3.16.1",
|
||||||
|
|||||||
12
package.json
12
package.json
@ -2,17 +2,21 @@
|
|||||||
"name": "wuhu-torn-helper",
|
"name": "wuhu-torn-helper",
|
||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"uglify-js": "^3.16.1",
|
"uglify-js": "^3.16.1"
|
||||||
"typescript": "*"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"release": "npm run minify && node build.js",
|
"release": "npm run minify && node build.js",
|
||||||
"minify": "uglifyjs wuhu-torn-helper.js -o release.min.user.js -m",
|
"minify": "uglifyjs wuhu-torn-helper.js -o release.min.user.js -m",
|
||||||
"serve": "",
|
"serve": "",
|
||||||
"build": ""
|
"build": "rollup -c"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@rollup/plugin-typescript": "^8.5.0",
|
||||||
"@types/jquery": "^3.5.14",
|
"@types/jquery": "^3.5.14",
|
||||||
"@types/node": "^18.0.6"
|
"@types/node": "^18.0.6",
|
||||||
|
"rollup": "^2.79.0",
|
||||||
|
"rollup-plugin-serve": "^2.0.1",
|
||||||
|
"tslib": "^2.4.0",
|
||||||
|
"typescript": "^4.8.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
11
rollup.config.js
Normal file
11
rollup.config.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import typescript from "@rollup/plugin-typescript";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: 'src/main.ts',
|
||||||
|
output: {
|
||||||
|
file: 'bundle.js',
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
typescript(),
|
||||||
|
],
|
||||||
|
};
|
||||||
@ -67,14 +67,14 @@ z-index:100001;
|
|||||||
notify.close();
|
notify.close();
|
||||||
notify = WHNotify('飞贼小助手已加载', { timeout: 1 });
|
notify = WHNotify('飞贼小助手已加载', { timeout: 1 });
|
||||||
const gsp: HTMLElement = _docu.querySelector('#gsp');
|
const gsp: HTMLElement = _docu.querySelector('#gsp');
|
||||||
const init = () => {
|
const thisRun = () => {
|
||||||
ifr.style.height = `${ gsp.offsetHeight + 10 }px`;
|
ifr.style.height = `${ gsp.offsetHeight + 10 }px`;
|
||||||
ifr.style.width = `${ gsp.offsetWidth + 20 }px`;
|
ifr.style.width = `${ gsp.offsetWidth + 20 }px`;
|
||||||
gsp.style.top = '10px';
|
gsp.style.top = '10px';
|
||||||
gsp.style.left = '10px';
|
gsp.style.left = '10px';
|
||||||
};
|
};
|
||||||
new MutationObserver(init).observe(gsp, { childList: true, subtree: true });
|
new MutationObserver(thisRun).observe(gsp, { childList: true, subtree: true });
|
||||||
init();
|
thisRun();
|
||||||
if (log.debug()) _window.GM_setValue("gsp_showContent", true)
|
if (log.debug()) _window.GM_setValue("gsp_showContent", true)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import log from "./log";
|
|||||||
// 跨域get请求 返回text
|
// 跨域get请求 返回text
|
||||||
export default function COFetch(url: URL | string, method: 'get' | 'post' = 'get', body: any = null): Promise<string> {
|
export default function COFetch(url: URL | string, method: 'get' | 'post' = 'get', body: any = null): Promise<string> {
|
||||||
return new Promise<string>((resolve, reject) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
const engine = getScriptEngine();
|
const engine = getScriptEngine(window.WHPARAMS);
|
||||||
switch (engine) {
|
switch (engine) {
|
||||||
case UserScriptEngine.RAW: {
|
case UserScriptEngine.RAW: {
|
||||||
console.error(`[wh] 跨域请求错误:${ UserScriptEngine.RAW }环境下无法进行跨域请求`);
|
console.error(`[wh] 跨域请求错误:${ UserScriptEngine.RAW }环境下无法进行跨域请求`);
|
||||||
|
|||||||
@ -2,8 +2,7 @@
|
|||||||
import uuidv4 from "./uuidv4";
|
import uuidv4 from "./uuidv4";
|
||||||
|
|
||||||
export default function WindowActiveState() {
|
export default function WindowActiveState() {
|
||||||
let glob = window.WHPARAMS;
|
if (self !== top) return null;
|
||||||
if (glob.isIframe) return null;
|
|
||||||
const uuid = uuidv4();
|
const uuid = uuidv4();
|
||||||
let isFocus = false;
|
let isFocus = false;
|
||||||
localStorage.setItem('whuuid', uuid);
|
localStorage.setItem('whuuid', uuid);
|
||||||
|
|||||||
@ -4,9 +4,8 @@ import popupMsg from "./popupMsg";
|
|||||||
import loading_gif_html from "./loading_gif_html";
|
import loading_gif_html from "./loading_gif_html";
|
||||||
|
|
||||||
// 海外库存
|
// 海外库存
|
||||||
export default async function forStock() {
|
export default async function forStock(glob) {
|
||||||
let glob = window.WHPARAMS;
|
if (getScriptEngine(glob) === UserScriptEngine.RAW) {
|
||||||
if (getScriptEngine() === UserScriptEngine.RAW) {
|
|
||||||
const insert = `<img alt="stock.png" src="https://jjins.github.io/t2i/stock.png?${ performance.now() }" style="max-width:100%;display:block;margin:0 auto;" />`;
|
const insert = `<img alt="stock.png" src="https://jjins.github.io/t2i/stock.png?${ performance.now() }" style="max-width:100%;display:block;margin:0 auto;" />`;
|
||||||
popupMsg(insert, '飞花库存');
|
popupMsg(insert, '飞花库存');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import UserScriptEngine from "../../enum/UserScriptEngine";
|
import UserScriptEngine from "../../enum/UserScriptEngine";
|
||||||
|
import Global from "../../interface/GlobalVars";
|
||||||
|
|
||||||
// 用户脚本平台类型
|
// 用户脚本平台类型
|
||||||
export default function () {
|
export default function getScriptEngine(glob:Global) {
|
||||||
let glob = window.WHPARAMS;
|
|
||||||
return glob.UWCopy ? UserScriptEngine.GM : glob.isPDA
|
return glob.UWCopy ? UserScriptEngine.GM : glob.isPDA
|
||||||
? UserScriptEngine.PDA : UserScriptEngine.RAW;
|
? UserScriptEngine.PDA : UserScriptEngine.RAW;
|
||||||
}
|
}
|
||||||
@ -1,13 +1,12 @@
|
|||||||
// 价格监视handle
|
|
||||||
import getWhSettingObj from "./getWhSettingObj";
|
import getWhSettingObj from "./getWhSettingObj";
|
||||||
import log from "./log";
|
import log from "./log";
|
||||||
import toThousands from "./toThousands";
|
import toThousands from "./toThousands";
|
||||||
import WHNotify from "./WHNotify";
|
import WHNotify from "./WHNotify";
|
||||||
|
import Global from "../../interface/GlobalVars";
|
||||||
|
|
||||||
let glob = window.WHPARAMS;
|
// 价格监视handle
|
||||||
let { isPDA, PDA_APIKey, priceWatcher } = glob;
|
export default function priceWatcherHandle(glob: Global) {
|
||||||
|
let { isPDA, PDA_APIKey, priceWatcher } = glob;
|
||||||
export default function priceWatcherHandle() {
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const price_conf = getWhSettingObj()['priceWatcher'];
|
const price_conf = getWhSettingObj()['priceWatcher'];
|
||||||
const apikey = isPDA ? PDA_APIKey : localStorage.getItem('APIKey');
|
const apikey = isPDA ? PDA_APIKey : localStorage.getItem('APIKey');
|
||||||
@ -15,14 +14,14 @@ export default function priceWatcherHandle() {
|
|||||||
log.info('无法获取APIKey')
|
log.info('无法获取APIKey')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (price_conf['pt'] !== -1) priceWatcherPt(apikey, price_conf['pt']).then();
|
if (price_conf['pt'] !== -1) priceWatcherPt(apikey, price_conf['pt'], priceWatcher).then();
|
||||||
if (price_conf['xan'] !== -1) priceWatcherXan(apikey, price_conf['xan']).then();
|
if (price_conf['xan'] !== -1) priceWatcherXan(apikey, price_conf['xan'], priceWatcher).then();
|
||||||
}, 10000)
|
}, 10000)
|
||||||
return { status: true };
|
return { status: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
// pt价格监视
|
// pt价格监视
|
||||||
async function priceWatcherPt(apikey, lower_price) {
|
async function priceWatcherPt(apikey, lower_price, priceWatcher: { status: boolean }) {
|
||||||
if (!priceWatcher['watch-pt-lower-id']) priceWatcher['watch-pt-lower-id'] = [];
|
if (!priceWatcher['watch-pt-lower-id']) priceWatcher['watch-pt-lower-id'] = [];
|
||||||
const res = await fetch('https://api.torn.com/market/?selections=pointsmarket&key=' + apikey);
|
const res = await fetch('https://api.torn.com/market/?selections=pointsmarket&key=' + apikey);
|
||||||
const obj = await res.json();
|
const obj = await res.json();
|
||||||
@ -53,7 +52,7 @@ async function priceWatcherPt(apikey, lower_price) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// xan价格监视
|
// xan价格监视
|
||||||
async function priceWatcherXan(apikey, lower_price) {
|
async function priceWatcherXan(apikey, lower_price, priceWatcher: { status: boolean }) {
|
||||||
// 初始化记录上一个条目的id,避免重复发送通知
|
// 初始化记录上一个条目的id,避免重复发送通知
|
||||||
if (!priceWatcher['watch-xan-lower-id']) priceWatcher['watch-xan-lower-id'] = '';
|
if (!priceWatcher['watch-xan-lower-id']) priceWatcher['watch-xan-lower-id'] = '';
|
||||||
const res = await fetch('https://api.torn.com/market/206?selections=bazaar&key=' + apikey);
|
const res = await fetch('https://api.torn.com/market/206?selections=bazaar&key=' + apikey);
|
||||||
|
|||||||
11
src/init.ts
11
src/init.ts
@ -1,4 +1,3 @@
|
|||||||
import '../global'
|
|
||||||
import log from "./func/utils/log";
|
import log from "./func/utils/log";
|
||||||
import getWhSettingObj from "./func/utils/getWhSettingObj";
|
import getWhSettingObj from "./func/utils/getWhSettingObj";
|
||||||
import miniprofTrans from "./func/translate/miniprofTrans";
|
import miniprofTrans from "./func/translate/miniprofTrans";
|
||||||
@ -15,16 +14,16 @@ import COFetch from "./func/utils/COFetch";
|
|||||||
// 初始化方法,获取必要全局参数
|
// 初始化方法,获取必要全局参数
|
||||||
export default function init(): Global {
|
export default function init(): Global {
|
||||||
let glob: Global = {
|
let glob: Global = {
|
||||||
window,
|
window: window,
|
||||||
UWCopy: window.unsafeWindow,
|
UWCopy: window.unsafeWindow,
|
||||||
version: '$$WUHU_DEV_VERSION$$',
|
version: '$$WUHU_DEV_VERSION$$',
|
||||||
isIframe: self !== top,
|
isIframe: self !== top,
|
||||||
PDA_APIKey: '###PDA-APIKEY###',
|
PDA_APIKey: '###PDA-APIKEY###',
|
||||||
isPDA: this.PDA_APIKey.slice(-1) !== '#',
|
isPDA: false,
|
||||||
device: window.innerWidth >= 1000 ? Device.PC : window.innerWidth <= 600 ? Device.MOBILE : Device.TABLET,
|
device: window.innerWidth >= 1000 ? Device.PC : window.innerWidth <= 600 ? Device.MOBILE : Device.TABLET,
|
||||||
player_info: getPlayerInfo(),
|
player_info: getPlayerInfo(),
|
||||||
fStock: autoFetchJSON('https://yata.yt/api/v1/travel/export/'),
|
fStock: autoFetchJSON('https://yata.yt/api/v1/travel/export/'),
|
||||||
priceWatcher: this.isIframe ? null : priceWatcherHandle(),
|
priceWatcher: null,
|
||||||
beer: BuyBeer(),
|
beer: BuyBeer(),
|
||||||
popup_node: null,
|
popup_node: null,
|
||||||
notifies: { count: 0 },
|
notifies: { count: 0 },
|
||||||
@ -32,7 +31,8 @@ export default function init(): Global {
|
|||||||
href: window.location.href,
|
href: window.location.href,
|
||||||
bodyAttrs: {},
|
bodyAttrs: {},
|
||||||
};
|
};
|
||||||
window.WHPARAMS = glob;
|
glob.isPDA = glob.PDA_APIKey.slice(-1) !== '#';
|
||||||
|
glob.priceWatcher = self !== top ? null : priceWatcherHandle(glob);
|
||||||
let UWCopy = null;
|
let UWCopy = null;
|
||||||
if (window.hasOwnProperty('unsafeWindow')) {
|
if (window.hasOwnProperty('unsafeWindow')) {
|
||||||
UWCopy = window.unsafeWindow;
|
UWCopy = window.unsafeWindow;
|
||||||
@ -41,6 +41,7 @@ export default function init(): Global {
|
|||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window.WHPARAMS = glob;
|
||||||
|
|
||||||
// 请求通知权限
|
// 请求通知权限
|
||||||
if (window.Notification && Notification.permission !== 'granted') {
|
if (window.Notification && Notification.permission !== 'granted') {
|
||||||
|
|||||||
@ -393,7 +393,7 @@ function getMenuItems(glob): MenuItemConfig[] {
|
|||||||
domText: '🌸 飞花库存',
|
domText: '🌸 飞花库存',
|
||||||
clickFunc: async function (e) {
|
clickFunc: async function (e) {
|
||||||
e.target.blur();
|
e.target.blur();
|
||||||
forStock().then();
|
forStock(glob).then();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// 一键起飞
|
// 一键起飞
|
||||||
@ -477,7 +477,7 @@ info{display:block;}
|
|||||||
});
|
});
|
||||||
node.querySelector('a').addEventListener('click', (e) => {
|
node.querySelector('a').addEventListener('click', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
forStock();
|
forStock(glob);
|
||||||
});
|
});
|
||||||
node.querySelector('input').addEventListener('click', (e) => {
|
node.querySelector('input').addEventListener('click', (e) => {
|
||||||
node.classList.toggle('wh-quick-fly-opt-hide');
|
node.classList.toggle('wh-quick-fly-opt-hide');
|
||||||
@ -724,7 +724,7 @@ background-size: 100% auto !important;
|
|||||||
domText: '🐏 飞贼小助手',
|
domText: '🐏 飞贼小助手',
|
||||||
clickFunc: function (e) {
|
clickFunc: function (e) {
|
||||||
e.target.blur();
|
e.target.blur();
|
||||||
loadGS(getScriptEngine());
|
loadGS(getScriptEngine(glob));
|
||||||
},
|
},
|
||||||
tip: '加载从PC端移植的伞佬的油猴版飞贼小助手',
|
tip: '加载从PC端移植的伞佬的油猴版飞贼小助手',
|
||||||
});
|
});
|
||||||
@ -960,7 +960,7 @@ background-size: 100% auto !important;
|
|||||||
<tr><td>URL</td><td>${ window.location.href }</td></tr>
|
<tr><td>URL</td><td>${ window.location.href }</td></tr>
|
||||||
<tr><td>页面尺寸</td><td>${ window.innerWidth }x${ window.innerHeight }</td></tr>
|
<tr><td>页面尺寸</td><td>${ window.innerWidth }x${ window.innerHeight }</td></tr>
|
||||||
<tr><td>设备类型</td><td>${ getDeviceType().toUpperCase() }</td></tr>
|
<tr><td>设备类型</td><td>${ getDeviceType().toUpperCase() }</td></tr>
|
||||||
<tr><td>脚本运行方式</td><td>${ { 'gm': '油猴', 'raw': '直接运行', 'pda': 'TornPDA' }[getScriptEngine()] }</td></tr>
|
<tr><td>脚本运行方式</td><td>${ { 'gm': '油猴', 'raw': '直接运行', 'pda': 'TornPDA' }[getScriptEngine(glob)] }</td></tr>
|
||||||
<tr><td>时间</td><td>${ date.getFullYear() }/${ date.getMonth() + 1 }/${ date.getDate() } ${ date.getHours() }:${ date.getMinutes() }:${ date.getSeconds() }</td></tr>
|
<tr><td>时间</td><td>${ date.getFullYear() }/${ date.getMonth() + 1 }/${ date.getDate() } ${ date.getHours() }:${ date.getMinutes() }:${ date.getSeconds() }</td></tr>
|
||||||
<tr><td>插件版本</td><td>${ glob.version }</td></tr>
|
<tr><td>插件版本</td><td>${ glob.version }</td></tr>
|
||||||
<tr><td>操作系统</td><td>${ os }</td></tr>
|
<tr><td>操作系统</td><td>${ os }</td></tr>
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
"es2015",
|
"es2015",
|
||||||
"ES2021.String"
|
"ES2021.String"
|
||||||
],
|
],
|
||||||
"target": "ES5",
|
"target": "ES6",
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user