Fixes some display issues related to file display.
This commit is contained in:
rugk 2018-05-22 00:41:02 +02:00
parent da45d347e2
commit 14a7fd7091
No known key found for this signature in database
GPG Key ID: 05D40A636AFAB34D
3 changed files with 18 additions and 4 deletions

View File

@ -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();

View File

@ -75,7 +75,7 @@ if ($MARKDOWN):
<?php
endif;
?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-mJnXRlEN4mKPZWcq3Vwsql3hHa8X9EqsePjAGKadlbD4gF5m7MhwCreA9LQ/SOfoVGQQWG5xgTiuPEXLzs1D2g==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LRFZwcWQnCdUV6n97QiIW+Jm4p6FKPaeHGofcf124gWx1mxVjEAWEn5NgNnJaAT0cgNZaZBnmv+/eF4dCyWjyg==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->

View File

@ -54,7 +54,7 @@ if ($QRCODE):
<?php
endif;
?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-mJnXRlEN4mKPZWcq3Vwsql3hHa8X9EqsePjAGKadlbD4gF5m7MhwCreA9LQ/SOfoVGQQWG5xgTiuPEXLzs1D2g==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LRFZwcWQnCdUV6n97QiIW+Jm4p6FKPaeHGofcf124gWx1mxVjEAWEn5NgNnJaAT0cgNZaZBnmv+/eF4dCyWjyg==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->