From 26352be478f4e6e98ed77979033dd782ce197456 Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Sun, 20 Dec 2020 21:30:28 +0100 Subject: [PATCH] "Download all" when receiving multiple files --- client/index.html | 6 +++++- client/scripts/ui.js | 10 ++++++++++ client/styles.css | 13 +++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/client/index.html b/client/index.html index 5a2a19b..6e17d6a 100644 --- a/client/index.html +++ b/client/index.html @@ -71,8 +71,12 @@

File Received

Filename
+
+ + +
- Download + Save
diff --git a/client/scripts/ui.js b/client/scripts/ui.js index 8daad44..fe20dfe 100644 --- a/client/scripts/ui.js +++ b/client/scripts/ui.js @@ -261,6 +261,11 @@ class ReceiveDialog extends Dialog { $a.href = url; $a.download = file.name; + if(this._autoDownload()){ + $a.click() + return + } + this.$el.querySelector('#fileName').textContent = file.name; this.$el.querySelector('#fileSize').textContent = this._formatFileSize(file.size); this.show(); @@ -289,6 +294,11 @@ class ReceiveDialog extends Dialog { super.hide(); this._dequeueFile(); } + + + _autoDownload(){ + return !this.$el.querySelector('#autoDownload').checked + } } diff --git a/client/styles.css b/client/styles.css index 82da6ce..b660f1b 100644 --- a/client/styles.css +++ b/client/styles.css @@ -50,6 +50,10 @@ body { justify-content: center; } +.grow { + flex-grow: 1; +} + .full { position: absolute; top: 0; @@ -357,11 +361,17 @@ x-dialog .row-reverse>.button { margin-left: 8px; } -x-dialog a{ +x-dialog a { color: var(--primary-color); } /* Receive Dialog */ +#receiveDialog .row{ + margin-top: 24px; + margin-bottom: 8px; +} + +/* Receive Text Dialog */ #receiveTextDialog #text { width: 100%; @@ -469,7 +479,6 @@ button::-moz-focus-inner { /* Text Input */ -input, textarea { width: 100%; box-sizing: border-box;