jQuery(document).ready(function(t){var e,a=jQuery("#post_cat_thumbnail_id");a.val()&&"0"!==a.val()||jQuery(".remove_image_button").hide(),jQuery(document).on("click",".upload_image_button",function(t){if(t.preventDefault(),e){e.open();return}(e=wp.media.frames.downloadable_file=wp.media({title:WPINTERFACEADMIN.title,button:{text:WPINTERFACEADMIN.btn_txt},multiple:!1})).on("select",function(){var t=e.state().get("selection").first().toJSON(),a=t.sizes.thumbnail||t.sizes.full;jQuery("#post_cat_thumbnail_id").val(t.id),jQuery("#post_cat_thumbnail").find("img").attr("src",a.url),jQuery(".remove_image_button").show()}),e.open()}),jQuery(document).on("click",".remove_image_button",function(){return jQuery("#post_cat_thumbnail").find("img").attr("src",WPINTERFACEADMIN.img),jQuery("#post_cat_thumbnail_id").val(""),jQuery(".remove_image_button").hide(),!1}),jQuery(document).ajaxComplete(function(t,e,a){if(e&&4===e.readyState&&200===e.status&&a.data&&0<=a.data.indexOf("action=add-tag")){var i=wpAjax.parseAjaxResponse(e.responseXML,"ajax-response");if(i&&!i.errors){jQuery("#post_cat_thumbnail").find("img").attr("src",WPINTERFACEADMIN.img),jQuery("#post_cat_thumbnail_id").val(""),jQuery(".remove_image_button").hide();return}}}),jQuery(".colorpicker").wpColorPicker()});