Current File : /home/kelaby89/abl.academy/wp-content/themes/eduma/inc/libs/Tax-meta-class/js/tax-meta-clss.min.js |
var simple_meta_box,$=jQuery.noConflict();function update_repeater_fields(){$(".theEditor").each(function(){"object"==typeof tinyMCE&&"function"==typeof tinyMCE.execCommand&&tinyMCE.execCommand("mceAddControl",!1,$(this).attr("id"))}),$(".at-date").each(function(){var e=$(this),a=e.attr("rel");e.datepicker({showButtonPanel:!0,dateFormat:a})}),$(".at-time").each(function(){var e=$(this),a=e.attr("rel");e.timepicker({showSecond:!0,timeFormat:a})}),$(".at-color").wpColorPicker(),$(".at-upload").delegate(".at-delete-file","click",function(){var e=$(this),a=e.parent(),t=e.attr("rel");return $.post(ajaxurl,{action:"at_delete_file",data:t},function(e){"0"==e?(alert("File has been successfully deleted."),a.remove()):alert("You do NOT have permission to delete this file.")}),!1}),$(".at-images").each(function(){var e,a,t=$(this);t.sortable({placeholder:"ui-state-highlight",update:function(){e=t.sortable("serialize"),a=e+"|"+t.siblings(".at-images-data").val(),$.post(ajaxurl,{action:"at_reorder_images",data:a},function(e){"0"==e?alert("Order saved!"):alert("You don't have permission to reorder images.")})}})})}jQuery(document).ready(function(e){e(document).on("click",".at-re-toggle",function(){e(this).prev().toggle("slow")}),e(".at-date").each(function(){var a=e(this),t=a.attr("rel");a.datepicker({showButtonPanel:!0,dateFormat:t})}),e(".at-time").each(function(){var a=e(this),t=a.attr("rel");a.timepicker({showSecond:!0,timeFormat:t})}),e(".at-color").wpColorPicker(),e(document).ajaxComplete(function(a,t,l){try{if($respo=e.parseXML(t.responseText),e($respo).find("wp_error").length)return;e($respo).find("response").each(function(a,t){var l;e(t).attr("action").indexOf("add-tag")>-1&&(e(t).find("term_id")&&(l=e("form[action='edit-tags.php']"),e('input[type="text"]:visible, textarea:visible',l).val(""),e(".at-color",l).attr("style",""),e(".simplePanelImagePreview img").remove(),e("simplePanelimageUploadclear").each(function(){var a=e(this);a.prev().val(""),a.prev().prev().val(""),simplePanelupload.getInstance().replaceImageUploadClass(a)}),e(".simplePanelfilePreview ul li").remove(),e("simplePanelfileUploadclear").each(function(){var a=e(this);a.prev().val(""),a.prev().prev().val(""),simplePanelupload.getInstance().replaceImageUploadClass(a)}),e(".at-repater-block").remove(),e("select",l).val(""),e("input[type='checkbox']",l).prop("checked",!1),e("input[type='radio']",l).prop("checked",!1)))})}catch(e){}}),e.fn.preBind=function(a,t,l){return this.each(function(){e(this).bind(a,t,l);var i=e._data(this,"events")[a];e.isArray(i)&&i.unshift(i.pop())}),this},e("#submit").preBind("click",function(){"undefined"!=typeof tinymce&&"add-tag"==e("input[name=action]").val()&&e.each(tinymce.editors,function(a,t){var l=t.targetElm;e(l).html(t.getContent())})})}),jQuery(document).ready(function(e){(function(){var a;return{getInstance:function(){return a||(a={image_frame:new Array,file_frame:new Array,hooks:function(){e(document).on("click",".simplePanelimageUpload,.simplePanelfileUpload",function(t){t.preventDefault(),e(this).hasClass("simplePanelfileUpload")?a.upload(e(this),"file"):a.upload(e(this),"image")}),e(document).on("click",".simplePanelimageUploadclear,.simplePanelfileUploadclear",function(t){t.preventDefault(),a.set_fields(e(this)),e(a.file_url).val(""),e(a.file_id).val(""),e(this).hasClass("simplePanelimageUploadclear")?(a.set_preview("image",!1),a.replaceImageUploadClass(e(this))):(a.set_preview("file",!1),a.replaceFileUploadClass(e(this)))})},set_fields:function(t){a.file_url=e(t).prev(),a.file_id=e(a.file_url).prev()},upload:function(t,l){a.set_fields(t),"image"==l?a.upload_Image(e(t)):a.upload_File(e(t))},upload_File:function(t){var l=e(t).attr("data-mime_type")||"",i=e(t).attr("data-ext")||!1,r=e(t).attr("id"),n=!!e(t).hasClass("multiFile");if(void 0!==a.file_frame[r])return i&&(a.file_frame[r].uploader.uploader.param("uploadeType",i),a.file_frame[r].uploader.uploader.param("uploadeTypecaller","my_meta_box")),void a.file_frame[r].open();a.file_frame[r]=wp.media({library:{type:l},title:jQuery(this).data("uploader_title"),button:{text:jQuery(this).data("uploader_button_text")},multiple:n}),a.file_frame[r].on("select",function(){attachment=a.file_frame[r].state().get("selection").first().toJSON(),e(a.file_id).val(attachment.id),e(a.file_url).val(attachment.url),a.replaceFileUploadClass(t),a.set_preview("file",!0)}),a.file_frame[r].open(),i&&(a.file_frame[r].uploader.uploader.param("uploadeType",i),a.file_frame[r].uploader.uploader.param("uploadeTypecaller","my_meta_box"))},upload_Image:function(t){var l=e(t).attr("id"),i=!!e(t).hasClass("multiFile");void 0===a.image_frame[l]?(a.image_frame[l]=wp.media({library:{type:"image"},title:jQuery(this).data("uploader_title"),button:{text:jQuery(this).data("uploader_button_text")},multiple:i}),a.image_frame[l].on("open",function(){var t=a.image_frame[l].state().get("selection"),i=e(a.file_id).val().split("|");e.each(i,function(e,a){a.length&&(attachment=wp.media.attachment(a),attachment.fetch(),t.add(attachment?[attachment]:[]))})}),a.image_frame[l].on("select",function(){if(i){var r="",n="";a.image_frame[l].state().get("selection").each(function(e){r+=e.get("id")+"|",n+=e.get("url")+"|"}),r=r.substring(0,r.length-1),n=n.substring(0,n.length-1),e(a.file_id).val(r),e(a.file_url).val(n),a.set_multiple_img_preview(!0)}else attachment=a.image_frame[l].state().get("selection").first().toJSON(),e(a.file_id).val(attachment.id),e(a.file_url).val(attachment.url),a.replaceImageUploadClass(t),a.set_preview("image",!0)}),a.image_frame[l].open()):a.image_frame[l].open()},replaceImageUploadClass:function(a){e(a).hasClass("simplePanelimageUpload")?e(a).removeClass("simplePanelimageUpload").addClass("simplePanelimageUploadclear").val("Remove Image"):e(a).removeClass("simplePanelimageUploadclear").addClass("simplePanelimageUpload").val("Upload Image")},replaceFileUploadClass:function(a){e(a).hasClass("simplePanelfileUpload")?e(a).removeClass("simplePanelfileUpload").addClass("simplePanelfileUploadclear").val("Remove File"):e(a).removeClass("simplePanelfileUploadclear").addClass("simplePanelfileUpload").val("Upload File")},set_preview:function(t,l){l=l||!1;var i=e(a.file_url).val();"image"==t?l?e(a.file_id).prev().find("img").attr("src",i).show():e(a.file_id).prev().find("img").attr("src","").hide():l?e(a.file_id).prev().find("ul").append('<li><a href="'+i+'" target="_blank">'+i+"</a></li>"):e(a.file_id).prev().find("ul").children().remove()},set_multiple_img_preview:function(t){t=t||!1;var l=e(a.file_url).val(),i=e(a.file_id).val();""!=l&&(l=l.split("|"),i=i.split("|"),t?(e(a.file_id).prev().find("ul").remove(),e(a.file_id).prev().append('<ul class="imageSortable"></ul>'),e.each(l,function(t,l){e(a.file_id).prev().find(".imageSortable").append('<li><img src="'+l+'"data-attid="'+i[t]+'" style="width: 80px; height: auto;"></li>')}),e(".imageSortable").sortable({placeholder:"ui-state-highlight",update:function(t,l){var i=e(l.item[0]).parent(),r="",n="";i.find("img").each(function(a,t){r+=e(t).attr("data-attid")+"|",n+=e(t).attr("src")+"|"}),r=r.substring(0,r.length-1),n=n.substring(0,n.length-1),e(a.file_id).val(r),e(a.file_url).val(n)}})):e(a.file_id).prev().find("ul").remove())}}),a}}})().getInstance().hooks()});