From 429d43dc78ad5b722d547a4082bc106f702f5d1d Mon Sep 17 00:00:00 2001 From: rugk Date: Tue, 22 May 2018 00:43:24 +0200 Subject: [PATCH] Make some functions of AttachmentHandler private They are only used/referenced in the same module, so there is no need to make them public. --- js/privatebin.js | 19 +++++++++++-------- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index 2f4ba71..d72d0cf 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -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(); } } diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index ec6a0d5..7dca0fd 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 36c774c..07e26cd 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -54,7 +54,7 @@ if ($QRCODE): - +