fix: Minimize the rule file

This commit is contained in:
Gabe
2025-10-01 22:46:55 +08:00
parent c993c15c92
commit d18b31692b
2 changed files with 3 additions and 3 deletions

View File

@@ -198,7 +198,7 @@ const RULES_MAP = {
export const BUILTIN_RULES = Object.entries(RULES_MAP)
.sort((a, b) => a[0].localeCompare(b[0]))
.map(([pattern, rule]) => ({
...DEFAULT_RULE,
// ...DEFAULT_RULE,
...rule,
pattern,
}));

View File

@@ -82,7 +82,7 @@ export const matchRule = async (href, { injectRules, subrulesList }) => {
// "detectRemote",
// "fixerFunc",
].forEach((key) => {
if (rule[key] === undefined || rule[key] === GLOBAL_KEY) {
if (!rule[key] || rule[key] === GLOBAL_KEY) {
rule[key] = globalRule[key];
}
});
@@ -90,7 +90,7 @@ export const matchRule = async (href, { injectRules, subrulesList }) => {
// if (!rule.skipLangs || rule.skipLangs.length === 0) {
// rule.skipLangs = globalRule.skipLangs;
// }
if (rule.textStyle === GLOBAL_KEY) {
if (!rule.textStyle || rule.textStyle === GLOBAL_KEY) {
rule.textStyle = globalRule.textStyle;
rule.bgColor = globalRule.bgColor;
rule.textDiyStyle = globalRule.textDiyStyle;