summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/fg/js/frontend.js3
-rw-r--r--ext/mixed/js/text-scanner.js8
2 files changed, 9 insertions, 2 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 55d699e5..a6b24c76 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -30,7 +30,8 @@ class Frontend extends TextScanner {
super(
window,
popup.isProxy() ? [] : [popup.getContainer()],
- [(x, y) => this.popup.containsPoint(x, y)]
+ [(x, y) => this.popup.containsPoint(x, y)],
+ () => this.popup.depth <= this.options.scanning.popupNestingMaxDepth
);
this.popup = popup;
diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js
index a1d96320..1d6e36e0 100644
--- a/ext/mixed/js/text-scanner.js
+++ b/ext/mixed/js/text-scanner.js
@@ -22,11 +22,13 @@
*/
class TextScanner {
- constructor(node, ignoreElements, ignorePoints) {
+ constructor(node, ignoreElements, ignorePoints, canEnable=null) {
this.node = node;
this.ignoreElements = ignoreElements;
this.ignorePoints = ignorePoints;
+ this.canEnable = canEnable;
+
this.ignoreNodes = null;
this.scanTimerPromise = null;
@@ -225,6 +227,10 @@ class TextScanner {
}
setEnabled(enabled) {
+ if (this.canEnable !== null && !this.canEnable()) {
+ enabled = false;
+ }
+
if (enabled) {
if (!this.enabled) {
this.hookEvents();