easter-egg-quest 1.0.26 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1094,6 +1094,7 @@ class HiddenEntry {
|
|
|
1094
1094
|
}
|
|
1095
1095
|
_findReplacementTextTarget(host) {
|
|
1096
1096
|
const triggerLength = "start hunt".length;
|
|
1097
|
+
const minReplaceLength = 5;
|
|
1097
1098
|
const textTargets = [];
|
|
1098
1099
|
const walker = document.createTreeWalker(host, NodeFilter.SHOW_TEXT, {
|
|
1099
1100
|
acceptNode: (node) => {
|
|
@@ -1101,7 +1102,9 @@ class HiddenEntry {
|
|
|
1101
1102
|
const text = this._normalizeComparableText(node.textContent ?? "");
|
|
1102
1103
|
if (!parent || text.length === 0) return NodeFilter.FILTER_REJECT;
|
|
1103
1104
|
if (parent.closest("[data-eeq], script, style, noscript")) return NodeFilter.FILTER_REJECT;
|
|
1105
|
+
if (this._isIconLikeTarget(parent)) return NodeFilter.FILTER_REJECT;
|
|
1104
1106
|
if (!isElementVisible(parent)) return NodeFilter.FILTER_REJECT;
|
|
1107
|
+
if (text.length < minReplaceLength) return NodeFilter.FILTER_REJECT;
|
|
1105
1108
|
if (Math.abs(text.length - triggerLength) > 10) return NodeFilter.FILTER_REJECT;
|
|
1106
1109
|
return NodeFilter.FILTER_ACCEPT;
|
|
1107
1110
|
}
|
|
@@ -1131,6 +1134,17 @@ class HiddenEntry {
|
|
|
1131
1134
|
_normalizeComparableText(text) {
|
|
1132
1135
|
return text.replace(/\s+/g, " ").trim();
|
|
1133
1136
|
}
|
|
1137
|
+
_isIconLikeTarget(parent) {
|
|
1138
|
+
const tag = parent.tagName.toLowerCase();
|
|
1139
|
+
const className = parent.className.toString().toLowerCase();
|
|
1140
|
+
const role = (parent.getAttribute("role") ?? "").toLowerCase();
|
|
1141
|
+
const ariaHidden = parent.getAttribute("aria-hidden");
|
|
1142
|
+
if (tag === "mat-icon" || tag === "svg" || tag === "i") return true;
|
|
1143
|
+
if (className.includes("icon") || className.includes("mat-icon")) return true;
|
|
1144
|
+
if (role === "img" || ariaHidden === "true") return true;
|
|
1145
|
+
if (parent.querySelector("svg, mat-icon")) return true;
|
|
1146
|
+
return false;
|
|
1147
|
+
}
|
|
1134
1148
|
_restoreReplacedText() {
|
|
1135
1149
|
if (this._replacedTextNode) {
|
|
1136
1150
|
this._replacedTextNode.textContent = this._replacedTextContent;
|