fix: rules

This commit is contained in:
Gabe
2025-10-10 15:05:47 +08:00
parent e593221e02
commit 3844d2eb75
6 changed files with 31 additions and 7 deletions

View File

@@ -55,6 +55,7 @@ export const matchRule = async (href, { injectRules, subrulesList }) => {
"aiTerms",
"selectStyle",
"parentStyle",
"grandStyle",
"injectJs",
"injectCss",
// "fixerSelector",
@@ -138,6 +139,7 @@ export const checkRules = (rules) => {
aiTerms,
selectStyle,
parentStyle,
grandStyle,
injectJs,
injectCss,
apiSlug,
@@ -171,6 +173,7 @@ export const checkRules = (rules) => {
aiTerms: type(aiTerms) === "string" ? aiTerms : "",
selectStyle: type(selectStyle) === "string" ? selectStyle : "",
parentStyle: type(parentStyle) === "string" ? parentStyle : "",
grandStyle: type(grandStyle) === "string" ? grandStyle : "",
injectJs: type(injectJs) === "string" ? injectJs : "",
injectCss: type(injectCss) === "string" ? injectCss : "",
bgColor: type(bgColor) === "string" ? bgColor : "",

View File

@@ -960,6 +960,7 @@ export class Translator {
transOnly,
selectStyle,
parentStyle,
grandStyle,
// detectRemote,
// toLang,
// skipLangs = [],
@@ -1046,6 +1047,9 @@ export class Translator {
if (parentStyle && parentNode && parentNode.style) {
parentNode.style.cssText += parentStyle;
}
if (grandStyle && parentNode && parentNode.parentElement) {
parentNode.parentElement.style.cssText += grandStyle;
}
// 翻译完成钩子函数
if (transEndHook?.trim()) {