Sfoglia il codice sorgente

Make some functions of AttachmentHandler private

They are only used/referenced in the same module, so there is no need to
make them public.
rugk 8 anni fa
parent
commit
429d43dc78
3 ha cambiato i file con 13 aggiunte e 10 eliminazioni
  1. 11 8
      js/privatebin.js
  2. 1 1
      tpl/bootstrap.php
  3. 1 1
      tpl/page.php

+ 11 - 8
js/privatebin.js

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

+ 1 - 1
tpl/bootstrap.php

@@ -75,7 +75,7 @@ if ($MARKDOWN):
 <?php
 <?php
 endif;
 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]>
 		<!--[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]-->

+ 1 - 1
tpl/page.php

@@ -54,7 +54,7 @@ if ($QRCODE):
 <?php
 <?php
 endif;
 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]>
 		<!--[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]-->