Fixes some display issues related to file display.
pull/216/head
rugk 6 years ago
parent da45d347e2
commit 14a7fd7091
No known key found for this signature in database
GPG Key ID: 05D40A636AFAB34D

@ -2022,6 +2022,17 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
attachmentData = undefined; attachmentData = undefined;
}; };
/**
* Cleares the drag & drop data.
*
* @name AttachmentViewer.clearDragAndDrop
* @function
*/
me.clearDragAndDrop = function()
{
$dragAndDropFileName.text('');
};
/** /**
* hides the attachment * hides the attachment
* *
@ -2137,6 +2148,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
loadedFile = $fileInput[0].files[0]; loadedFile = $fileInput[0].files[0];
$dragAndDropFileName.text(''); $dragAndDropFileName.text('');
} else { } else {
// TODO: cannot set original $fileWrap here for security reasons…
$dragAndDropFileName.text(loadedFile.name); $dragAndDropFileName.text(loadedFile.name);
} }
@ -2206,7 +2218,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
// Firefox crashes with files that are about 1.5MB // Firefox crashes with files that are about 1.5MB
// The performance with 1MB files is bearable // The performance with 1MB files is bearable
if (data.length > 1398488) { 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; return;
} }
@ -2262,7 +2274,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
$(document).on('drop', drop); $(document).on('drop', drop);
$(document).on('dragenter', ignoreDragDrop); $(document).on('dragenter', ignoreDragDrop);
$(document).on('dragover', ignoreDragDrop); $(document).on('dragover', ignoreDragDrop);
$fileInput.on("change", function () { $fileInput.on('change', function () {
me.readFileData(); me.readFileData();
}); });
}; };
@ -2842,8 +2854,10 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
// in any case, remove saved attachment data // in any case, remove saved attachment data
AttachmentViewer.removeAttachmentData(); AttachmentViewer.removeAttachmentData();
// hide UI for selected files
// our up-to-date jQuery can handle it :) // our up-to-date jQuery can handle it :)
$fileWrap.find('input').val(''); $fileWrap.find('input').val('');
AttachmentViewer.clearDragAndDrop();
// pevent '#' from appearing in the URL // pevent '#' from appearing in the URL
event.preventDefault(); event.preventDefault();

@ -75,7 +75,7 @@ if ($MARKDOWN):
<?php <?php
endif; 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]> <!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style> <style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]--> <![endif]-->

@ -54,7 +54,7 @@ if ($QRCODE):
<?php <?php
endif; 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]> <!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style> <style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]--> <![endif]-->

Loading…
Cancel
Save