userscript...

This commit is contained in:
Gabe Yuan
2023-08-05 20:21:45 +08:00
parent b5f1da18a6
commit cc04e817da
3 changed files with 8 additions and 5 deletions

View File

@@ -113,7 +113,7 @@ const userscriptWebpack = (config, env) => {
];
config.entry = {
index: paths.appSrc + "/userscriptOptions.js",
"kiss-translator-options": paths.appSrc + "/userscriptOptions.js",
"kiss-translator.user": paths.appSrc + "/userscript.js",
};
@@ -129,9 +129,9 @@ const userscriptWebpack = (config, env) => {
config.plugins.push(
new HtmlWebpackPlugin({
inject: true,
chunks: ["index"],
chunks: ["kiss-translator-options"],
template: paths.appHtml,
filename: "index.html",
filename: "kiss-translator-options.html",
}),
new webpack.BannerPlugin({
banner,

View File

@@ -18,7 +18,7 @@ import { Translator } from "./libs/translator";
*/
(async () => {
// 设置页面
if (document.location.href.includes("localhost:3000")) {
if (document.location.href.includes("kiss-translator-options")) {
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>

View File

@@ -21,7 +21,10 @@ const App = () => {
return (
<div style={{ textAlign: "center" }}>
<p>KISS Translator userscript is disabled at this browser!</p>
<p>
<a href={process.env.REACT_APP_HOMEPAGE}>KISS Translator</a> Script not
installed or disabled!
</p>
<p>
<a href={process.env.REACT_APP_HOMEPAGE}>Click here read more!</a>
</p>