]> git.mxchange.org Git - friendica.git/blobdiff - view/js/dropzone-factory.js
removed unnecessary empty line
[friendica.git] / view / js / dropzone-factory.js
index ca77bb6d500652fcfbb4fbe3d4b36164bdc39555..f33ec9c6df5e7bc86fe16924d1c72efa80b0cfdc 100644 (file)
@@ -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);
                })
        };
 }