From 766b5d3dd7185e2ea50212b952f94a2bcd47e053 Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Thu, 19 Jan 2023 14:48:43 +0100 Subject: [PATCH] add user notification if clipboard.readText() is undefined --- public/scripts/ui.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/public/scripts/ui.js b/public/scripts/ui.js index cdaaf77..b26d600 100644 --- a/public/scripts/ui.js +++ b/public/scripts/ui.js @@ -996,9 +996,13 @@ class Base64ZipDialog extends Dialog { super('base64ZipDialog'); const urlParams = new URL(window.location).searchParams; const base64zip = urlParams.get('base64zip'); - this.$pasteBtn = this.$el.querySelector('#base64ZipPasteBtn') - this.$pasteBtn.addEventListener('click', _ => this.processClipboard()) - if (base64zip) this.show(); + if (!navigator.clipboard.readText) { + setTimeout(_ => Events.fire('notify-user', 'This feature is not available on your device.'), 500); + } else if (base64zip) { + this.$pasteBtn = this.$el.querySelector('#base64ZipPasteBtn') + this.$pasteBtn.addEventListener('click', _ => this.processClipboard()) + this.show(); + } } async processClipboard() {