From 3e96540b56607fcbdf7dd4465f21d1af47a3db83 Mon Sep 17 00:00:00 2001 From: Gabe Yuan Date: Sat, 7 Oct 2023 15:08:10 +0800 Subject: [PATCH] fix createCache options key --- src/content.js | 5 +++-- src/userscript.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/content.js b/src/content.js index e38be56..7aa283e 100644 --- a/src/content.js +++ b/src/content.js @@ -9,6 +9,7 @@ import { MSG_TRANS_TOGGLE_STYLE, MSG_TRANS_GETRULE, MSG_TRANS_PUTRULE, + APP_LCNAME, } from "./config"; import { getSettingWithDefault, @@ -93,7 +94,7 @@ const init = async () => { const fab = await getFabWithDefault(); if (!fab.isHide) { const $action = document.createElement("div"); - $action.setAttribute("id", "kiss-translator"); + $action.setAttribute("id", APP_LCNAME); document.body.parentElement.appendChild($action); const shadowContainer = $action.attachShadow({ mode: "closed" }); const emotionRoot = document.createElement("style"); @@ -101,7 +102,7 @@ const init = async () => { shadowContainer.appendChild(emotionRoot); shadowContainer.appendChild(shadowRootElement); const cache = createCache({ - key: "kiss-translator", + key: APP_LCNAME, prepend: true, container: emotionRoot, }); diff --git a/src/userscript.js b/src/userscript.js index c1cf836..407b39b 100644 --- a/src/userscript.js +++ b/src/userscript.js @@ -15,6 +15,7 @@ import { MSG_TRANS_TOGGLE_STYLE, MSG_TRANS_GETRULE, MSG_TRANS_PUTRULE, + APP_LCNAME, } from "./config"; import { isIframe, sendIframeMsg, sendPrentMsg } from "./libs/iframe"; import { handlePing, injectScript } from "./libs/gm"; @@ -98,7 +99,7 @@ const init = async () => { // 浮球按钮 const fab = await getFabWithDefault(); const $action = document.createElement("div"); - $action.setAttribute("id", "kiss-translator"); + $action.setAttribute("id", APP_LCNAME); document.body.parentElement.appendChild($action); const shadowContainer = $action.attachShadow({ mode: "closed" }); const emotionRoot = document.createElement("style"); @@ -106,7 +107,7 @@ const init = async () => { shadowContainer.appendChild(emotionRoot); shadowContainer.appendChild(shadowRootElement); const cache = createCache({ - key: "kiss-translator", + key: APP_LCNAME, prepend: true, container: emotionRoot, });