userscript...
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user