spartan-multi-image-picker
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -1,1 +0,1 @@ | ||
!function(a){"use strict";a.fn.spartanMultiImagePicker=function(i){var e=0,n=0,t=0,d={fieldName:"",groupClassName:"col-md-4 col-sm-4 col-xs-6",rowHeight:"200px",dropFileLabel:"Drop file here",placeholderImage:{image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfiBA4PGSVZX/u4AAAGhUlEQVRo3u2ZbXBU5RXHf8/NOy+BSOWtCbB3N5CIQBCwzDjjuE4xQUVKZ1od+WIhATttRVFpK9UPRUorg5bUtxacynSmQ6e2Io6lSgi0UxFrjNNRKrD3uUuIaBgmljdrJpvc0w/P7mbzstmkuQtfOJ/uOffs8//d5z773HvOhat2hU31dp0yq8ob7cfA0mZ9EDw/DAB3rrdJLWaijxcnaLWvc2PFxYwATXklG3mMPB/Fe+wUq4MNGQD0X1iajFzgS1+ES8hPzITcG9o9CIBbKzsAOMdGeSvk+HPhkYLcKm8t3wFQ7cy2z6RLLNXntWjRH5ya6o90qrl36ZgWLfpP6TKsnHsoBjpy7p32qf8A9l42A/DNyLVpAOQGAPndjI/9lwf4z2a+ALAWpQHgBgCasiMPC2O8bw7SAcwEIJItAJDjAMxKB6AARLIHoDwAlZMO4ArbVYDc4SS3FnXN88bkN5d9fkVmwK3rbPPeYX/nWb0tWnjZZ8C5T36ThF7fXUzdZZ0ByVHbUn1VG5l/WQF0Jdf0juTcNFBea1GWAKx+24j0i0TmO//uPOs8nhWAlqPmkZLyw3d7+9Eqq0FVMlr9VP88CwDhLn7SK/BK4Eiq686ThuRN+qH+he8AYNfLE3TGnd9T20t+LgdkAgCXANjgPjXUcdP+DaPjvXVqtHo60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DKfQE4BWAea6FN9jiryCqyitgPIDuNF5gY2gWAadu1WfEG3cLhqw1gHwJQE7/W7kBHoCPQIV6qZ1pWTXliqut/WvIegFp5wvYB4FUzA9GvZUos+TamxfFnK/8VzgOjcn7bUjJSffttUxF49ZKyuFUXAF09EXeSMlt1y6lD1rRPWQ/AzbGP9MpI6UgAlLAFgBvdrSnRfQBqb09EnpcJgLA63NX/e8EZzo2AIdcsQZBnCzaUxb88ODepC0GzPogWelt4EIBfB++Pf7A4ml/0uPxoeB2zIZhj1Qb+1jukF8kuVQlAS2xOxcWUb0bOAjarRX0bMSM04TU5rJpzmyFWpeaziG9hOivn1HLzxOizAbnTmeeNGrZQH1OKldwxyPm/xmoTNbc/O+AA5tSoZ6gY4MQFtd5+KQUmWwDQlFdSxxKqmJEM/YvXZGeotddsZA8gYXqcmivF1umO1sr27KtdtWHb/wAERFuYrBJ1jgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxOC0wNC0xNFQxNToyNTozNyswMjowMKaBIu8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTgtMDQtMTRUMTU6MjU6MzcrMDI6MDDX3JpTAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAABJRU5ErkJggg==",width:"64px"},maxCount:"",maxFileSize:"",allowedExt:"png|jpg|jpeg|gif",onAddRow:function(){},onRenderedPreview:function(){},onRemoveRow:function(){},onExtensionErr:function(){},onSizeErr:function(){},directUpload:{loaderIcon:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">\n <path stroke-linecap="round" stroke-linejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />\n </svg>',status:!1,url:"",success:function(){},error:function(){}}},r=a.extend({},d,i);function o(i,t){n=e;var d=i.groupClassName,r=i.rowHeight,o=i.fieldName,s=i.placeholderImage,l=i.dropFileLabel,p=s.image,A="64px",c='<i class="fas fa-sync fa-spin"></i>';void 0!==i.directUpload.loaderIcon&&(c=i.directUpload.loaderIcon),void 0!==s.width&&(A=s.width);var g=`<div class="${d} spartan_item_wrapper" data-spartanindexrow="${e}" style="margin-bottom : 20px; ">`+'<div style="position: relative;">'+`<div class="spartan_item_loader" data-spartanindexloader="${e}" style=" position: absolute; width: 100%; height: ${r}; background: rgba(255,255,255, 0.7); z-index: 22; text-align: center; align-items: center; margin: auto; justify-content: center; flex-direction: column; display : none; font-size : 1.7em; color: #CECECE">`+`${c}`+"</div>"+`<label class="file_upload" style="width: 100%; height: ${r}; border: 2px dashed #ddd; border-radius: 3px; cursor: pointer; text-align: center; overflow: hidden; padding: 5px; margin-top: 5px; margin-bottom : 5px; position : relative; display: flex; align-items: center; margin: auto; justify-content: center; flex-direction: column;">`+`<a href="javascript:void(0)" data-spartanindexremove="${e}" style="position: absolute !important; right : 3px; top: 3px; display : none; background : #ED3C20; border-radius: 3px; width: 30px; height: 30px; line-height : 30px; text-align: center; text-decoration : none; color : #FFF;" class="spartan_remove_row">\n <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">\n <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />\n </svg>\n </a>`+`<img style="width: ${A}; margin: 0 auto; vertical-align: middle;" data-spartanindexi="${e}" src="${p}" class="spartan_image_placeholder" /> `+`<p data-spartanlbldropfile="${e}" style="color : #5FAAE1; display: none; width : auto; ">${l}</p>`+`<img style="width: 100%; vertical-align: middle; display:none;" class="img_" data-spartanindeximage="${e}">`+`<input class="form-control spartan_image_input" accept="image/*" data-spartanindexinput="${e}" style="display : none" name="${o}" type="file">`+"</label> </div></div>",f=a.parseHTML(g);a(t).append(f);++e;i.onAddRow.call(this,e)}function s(i,n,d){var r=a(n).data("spartanindexinput");if(n.files&&n.files[0]){var s=n.files[0],l=i.allowedExt,p=i.maxFileSize,A=s.type;if(!new RegExp(`(.*?).(${l})$`).test(A)&&""!=l)return 1==a(d).find('img[data-spartanindeximage="'+r+'"]').is(":visible")&&a(d).find('img[data-spartanindexi="'+r+'"]').hide(),i.onExtensionErr.call(this,r,s),!1;if(""==p||""!=p&&s.size<=p){var c=new FileReader;c.onload=function(e){a(d).find('img[data-spartanindexi="'+r+'"]').hide(),a(d).find('a[data-spartanindexremove="'+r+'"]').show(),a(d).find('img[data-spartanindeximage="'+r+'"]').attr("src",e.target.result),a(d).find('img[data-spartanindeximage="'+r+'"]').show(),i.onRenderedPreview.call(this,r),1==i.directUpload.status&&function(i,e,n){var t=a(e).data("spartanindexinput"),d=new FormData,r=e.files[0],o=i.directUpload.additionalParam;a(n).find('[data-spartanindexloader="'+t+'"]').css("display","flex"),d.append("file",r),void 0!==o&&a.each(o,function(a,i){d.append(a,i)});a.ajax({url:i.directUpload.url,type:"POST",data:d,cache:!1,processData:!1,contentType:!1,success:function(e,d,r){a(n).find('[data-spartanindexloader="'+t+'"]').css("display","none"),void 0!==i.directUpload.success&&i.directUpload.success(this,e,d,r)},error:function(e,d,r){a(n).find('[data-spartanindexloader="'+t+'"]').css("display","none"),void 0!==i.directUpload.error&&i.directUpload.error(this,e,d,r)}})}(i,n,d)},c.readAsDataURL(n.files[0]);var g=!1;0==a(d).find('img[data-spartanindeximage="'+r+'"]').is(":visible")&&(t++,g=!0),r==e-1&&g&&(""==i.maxCount?o(i,d):""!=i.maxCount&&t<i.maxCount&&o(i,d))}else if(""!=p&&s.size>p)return 1==a(d).find('img[data-spartanindeximage="'+r+'"]').is(":visible")&&a(d).find('img[data-spartanindexi="'+r+'"]').hide(),i.onSizeErr.call(this,r,s),!1}}return this.each(function(){var i=this;o(r,i),a(this).on("change",".spartan_image_input",function(){s(r,this,i)}),a(this).on("click",".spartan_remove_row",function(){!function(i,e,d){var r=a(e).data("spartanindexremove");a(d).find('[data-spartanindexrow="'+r+'"]').remove(),n!=r&&1!=a(d).find('img[data-spartanindeximage="'+n+'"]').is(":visible")||o(i,d),t--,i.onRemoveRow.call(this,r)}(r,this,i)}),a(this).on("dragenter dragover dragstart",".spartan_item_wrapper",function(i){var e,n;i.stopPropagation(),i.preventDefault(),n=a(e=this).data("spartanindexrow"),a(e).find(".file_upload").css({"border-color":"#5FAAE1",background:"#DBE9F3"}),0==a(e).find('img[data-spartanindeximage="'+n+'"]').is(":visible")&&(a(e).find('p[data-spartanlbldropfile="'+n+'"]').show(),a(e).find('img[data-spartanindexi="'+n+'"]').hide())}),a(this).on("dragleave",".spartan_item_wrapper",function(){var i,e;e=a(i=this).data("spartanindexrow"),a(i).find(".file_upload").css({"border-color":"#ddd",background:"none"}),0==a(i).find('img[data-spartanindeximage="'+e+'"]').is(":visible")&&(a(i).find('p[data-spartanlbldropfile="'+e+'"]').hide(),a(i).find('img[data-spartanindexi="'+e+'"]').show())}),a(this).on("drop",".spartan_item_wrapper",function(e){var n,t,d,o,l;e.stopPropagation(),e.preventDefault(),t=i,d=e,o=a(n=this).data("spartanindexrow"),(l=a(t).find('.spartan_image_input[data-spartanindexinput="'+o+'"]')).files=d.originalEvent.dataTransfer.files,a(n).find(".file_upload").css({"border-color":"#ddd",background:"none"}),a(n).find('p[data-spartanlbldropfile="'+o+'"]').hide(),a(n).find('img[data-spartanindexi="'+o+'"]').show(),s(r,l,t)})})}}(jQuery); | ||
!function(a){"use strict";a.fn.spartanMultiImagePicker=function(i){var e=0,n=0,t=0,d={fieldName:"",groupClassName:"col-md-4 col-sm-4 col-xs-6",rowHeight:"200px",dropFileLabel:"Drop file here",placeholderImage:{image:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfiBA4PGSVZX/u4AAAG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A5tSoZ6gY4MQFtd5+KQUmWwDQlFdSxxKqmJEM/YvXZGeotddsZA8gYXqcmivF1umO1sr27KtdtWHb/wAERFuYrBJ1jgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxOC0wNC0xNFQxNToyNTozNyswMjowMKaBIu8AAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTgtMDQtMTRUMTU6MjU6MzcrMDI6MDDX3JpTAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAABJRU5ErkJggg==",width:"64px"},maxCount:"",maxFileSize:"",allowedExt:"png|jpg|jpeg|gif",onAddRow:function(){},onRenderedPreview:function(){},onRemoveRow:function(){},onExtensionErr:function(){},onSizeErr:function(){},directUpload:{loaderIcon:'<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">\n <path stroke-linecap="round" stroke-linejoin="round" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />\n </svg>',status:!1,url:"",success:function(){},error:function(){}}},r=a.extend({},d,i);function o(i,t){n=e;var d=i.groupClassName,r=i.rowHeight,o=i.fieldName,s=i.placeholderImage,l=i.dropFileLabel,p=s.image,A="64px",c='<i class="fas fa-sync fa-spin"></i>';void 0!==i.directUpload.loaderIcon&&(c=i.directUpload.loaderIcon),void 0!==s.width&&(A=s.width);var g=`<div class="${d} spartan_item_wrapper" data-spartanindexrow="${e}" style="margin-bottom : 20px; ">`+'<div style="position: relative;">'+`<div class="spartan_item_loader" data-spartanindexloader="${e}" style=" position: absolute; width: 100%; height: ${r}; background: rgba(255,255,255, 0.7); z-index: 22; text-align: center; align-items: center; margin: auto; justify-content: center; flex-direction: column; display : none; font-size : 1.7em; color: #CECECE">`+`${c}`+"</div>"+`<label class="file_upload" style="width: 100%; height: ${r}; border: 2px dashed #ddd; border-radius: 3px; cursor: pointer; text-align: center; overflow: hidden; padding: 5px; margin-top: 5px; margin-bottom : 5px; position : relative; display: flex; align-items: center; margin: auto; justify-content: center; flex-direction: column;">`+`<a href="javascript:void(0)" data-spartanindexremove="${e}" style="position: absolute !important; right : 3px; top: 3px; display : none; background : #ED3C20; border-radius: 3px; width: 30px; height: 30px; line-height : 30px; text-align: center; text-decoration : none; color : #FFF;" class="spartan_remove_row">\n <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">\n <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />\n </svg>\n </a>`+`<img style="width: ${A}; margin: 0 auto; vertical-align: middle;" data-spartanindexi="${e}" src="${p}" class="spartan_image_placeholder" /> `+`<p data-spartanlbldropfile="${e}" style="color : #5FAAE1; display: none; width : auto; ">${l}</p>`+`<img style="width: 100%; vertical-align: middle; display:none;" class="img_" data-spartanindeximage="${e}">`+`<input class="form-control spartan_image_input" accept="image/*" data-spartanindexinput="${e}" style="display : none" name="${o}" type="file">`+"</label> </div></div>",f=a.parseHTML(g);a(t).append(f);++e;i.onAddRow.call(this,e)}function s(i,n,d){var r=a(n).data("spartanindexinput");if(n.files&&n.files[0]){var s=n.files[0],l=i.allowedExt,p=i.maxFileSize,A=s.type;if(!new RegExp(`(.*?).(${l})$`).test(A)&&""!=l)return 1==a(d).find('img[data-spartanindeximage="'+r+'"]').is(":visible")&&a(d).find('img[data-spartanindexi="'+r+'"]').hide(),i.onExtensionErr.call(this,r,s),!1;if(""==p||""!=p&&s.size/1e3<=p){var c=new FileReader;c.onload=function(e){a(d).find('img[data-spartanindexi="'+r+'"]').hide(),a(d).find('a[data-spartanindexremove="'+r+'"]').show(),a(d).find('img[data-spartanindeximage="'+r+'"]').attr("src",e.target.result),a(d).find('img[data-spartanindeximage="'+r+'"]').show(),i.onRenderedPreview.call(this,r),1==i.directUpload.status&&function(i,e,n){var t=a(e).data("spartanindexinput"),d=new FormData,r=e.files[0],o=i.directUpload.additionalParam;a(n).find('[data-spartanindexloader="'+t+'"]').css("display","flex"),d.append("file",r),void 0!==o&&a.each(o,function(a,i){d.append(a,i)});a.ajax({url:i.directUpload.url,type:"POST",data:d,cache:!1,processData:!1,contentType:!1,success:function(e,d,r){a(n).find('[data-spartanindexloader="'+t+'"]').css("display","none"),void 0!==i.directUpload.success&&i.directUpload.success(this,e,d,r)},error:function(e,d,r){a(n).find('[data-spartanindexloader="'+t+'"]').css("display","none"),void 0!==i.directUpload.error&&i.directUpload.error(this,e,d,r)}})}(i,n,d)},c.readAsDataURL(n.files[0]);var g=!1;0==a(d).find('img[data-spartanindeximage="'+r+'"]').is(":visible")&&(t++,g=!0),r==e-1&&g&&(""==i.maxCount?o(i,d):""!=i.maxCount&&t<i.maxCount&&o(i,d))}else if(""!=p&&s.size/1e3>p)return 1==a(d).find('img[data-spartanindeximage="'+r+'"]').is(":visible")&&a(d).find('img[data-spartanindexi="'+r+'"]').hide(),i.onSizeErr.call(this,r,s),!1}}return this.each(function(){var i=this;o(r,i),a(this).on("change",".spartan_image_input",function(){s(r,this,i)}),a(this).on("click",".spartan_remove_row",function(){!function(i,e,d){var r=a(e).data("spartanindexremove");a(d).find('[data-spartanindexrow="'+r+'"]').remove(),n!=r&&1!=a(d).find('img[data-spartanindeximage="'+n+'"]').is(":visible")||o(i,d),t--,i.onRemoveRow.call(this,r)}(r,this,i)}),a(this).on("dragenter dragover dragstart",".spartan_item_wrapper",function(i){var e,n;i.stopPropagation(),i.preventDefault(),n=a(e=this).data("spartanindexrow"),a(e).find(".file_upload").css({"border-color":"#5FAAE1",background:"#DBE9F3"}),0==a(e).find('img[data-spartanindeximage="'+n+'"]').is(":visible")&&(a(e).find('p[data-spartanlbldropfile="'+n+'"]').show(),a(e).find('img[data-spartanindexi="'+n+'"]').hide())}),a(this).on("dragleave",".spartan_item_wrapper",function(){var i,e;e=a(i=this).data("spartanindexrow"),a(i).find(".file_upload").css({"border-color":"#ddd",background:"none"}),0==a(i).find('img[data-spartanindeximage="'+e+'"]').is(":visible")&&(a(i).find('p[data-spartanlbldropfile="'+e+'"]').hide(),a(i).find('img[data-spartanindexi="'+e+'"]').show())}),a(this).on("drop",".spartan_item_wrapper",function(e){var n,t,d,o,l;e.stopPropagation(),e.preventDefault(),t=i,d=e,o=a(n=this).data("spartanindexrow"),(l=a(t).find('.spartan_image_input[data-spartanindexinput="'+o+'"]')).files=d.originalEvent.dataTransfer.files,a(n).find(".file_upload").css({"border-color":"#ddd",background:"none"}),a(n).find('p[data-spartanlbldropfile="'+o+'"]').hide(),a(n).find('img[data-spartanindexi="'+o+'"]').show(),s(r,l,t)})})}}(jQuery); |
@@ -109,2 +109,3 @@ /** | ||
if (input.files && input.files[0]) { | ||
@@ -116,6 +117,8 @@ | ||
if(regex.test(file_select_type) || allowedExt == ''){ | ||
if((maxFileSize == '') || (maxFileSize != '' && file_select.size <= maxFileSize)){ | ||
if((maxFileSize == '') || (maxFileSize != '' && (file_select.size / 1000) <= maxFileSize)){ | ||
var reader = new FileReader(); | ||
@@ -150,3 +153,3 @@ reader.onload = function(e) { | ||
} | ||
else if(maxFileSize != '' && file_select.size > maxFileSize){ | ||
else if(maxFileSize != '' && (file_select.size / 1000) > maxFileSize){ | ||
@@ -153,0 +156,0 @@ if( $(parent).find('img[data-spartanindeximage="'+index+'"]').is(":visible") == true){ |
{ | ||
"name": "spartan-multi-image-picker", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A Jquery multi image picker with preview (and madness)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -116,3 +116,3 @@ | ||
| `groupClassName` | String | `col-md-4 col-sm-4 col-xs-6` | | ||
| `allowedExt` | String | `png|jpg|jpeg|gif` or empty string for all type | | ||
| `allowedExt` | String | "png|jpg|jpeg|gif" or empty string for all type | | ||
| `placeholderImage` | Object with `image` and `width` properties | `{ image: 'placeholder.png', width: '100%'}` | | ||
@@ -119,0 +119,0 @@ | `maxFileSize` | Number (in kb) | `40000` | |
@@ -109,2 +109,3 @@ /** | ||
if (input.files && input.files[0]) { | ||
@@ -116,6 +117,8 @@ | ||
if(regex.test(file_select_type) || allowedExt == ''){ | ||
if((maxFileSize == '') || (maxFileSize != '' && file_select.size <= maxFileSize)){ | ||
if((maxFileSize == '') || (maxFileSize != '' && (file_select.size / 1000) <= maxFileSize)){ | ||
var reader = new FileReader(); | ||
@@ -150,3 +153,3 @@ reader.onload = function(e) { | ||
} | ||
else if(maxFileSize != '' && file_select.size > maxFileSize){ | ||
else if(maxFileSize != '' && (file_select.size / 1000) > maxFileSize){ | ||
@@ -153,0 +156,0 @@ if( $(parent).find('img[data-spartanindeximage="'+index+'"]').is(":visible") == true){ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1705979