easter-egg-quest 1.0.27 → 1.0.29
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.
|
@@ -1074,7 +1074,7 @@ class HiddenEntry {
|
|
|
1074
1074
|
const target = this._findReplacementTextTarget(host);
|
|
1075
1075
|
if (!target) return null;
|
|
1076
1076
|
const span = document.createElement("span");
|
|
1077
|
-
span.textContent = "start hunt";
|
|
1077
|
+
span.textContent = " start hunt ";
|
|
1078
1078
|
span.setAttribute("data-eeq", "trigger");
|
|
1079
1079
|
span.classList.add("eeq-inline-trigger");
|
|
1080
1080
|
this._applyTriggerTypography(span, target.parent);
|
|
@@ -1099,12 +1099,14 @@ class HiddenEntry {
|
|
|
1099
1099
|
const walker = document.createTreeWalker(host, NodeFilter.SHOW_TEXT, {
|
|
1100
1100
|
acceptNode: (node) => {
|
|
1101
1101
|
const parent = node.parentElement;
|
|
1102
|
-
const
|
|
1102
|
+
const rawText = node.textContent ?? "";
|
|
1103
|
+
const text = this._normalizeComparableText(rawText);
|
|
1103
1104
|
if (!parent || text.length === 0) return NodeFilter.FILTER_REJECT;
|
|
1104
1105
|
if (parent.closest("[data-eeq], script, style, noscript")) return NodeFilter.FILTER_REJECT;
|
|
1105
1106
|
if (this._isIconLikeTarget(parent)) return NodeFilter.FILTER_REJECT;
|
|
1106
1107
|
if (!isElementVisible(parent)) return NodeFilter.FILTER_REJECT;
|
|
1107
1108
|
if (text.length < minReplaceLength) return NodeFilter.FILTER_REJECT;
|
|
1109
|
+
if (!this._hasAllowedTextSeparators(rawText)) return NodeFilter.FILTER_REJECT;
|
|
1108
1110
|
if (Math.abs(text.length - triggerLength) > 10) return NodeFilter.FILTER_REJECT;
|
|
1109
1111
|
return NodeFilter.FILTER_ACCEPT;
|
|
1110
1112
|
}
|
|
@@ -1134,6 +1136,10 @@ class HiddenEntry {
|
|
|
1134
1136
|
_normalizeComparableText(text) {
|
|
1135
1137
|
return text.replace(/\s+/g, " ").trim();
|
|
1136
1138
|
}
|
|
1139
|
+
_hasAllowedTextSeparators(text) {
|
|
1140
|
+
const normalized = this._normalizeComparableText(text);
|
|
1141
|
+
return normalized.includes(" ") || normalized.includes(".");
|
|
1142
|
+
}
|
|
1137
1143
|
_isIconLikeTarget(parent) {
|
|
1138
1144
|
const tag = parent.tagName.toLowerCase();
|
|
1139
1145
|
const className = parent.className.toString().toLowerCase();
|