From 1d09a2e6946883689894f611c2f718916454bbe7 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Thu, 8 Nov 2018 16:24:32 -0800 Subject: [PATCH] fixed double file open on chrome --- app/ui/archiveTile.js | 228 ++++++++++++++++++++++++------------------ 1 file changed, 132 insertions(+), 96 deletions(-) diff --git a/app/ui/archiveTile.js b/app/ui/archiveTile.js index eb1232eb..ecbce233 100644 --- a/app/ui/archiveTile.js +++ b/app/ui/archiveTile.js @@ -20,36 +20,39 @@ function password(state) { const MAX_LENGTH = 32; return html` -
-
+
+
+ + +
- + maxlength="${MAX_LENGTH}" + type="password" + oninput="${inputChanged}" + onfocus="${focused}" + placeholder="${state.translate('unlockInputPlaceholder')}" + value="${state.password || ''}" + /> +
- - -
`; + `; function togglePasswordInput(event) { event.stopPropagation(); @@ -109,14 +112,26 @@ function fileInfo(file, action) { function archiveDetails(translate, archive) { if (archive.manifest.files.length > 1) { return html` -
- ${translate('fileCount', { - num: archive.manifest.files.length - })} - ${list(archive.manifest.files.map(f => fileInfo(f)), 'list-reset h-full')} -
`; +
+ ${ + translate('fileCount', { + num: archive.manifest.files.length + }) + } + ${ + list( + archive.manifest.files.map(f => fileInfo(f)), + 'list-reset h-full' + ) + } +
+ `; } function toggled(event) { event.stopPropagation(); @@ -174,39 +189,45 @@ module.exports = function(state, emit, archive) { module.exports.wip = function(state, emit) { return html` -
- ${list( - Array.from(state.archive.files) - .reverse() - .map(f => fileInfo(f, remove(f))), - 'list-reset h-full overflow-y-scroll px-4 bg-blue-lightest md:max-h-half-screen', - 'bg-white px-2 mt-3 border border-grey-light rounded' - )} -
- - -
- ${expiryOptions(state, emit)} - ${password(state, emit)} - -
`; +
+ ${ + list( + Array.from(state.archive.files) + .reverse() + .map(f => fileInfo(f, remove(f))), + 'list-reset h-full overflow-y-scroll px-4 bg-blue-lightest md:max-h-half-screen', + 'bg-white px-2 mt-3 border border-grey-light rounded' + ) + } +
+ + +
+ ${expiryOptions(state, emit)} ${password(state, emit)} + +
+ `; function upload(event) { window.scrollTo(0, 0); @@ -235,12 +256,14 @@ module.exports.wip = function(state, emit) { function remove(file) { return html` - `; + + `; function del(event) { event.stopPropagation(); emit('removeUpload', file); @@ -288,29 +311,42 @@ module.exports.uploading = function(state, emit) { module.exports.empty = function(state, emit) { return html` -
document.getElementById('file-upload').click()}> - -
${state.translate( - 'uploadDropDragMessage' - )}
-
${state.translate( - 'uploadDropClickMessage' - )}
- e.stopPropagation()} /> - +
+ `; function add(event) { event.preventDefault();