From 69cef1696fb5384d5d54e0eefc15d22543f14638 Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 21 Jan 2018 15:00:14 +0200 Subject: [PATCH] add inForm option and fix clear button bug --- CHANGELOG.md | 5 +++++ package.json | 4 ++-- src/ssi-uploader/js/ssi-uploader.js | 13 ++++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1179740..2142b0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## ssi-uploader v1.3.9-beta + * Fix the clear button in no preview mode + * Add inForm(boolean) option that allows to send the files in form. + + ## ssi-uploader v1.3.1-beta * Now you can display message from server even if the response is success. diff --git a/package.json b/package.json index ebbdc34..fa27b5b 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "main": "dist/ssi-uploader/js/ssi-uploader.js", "description": "An awesome jquery uploader", "scripts": { - "start":"gulp", - "build":"gulp compile", + "start": "gulp", + "build": "gulp compile", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", diff --git a/src/ssi-uploader/js/ssi-uploader.js b/src/ssi-uploader/js/ssi-uploader.js index 39cd77c..964470b 100644 --- a/src/ssi-uploader/js/ssi-uploader.js +++ b/src/ssi-uploader/js/ssi-uploader.js @@ -1,6 +1,3 @@ -/* - * error:an teleiwsei to upload kai iparxei ena sti lista pou den exei patithei - * */ (function (root, factory) { //@author http://ifandelse.com/its-not-hard-making-your-library-support-amd-and-commonjs/ @@ -41,7 +38,9 @@ var $clearBtn = $(''); var $abortBtn = $(''); - + if(this.options.inForm){ + $uploadBtn.hide(); + } this.$element.append($('
').append($chooseBtn, $abortBtn, $uploadBtn, $clearBtn)); var $uploadBox; if (!this.options.preview) { @@ -66,7 +65,9 @@ }); $input.on('change', function () { //choose files thisS.toUploadFiles(this.files); - $input.val(''); + if(!thisS.options.inForm){ + $input.val(''); + } }); //drag n drop if (thisS.options.dropZone) { @@ -324,6 +325,7 @@ j++; } } else { + $clearBtn.prop('disabled', false); thisS.$element.find('.ssi-namePreview').html((index === 0 ? cutFileName(filename, ext, 13) : (thisS.currentListLength + 1) + ' ' + thisS.language.files));//set name preview $fileList.append('' +//append files element to dom '
' + @@ -788,6 +790,7 @@ responseValidation: false, ignoreCallbackErrors: false, maxFileSize: 2, + inForm: false, ajaxOptions: {}, onUpload: function () { },