aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/search.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/search.js')
-rw-r--r--ext/bg/js/search.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index a09ca822..dca4e8fa 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -17,6 +17,12 @@
*/
+let IS_FIREFOX = null;
+(async () => {
+ const {browser} = await apiGetEnvironmentInfo();
+ IS_FIREFOX = ['firefox', 'firefox-mobile'].includes(browser);
+})();
+
class DisplaySearch extends Display {
constructor() {
super(document.querySelector('#spinner'), document.querySelector('#content'));
@@ -235,7 +241,13 @@ class DisplaySearch extends Display {
startClipboardMonitor() {
this.clipboardMonitorIntervalId = setInterval(async () => {
- const curText = (await navigator.clipboard.readText()).trim();
+ let curText = null;
+ // TODO get rid of this and figure out why apiClipboardGet doesn't work on Firefox
+ if (IS_FIREFOX) {
+ curText = (await navigator.clipboard.readText()).trim();
+ } else if (IS_FIREFOX === false) {
+ curText = (await apiClipboardGet()).trim();
+ }
if (curText && (curText !== this.clipboardPrevText)) {
if (this.isWanakanaEnabled()) {
this.query.value = window.wanakana.toKana(curText);