Make some functions of AttachmentHandler private

They are only used/referenced in the same module, so there is no need to
make them public.
This commit is contained in:
rugk 2018-05-22 00:43:24 +02:00
parent 14a7fd7091
commit 429d43dc78
No known key found for this signature in database
GPG Key ID: 05D40A636AFAB34D
3 changed files with 13 additions and 10 deletions

View File

@ -2130,11 +2130,12 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
* read file data as dataURL using the FileReader API
*
* @name AttachmentViewer.readFileData
* @private
* @function
* @param {object} loadedFile The loaded file.
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/FileReader#readAsDataURL()}
*/
me.readFileData = function (loadedFile) {
readFileData = function (loadedFile) {
if (typeof FileReader === 'undefined') {
// revert loading status…
me.hideAttachment();
@ -2242,9 +2243,10 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
* attaches the file attachment drag & drop handler to the page
*
* @name AttachmentViewer.addDragDropHandler
* @private
* @function
*/
me.addDragDropHandler = function () {
addDragDropHandler = function () {
if (typeof $fileInput === 'undefined' || $fileInput.length === 0) {
return;
}
@ -2267,7 +2269,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
//Only works in Chrome:
//fileInput[0].files = e.dataTransfer.files;
me.readFileData(file);
readFileData(file);
}
};
@ -2275,7 +2277,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
$(document).on('dragenter', ignoreDragDrop);
$(document).on('dragover', ignoreDragDrop);
$fileInput.on('change', function () {
me.readFileData();
readFileData();
});
};
@ -2283,9 +2285,10 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
* attaches the clipboard attachment handler to the page
*
* @name AttachmentViewer.addClipboardEventHandler
* @private
* @function
*/
me.addClipboardEventHandler = function () {
addClipboardEventHandler = function () {
$(document).on('paste',
function (event) {
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
@ -2293,7 +2296,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
if (items.hasOwnProperty(i)) {
var item = items[i];
if (item.kind === 'file') {
me.readFileData(item.getAsFile());
readFileData(item.getAsFile());
}
}
}
@ -2362,8 +2365,8 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
$dragAndDropFileName = $('#dragAndDropFileName');
$fileInput = $('#file');
me.addDragDropHandler();
me.addClipboardEventHandler();
addDragDropHandler();
addClipboardEventHandler();
}
}

View File

@ -75,7 +75,7 @@ if ($MARKDOWN):
<?php
endif;
?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LRFZwcWQnCdUV6n97QiIW+Jm4p6FKPaeHGofcf124gWx1mxVjEAWEn5NgNnJaAT0cgNZaZBnmv+/eF4dCyWjyg==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-1BUJ1V4Y4Ej0dSOPsQevY2J0GWnjfm++cZwPMvHv8mCkm1il1PppRRVXPhfaIkoPi44Qi1I3CLYssWqHITMOcA==" 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-LRFZwcWQnCdUV6n97QiIW+Jm4p6FKPaeHGofcf124gWx1mxVjEAWEn5NgNnJaAT0cgNZaZBnmv+/eF4dCyWjyg==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-1BUJ1V4Y4Ej0dSOPsQevY2J0GWnjfm++cZwPMvHv8mCkm1il1PppRRVXPhfaIkoPi44Qi1I3CLYssWqHITMOcA==" 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]-->