fix herf match func

This commit is contained in:
Gabe Yuan
2023-09-05 16:06:48 +08:00
parent 87ab45f936
commit a44747ccad
3 changed files with 12 additions and 3 deletions

View File

@@ -45,9 +45,10 @@ const init = async () => {
try {
await init();
} catch (err) {
console.error("[KISS-Translator]", err);
const $err = document.createElement("div");
$err.innerText = `KISS-Translator: ${err.message}`;
$err.style.cssText = "background:red; color:#fff; z-index:10000;";
$err.style.cssText = "background:red; color:#fff;";
document.body.prepend($err);
}
})();

View File

@@ -91,7 +91,14 @@ export const isMatch = (s, p) => {
return true;
}
return p.slice(pIndex).replaceAll("*", "") === "";
while (pIndex < p.length) {
if (p[pIndex] !== "*") {
return false;
}
pIndex++;
}
return true;
};
/**

View File

@@ -99,9 +99,10 @@ const init = async () => {
try {
await init();
} catch (err) {
console.error("[KISS-Translator]", err);
const $err = document.createElement("div");
$err.innerText = `KISS-Translator: ${err.message}`;
$err.style.cssText = "background:red; color:#fff; z-index:10000;";
$err.style.cssText = "background:red; color:#fff;";
document.body.prepend($err);
}
})();