!function(e,t,n,i){function a(t,n){this.element=t,this._name=o,this.$element=e(t),this.init()}var o="exopiteAttachmentRemover";a.prototype={init:function(){this.bindEvents()},bindEvents:function(){var t=this;t.$element.find(".exopite-sof-attachment-media-js").on("click."+t._name,function(n){t.toggleSelect.call(t,e(this),n)})},toggleSelect:function(e,t){if(t.ctrlKey)e.toggleClass("selected");else{var n=e.hasClass("selected");this.$element.find(".exopite-sof-attachment-media-js").removeClass("selected"),n||e.addClass("selected")}}},e.fn[o]=function(t){return this.each(function(){e.data(this,"plugin_"+o)||e.data(this,"plugin_"+o,new a(this,t))})},e(n).ready(function(){e(".exopite-sof-attachment-container").finderSelect({children:".exopite-sof-attachment-media-js"}).on("mousedown",".exopite-sof-attachment-media-delete-js",function(e){e.stopPropagation()}),e(".exopite-sof-attachment-media-delete-js").on("click",function(t){var n=e(this).closest(".exopite-sof-attachment-container"),i=n.data("ajaxurl"),a=new Array;if(n.find(".selected").each(function(t,n){a.push(e(n).data("media-id"))}),1==confirm("Are you sure, you want to delete the selected "+a.length+" media?")){var o={action:"exopite-sof-file-batch-delete","media-ids":a};e.ajax({cache:!1,type:"POST",url:i,data:o,success:function(t){var i=jQuery.parseJSON(t);e.each(i,function(e,t){n.find("[data-media-id='"+t+"']").remove()})},error:function(e,t,n){console.log("Status: "+e.status),console.log("Error: "+e.responseText)}})}})})}(jQuery,window,document);