From 0c04ea3a336299d74a4d4d65fb51f928a9ea8f2b Mon Sep 17 00:00:00 2001 From: Gabe Date: Sun, 16 Nov 2025 15:00:49 +0800 Subject: [PATCH] fix: skip running in document content types --- src/common.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/common.js b/src/common.js index fb9887c..683481b 100644 --- a/src/common.js +++ b/src/common.js @@ -118,20 +118,22 @@ async function getFavWords(rule) { */ export async function run(isUserscript = false) { try { - // if (document?.documentElement?.tagName?.toUpperCase() !== "HTML") { - // return; - // } - if (!document?.contentType?.includes("text")) { - return; - } - // 读取设置信息 const setting = await getSettingWithDefault(); // 日志 logger.setLevel(setting.logLevel); - const href = document.location.href; + // if (document?.documentElement?.tagName?.toUpperCase() !== "HTML") { + // return; + // } + const contentType = document?.contentType?.toLowerCase() || ""; + if (!contentType.includes("text") && !contentType.includes("html")) { + logger.info("Skip running in document content type: ", contentType); + return; + } + + const href = document?.location?.href || ""; // 设置页面 if (