fix: skip running in document content types
This commit is contained in:
@@ -118,20 +118,22 @@ async function getFavWords(rule) {
|
|||||||
*/
|
*/
|
||||||
export async function run(isUserscript = false) {
|
export async function run(isUserscript = false) {
|
||||||
try {
|
try {
|
||||||
// if (document?.documentElement?.tagName?.toUpperCase() !== "HTML") {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
if (!document?.contentType?.includes("text")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 读取设置信息
|
// 读取设置信息
|
||||||
const setting = await getSettingWithDefault();
|
const setting = await getSettingWithDefault();
|
||||||
|
|
||||||
// 日志
|
// 日志
|
||||||
logger.setLevel(setting.logLevel);
|
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 (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user