summaryrefslogtreecommitdiff
path: root/ext/mixed/js/text-scanner.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-04-10 02:48:41 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2020-04-11 21:01:27 +0300
commit1df59d57b5dcbf9d3efedcb21a4d5e16524a67c1 (patch)
tree9e7bac2da9d43bcb34ebb1b5ae2c8560a3600b7a /ext/mixed/js/text-scanner.js
parent61a96e327a815bda7fea4c5d2096dead901fdf33 (diff)
limit popup depth live
Diffstat (limited to 'ext/mixed/js/text-scanner.js')
-rw-r--r--ext/mixed/js/text-scanner.js8
1 files changed, 7 insertions, 1 deletions
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();