fix: skip running in document content types

This commit is contained in:
Gabe
2025-11-16 15:00:49 +08:00
parent c21ac1aea6
commit 0c04ea3a33

View File

@@ -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 (