aboutsummaryrefslogtreecommitdiff
path: root/ext/js/pages/action-popup-main.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-04-10 23:55:11 -0400
committerGitHub <noreply@github.com>2021-04-10 23:55:11 -0400
commit20d60a2ba79c065586805806ea703a8057839f75 (patch)
tree3043090e118e03a8e276d2a7f1557e525ac23239 /ext/js/pages/action-popup-main.js
parentb23c4bff4bf319ea79eea0d025e21eb19e6dcd68 (diff)
Initial safari compatibility (#1609)
* Update environment info to return the 'safari' browser * Fix popup display on Safari * Update environment assignment * Add data-loading-stalled property when loading takes longer than expected * Add notification when loading has stalled * Allow getDictionaryInfo invocation on non-privileged contexts * Update _validatePrivilegedMessageSender * Don't listen to 'voiceschanged' event unless addEventListener is present Also expose an event
Diffstat (limited to 'ext/js/pages/action-popup-main.js')
-rw-r--r--ext/js/pages/action-popup-main.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/js/pages/action-popup-main.js b/ext/js/pages/action-popup-main.js
index 2de986da..4934802b 100644
--- a/ext/js/pages/action-popup-main.js
+++ b/ext/js/pages/action-popup-main.js
@@ -103,6 +103,10 @@ class DisplayController {
let tab;
try {
tab = await this._getCurrentTab();
+ // Safari assigns a tab object to the popup, other browsers do not
+ if (tab && await this._isSafari()) {
+ tab = void 0;
+ }
} catch (e) {
// NOP
}
@@ -220,6 +224,11 @@ class DisplayController {
node.hidden = false;
}
}
+
+ async _isSafari() {
+ const {browser} = await yomichan.api.getEnvironmentInfo();
+ return browser === 'safari';
+ }
}
(async () => {