aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r--ext/fg/js/frontend.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index a6b24c76..a6df4b4c 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -26,15 +26,19 @@
*/
class Frontend extends TextScanner {
- constructor(popup) {
+ constructor(popup, initEventDispatcher) {
super(
window,
popup.isProxy() ? [] : [popup.getContainer()],
[(x, y) => this.popup.containsPoint(x, y)],
- () => this.popup.depth <= this.options.scanning.popupNestingMaxDepth
+ () => this.popup.depth <= this.options.scanning.popupNestingMaxDepth && !this._disabledOverride
);
this.popup = popup;
+ this.initEventDispatcher = initEventDispatcher;
+
+ this._disabledOverride = false;
+
this.options = null;
this.optionsContext = {
@@ -73,6 +77,8 @@ class Frontend extends TextScanner {
window.visualViewport.addEventListener('resize', this.onVisualViewportResize.bind(this));
}
+ this.initEventDispatcher.on('setDisabledOverride', this.onSetDisabledOverride.bind(this));
+
yomichan.on('orphaned', this.onOrphaned.bind(this));
yomichan.on('optionsUpdated', this.updateOptions.bind(this));
yomichan.on('zoomChanged', this.onZoomChanged.bind(this));
@@ -228,6 +234,14 @@ class Frontend extends TextScanner {
super.onSearchClear(changeFocus);
}
+ onSetDisabledOverride({disabled}) {
+ this._disabledOverride = disabled;
+ // other cases handed by regular options update
+ if (disabled && this.enabled) {
+ this.setEnabled(false);
+ }
+ }
+
getOptionsContext() {
this.optionsContext.url = this.popup.url;
return this.optionsContext;