fix userscript...
This commit is contained in:
1
.env
1
.env
@@ -5,3 +5,4 @@ REACT_APP_VERSION=1.3.9
|
|||||||
REACT_APP_HOMEPAGE=https://github.com/fishjar/kiss-translator
|
REACT_APP_HOMEPAGE=https://github.com/fishjar/kiss-translator
|
||||||
REACT_APP_OPTIONSPAGE=https://kiss-translator.rayjar.com/options
|
REACT_APP_OPTIONSPAGE=https://kiss-translator.rayjar.com/options
|
||||||
REACT_APP_OPTIONSPAGE2=https://fishjar.github.io/kiss-translator/options.html
|
REACT_APP_OPTIONSPAGE2=https://fishjar.github.io/kiss-translator/options.html
|
||||||
|
REACT_APP_OPTIONSPAGE_DEV=http://localhost:3000/options.html
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { Translator } from "./libs/translator";
|
|||||||
(async () => {
|
(async () => {
|
||||||
// 设置页面
|
// 设置页面
|
||||||
if (
|
if (
|
||||||
document.location.href.includes("http://localhost:3000/options.html") ||
|
document.location.href.includes(process.env.REACT_APP_OPTIONSPAGE_DEV) ||
|
||||||
document.location.href.includes(process.env.REACT_APP_OPTIONSPAGE) ||
|
document.location.href.includes(process.env.REACT_APP_OPTIONSPAGE) ||
|
||||||
document.location.href.includes(process.env.REACT_APP_OPTIONSPAGE2)
|
document.location.href.includes(process.env.REACT_APP_OPTIONSPAGE2)
|
||||||
) {
|
) {
|
||||||
@@ -24,6 +24,7 @@ import { Translator } from "./libs/translator";
|
|||||||
window.unsafeWindow.GM_setValue = window.GM_setValue;
|
window.unsafeWindow.GM_setValue = window.GM_setValue;
|
||||||
window.unsafeWindow.GM_getValue = window.GM_getValue;
|
window.unsafeWindow.GM_getValue = window.GM_getValue;
|
||||||
window.unsafeWindow.GM_deleteValue = window.GM_deleteValue;
|
window.unsafeWindow.GM_deleteValue = window.GM_deleteValue;
|
||||||
|
window.unsafeWindow.APP_NAME = process.env.REACT_APP_NAME;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default function Options() {
|
|||||||
let i = 0;
|
let i = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
if (window.GM) {
|
if (window.APP_NAME === process.env.REACT_APP_NAME) {
|
||||||
setReady(true);
|
setReady(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user