aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js/text-scanner.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-04-11 16:20:12 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2020-04-11 21:04:30 +0300
commit5c3641eadb78144b7f6305ebbd574bbc6265a4c4 (patch)
tree5bfabfb95105cf32b24d2e3861fb725a85f943bc /ext/mixed/js/text-scanner.js
parentd93e3e1a6727e23547c44d4fc3b82244f560c459 (diff)
simplify frontend disable override
Diffstat (limited to 'ext/mixed/js/text-scanner.js')
-rw-r--r--ext/mixed/js/text-scanner.js16
1 files changed, 5 insertions, 11 deletions
diff --git a/ext/mixed/js/text-scanner.js b/ext/mixed/js/text-scanner.js
index 85be7119..bff9544f 100644
--- a/ext/mixed/js/text-scanner.js
+++ b/ext/mixed/js/text-scanner.js
@@ -22,13 +22,11 @@
*/
class TextScanner {
- constructor(node, ignoreElements, ignorePoints, canEnable=null) {
+ constructor(node, ignoreElements, ignorePoints) {
this.node = node;
this.ignoreElements = ignoreElements;
this.ignorePoints = ignorePoints;
- this.canEnable = canEnable;
-
this.ignoreNodes = null;
this.scanTimerPromise = null;
@@ -226,12 +224,8 @@ class TextScanner {
}
}
- setEnabled(enabled) {
- if (this.canEnable !== null && !this.canEnable()) {
- enabled = false;
- }
-
- if (enabled) {
+ setEnabled(enabled, canEnable) {
+ if (enabled && canEnable) {
if (!this.enabled) {
this.hookEvents();
this.enabled = true;
@@ -277,9 +271,9 @@ class TextScanner {
];
}
- setOptions(options) {
+ setOptions(options, canEnable=true) {
this.options = options;
- this.setEnabled(this.options.general.enable);
+ this.setEnabled(this.options.general.enable, canEnable);
}
async searchAt(x, y, cause) {