fix: add notranslate class

This commit is contained in:
Gabe
2025-10-14 11:13:03 +08:00
parent b63ef8c1aa
commit 0a1abab475
3 changed files with 7 additions and 5 deletions

View File

@@ -71,7 +71,8 @@ function runIframe(translator) {
async function showFab(translator) {
const fab = await getFabWithDefault();
const $action = document.createElement("div");
$action.setAttribute("id", APP_CONSTS.fabID);
$action.id = APP_CONSTS.fabID;
$action.className = "notranslate";
$action.style.fontSize = "0";
$action.style.width = "0";
$action.style.height = "0";
@@ -79,7 +80,7 @@ async function showFab(translator) {
const shadowContainer = $action.attachShadow({ mode: "closed" });
const emotionRoot = document.createElement("style");
const shadowRootElement = document.createElement("div");
shadowRootElement.classList.add(`${APP_CONSTS.fabID}_warpper`);
shadowRootElement.classList.add(`${APP_CONSTS.fabID}_warpper notranslate`);
shadowContainer.appendChild(emotionRoot);
shadowContainer.appendChild(shadowRootElement);
const cache = createCache({

View File

@@ -29,7 +29,8 @@ export class TransboxManager {
enable() {
if (!this.isEnabled()) {
this.#container = document.createElement("div");
this.#container.setAttribute("id", APP_CONSTS.boxID);
this.#container.id = APP_CONSTS.boxID;
this.#container.className = "notranslate";
this.#container.style.cssText =
"font-size: 0; width: 0; height: 0; border: 0; padding: 0; margin: 0;";
document.body.parentElement.appendChild(this.#container);
@@ -37,7 +38,7 @@ export class TransboxManager {
this.#shadowContainer = this.#container.attachShadow({ mode: "closed" });
const emotionRoot = document.createElement("style");
const shadowRootElement = document.createElement("div");
shadowRootElement.classList.add(`${APP_CONSTS.boxID}_warpper`);
shadowRootElement.classList.add(`${APP_CONSTS.boxID}_warpper notranslate`);
this.#shadowContainer.appendChild(emotionRoot);
this.#shadowContainer.appendChild(shadowRootElement);
const cache = createCache({

View File

@@ -160,7 +160,7 @@ export class Translator {
// 译文相关class
static KISS_CLASS = {
warpper: `${APP_LCNAME}-wrapper`,
warpper: `${APP_LCNAME}-wrapper notranslate`,
inner: `${APP_LCNAME}-inner`,
term: `${APP_LCNAME}-term`,
};