Browse Source

Download filenames now persist

n1474335 7 years ago
parent
commit
a0aa363203
2 changed files with 4 additions and 4 deletions
  1. 3 3
      src/web/OutputWaiter.js
  2. 1 1
      src/web/html/index.html

+ 3 - 3
src/web/OutputWaiter.js

@@ -135,10 +135,10 @@ OutputWaiter.prototype.closeFile = function() {
  * Handler for file download events.
  * Handler for file download events.
  */
  */
 OutputWaiter.prototype.downloadFile = function() {
 OutputWaiter.prototype.downloadFile = function() {
-    const filename = window.prompt("Please enter a filename:", "download.dat");
-    const file = new File([this.dishBuffer], filename);
+    this.filename = window.prompt("Please enter a filename:", this.filename || "download.dat");
+    const file = new File([this.dishBuffer], this.filename);
 
 
-    if (filename) FileSaver.saveAs(file, filename, false);
+    if (this.filename) FileSaver.saveAs(file, this.filename, false);
 };
 };
 
 
 
 

+ 1 - 1
src/web/html/index.html

@@ -226,7 +226,7 @@
                                             <button id="output-file-download" type="button" class="btn btn-primary">Download</button>
                                             <button id="output-file-download" type="button" class="btn btn-primary">Download</button>
                                             <div class="input-group">
                                             <div class="input-group">
                                                 <span class="input-group-btn">
                                                 <span class="input-group-btn">
-                                                    <button id="output-file-slice" type="button" class="btn btn-default" title="View">&#x1f50d;</button>
+                                                    <button id="output-file-slice" type="button" class="btn btn-default" title="View slice">&#x1f50d;</button>
                                                 </span>
                                                 </span>
                                                 <input type="number" class="form-control" id="output-file-slice-from" placeholder="From" value="0" step="1024" min="0">
                                                 <input type="number" class="form-control" id="output-file-slice-from" placeholder="From" value="0" step="1024" min="0">
                                                 <div class="input-group-addon">to</div>
                                                 <div class="input-group-addon">to</div>