Skip to content

Commit

Permalink
Added option to retain original filename when downloading .epubs (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-shirley authored Aug 22, 2023
1 parent 31f1976 commit 4575865
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ <h1>Amazon Kindle EPUB Fix</h1>

<h2>Select your EPUB</h2>
<form>
<label for="keepOriginalFilename">Keep original filename</label>
<input id="keepOriginalFilename" type="checkbox">
<input id="file" type="file" accept=".epub" multiple>
<small>Multiple files allowed.</small>
</form>
Expand Down
5 changes: 3 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const TXT_SYS_ERROR = 'The program encountered an internal error.'
const mainStatusDiv = document.getElementById('main_status')
const outputDiv = document.getElementById('output')
const btnDlAll = document.getElementById('btnDlAll')
const keepOriginalFilename = document.getElementById('keepOriginalFilename')

const filePicker = document.getElementById('file')

Expand Down Expand Up @@ -300,10 +301,10 @@ async function processEPUB (inputBlob, name) {
fixedBlobs.push(blob)

if (epub.fixedProblems.length > 0) {
dlfilenames.push("(fixed) " + name)
keepOriginalFilename.checked ? dlfilenames.push(name) : dlfilenames.push("(fixed) " + name)
outputDiv.appendChild(build_output_html(idx, epub.fixedProblems))
} else {
dlfilenames.push("(repacked) " + name)
keepOriginalFilename.checked ? dlfilenames.push(name) : dlfilenames.push("(repacked) " + name)
outputDiv.appendChild(build_output_html(idx, TXT_NO_ERROR))
}
} catch (e) {
Expand Down

0 comments on commit 4575865

Please sign in to comment.