diff --git a/js/privatebin.js b/js/privatebin.js index c5c5c3fc..2f4ba71a 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -2022,6 +2022,17 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) { attachmentData = undefined; }; + /** + * Cleares the drag & drop data. + * + * @name AttachmentViewer.clearDragAndDrop + * @function + */ + me.clearDragAndDrop = function() + { + $dragAndDropFileName.text(''); + }; + /** * hides the attachment * @@ -2137,6 +2148,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) { loadedFile = $fileInput[0].files[0]; $dragAndDropFileName.text(''); } else { + // TODO: cannot set original $fileWrap here for security reasons… $dragAndDropFileName.text(loadedFile.name); } @@ -2206,7 +2218,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) { // Firefox crashes with files that are about 1.5MB // The performance with 1MB files is bearable if (data.length > 1398488) { - Alert.showError('File too large, to display a preview. Please download the attachment.'); + Alert.showError('File too large, to display a preview. Please download the attachment.'); //TODO: is this error really neccessary? return; } @@ -2262,7 +2274,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) { $(document).on('drop', drop); $(document).on('dragenter', ignoreDragDrop); $(document).on('dragover', ignoreDragDrop); - $fileInput.on("change", function () { + $fileInput.on('change', function () { me.readFileData(); }); }; @@ -2842,8 +2854,10 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) { // in any case, remove saved attachment data AttachmentViewer.removeAttachmentData(); + // hide UI for selected files // our up-to-date jQuery can handle it :) $fileWrap.find('input').val(''); + AttachmentViewer.clearDragAndDrop(); // pevent '#' from appearing in the URL event.preventDefault(); diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 5ab0f519..ec6a0d50 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -75,7 +75,7 @@ if ($MARKDOWN): - + diff --git a/tpl/page.php b/tpl/page.php index 13870ea9..36c774ca 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -54,7 +54,7 @@ if ($QRCODE): - +