PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
charitable / assets / js / charitable-plupload-fields.min.js

charitable-plupload-fields.min.js in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at assets/js/charitable-plupload-fields.min.js

1 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 CHARITABLE=window.CHARITABLE||{},function(e,a){var i=function(a){var i=this,o=a.data("params"),t=new plupload.Uploader(o);this.$dragdrop=a,this.$dropzone=e(t.settings.drop_element),this.$images=e("#"+a.data("images")),this.$loader=this.$dragdrop.find(".charitable-drag-drop-image-loader").first(),this.max_file_uploads=o.multipart_params.max_uploads,this.max_file_size=parseInt(this.$dragdrop.data("max-size"),10),this.uploaded=this.$images.children().length,this.max_uploads_alert_shown=!1,this.max_upload_size_alert_shown=!1,t.init(),t.bind("Init",function(e){i.Init(e)}),t.bind("PostInit",function(e){e.refresh()}),t.bind("FileFiltered",function(e,a){i.FileFiltered(e,a)}),t.bind("FilesAdded",function(e,a){i.FilesAdded(e,a)}),t.bind("Error",function(e,a){console.log(a)}),t.bind("FileUploaded",function(e,a,o){i.FileUploaded(e,a,o)})};i.prototype.Init=function(a){var i=this;this.$dropzone&&(a.features.dragdrop&&!this.$dragdrop.parent().hasClass("mobile")&&(this.$dragdrop.parent().addClass("supports-drag-drop"),this.$dropzone.bind("dragover",function(){i.$dropzone.addClass("drag-over")}),this.$dropzone.bind("dragleave",function(){i.$dropzone.removeClass("drag-over")})),this.$dragdrop.on("click",".remove-image",function(o){return o.preventDefault(),i.remove_image(e(this),a)}))},i.prototype.FileFiltered=function(e,a){return this.max_file_uploads&&this.uploaded>=this.max_file_uploads?(this.max_uploads_alert_shown||alert(this.get_max_uploads_message()),this.max_uploads_alert_shown=!0,e.removeFile(a)):a.size>=this.max_file_size?(this.max_upload_size_alert_shown||alert(CHARITABLE_UPLOAD_VARS.max_file_size.replace("%1$s",a.name).replace("%2$s",this.bytes_to_mb(this.max_file_size))),this.max_upload_size_alert_shown=!0,e.removeFile(a)):(this.uploaded+=1,this.uploaded===this.max_file_uploads&&this.hide_dropzone(),void this.add_image_loader(a))},i.prototype.FilesAdded=function(e,a){this.$dropzone.removeClass("drag-over"),this.max_uploads_alert_shown=!1,this.max_upload_size_alert_shown=!1,e.refresh(),e.start()},i.prototype.FileUploaded=function(a,i,o){var t;if(!(o=e.parseJSON(o.response)).success)return t=o.data&&"string"==typeof o.data.message?o.data.message:"",void this.add_image_error(i,t||CHARITABLE_UPLOAD_VARS.upload_problem.replace("%s",i.name));this.hide_image_loader(i),this.$images.append(o.data)},i.prototype.get_max_uploads_message=function(){return(this.max_file_uploads>1?CHARITABLE_UPLOAD_VARS.max_file_uploads_plural:CHARITABLE_UPLOAD_VARS.max_file_uploads_single).replace("%d",this.max_file_uploads)},i.prototype.add_image_loader=function(e){this.$loader.fadeIn(300),this.$loader.children(".images").append('<li data-file-id="'+e.id+'" class="">'+e.name+"</li>")},i.prototype.hide_image_loader=function(e){this.$loader.find("[data-file-id="+e.id+"]").remove(),this.$loader.find(".images li").length||this.$loader.hide()},i.prototype.remove_image=function(e,a){return e.parent().fadeOut(300,function(){this.remove()}),this.$dropzone.fadeIn(300),this.uploaded-=1,a.refresh(),!1},i.prototype.hide_dropzone=function(){this.$dropzone.removeClass("drag-over"),this.$dropzone.hide()},i.prototype.bytes_to_mb=function(e){var a=Math.floor(Math.log(e)/Math.log(1024));return 1*(e/Math.pow(1024,a)).toFixed(2)+" "+["B","kB","MB","GB","TB"][a]},i.prototype.add_image_error=function(e,a){var i=this;i.uploaded>0&&(i.uploaded-=1),i.$dropzone.fadeIn(300),i.$loader.find("[data-file-id="+e.id+"]").addClass("error").text(a).delay(5e3).fadeOut(300,function(){i.hide_image_loader(e)})},a.Uploader=i,e(document).ready(function(){e(".charitable-drag-drop").each(function(){new i(e(this))})})}(jQuery,CHARITABLE);