X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Fjs%2Fdropzone-factory.js;h=f33ec9c6df5e7bc86fe16924d1c72efa80b0cfdc;hb=96d2cddb54f3ea3ead6e43e5ca1f814ed6327987;hp=ca77bb6d500652fcfbb4fbe3d4b36164bdc39555;hpb=b7288b2bfd170bf5ba0c418a7617067eb6e65b9a;p=friendica.git diff --git a/view/js/dropzone-factory.js b/view/js/dropzone-factory.js index ca77bb6d50..f33ec9c6df 100644 --- a/view/js/dropzone-factory.js +++ b/view/js/dropzone-factory.js @@ -1,4 +1,5 @@ -var DzFactory = function () { +Dropzone.autoDiscover = false; +var DzFactory = function (max_imagesize) { this.createDropzone = function(dropSelector, textareaElementId) { return new Dropzone(dropSelector, { paramName: 'userfile', // The name that will be used to transfer the file @@ -6,6 +7,17 @@ var DzFactory = function () { url: '/media/photo/upload?album=', acceptedFiles: 'image/*', clickable: true, + dictDefaultMessage: dzStrings.dictDefaultMessage, + dictFallbackMessage: dzStrings.dictFallbackMessage, + dictFallbackText: dzStrings.dictFallbackText, + dictFileTooBig: dzStrings.dictFileTooBig, + dictInvalidFileType: dzStrings.dictInvalidFileType, + dictResponseError: dzStrings.dictResponseError, + dictCancelUpload: dzStrings.dictCancelUpload, + dictUploadCanceled: dzStrings.dictUploadCanceled, + dictCancelUploadConfirmation: dzStrings.dictCancelUploadConfirmation, + dictRemoveFile: dzStrings.dictRemoveFile, + dictMaxFilesExceeded: dzStrings.dictMaxFilesExceeded, accept: function(file, done) { done(); }, @@ -14,10 +26,10 @@ var DzFactory = function () { const targetTextarea = document.getElementById(textareaElementId); if (targetTextarea.setRangeText) { //if setRangeText function is supported by current browser - targetTextarea.setRangeText(' ' + $.trim(serverResponse) + ' '); + targetTextarea.setRangeText(serverResponse); } else { targetTextarea.focus(); - document.execCommand('insertText', false /*no UI*/, '\n' + $.trim(serverResponse) + '\n'); + document.execCommand('insertText', false /*no UI*/, serverResponse); } }); this.on('complete', function(file) { @@ -54,9 +66,10 @@ var DzFactory = function () { }; this.setupDropzone = function(dropSelector, textareaElementId) { + const self = this; var dropzone = this.createDropzone(dropSelector, textareaElementId); $(dropSelector).on('paste', function(event) { - dzFactory.copyPaste(event, dropzone); + self.copyPaste(event, dropzone); }) }; }