var findPosts;!function(s){findPosts={open:function(n,i){var e=s(".ui-find-overlay");return 0===e.length&&(s("body").append('
'),findPosts.overlay()),e.show(),n&&i&&s("#affected").attr("name",n).val(i),s("#find-posts").show(),s("#find-posts-input").focus().keyup(function(n){27==n.which&&findPosts.close()}),findPosts.send(),!1},close:function(){s("#find-posts-response").empty(),s("#find-posts").hide(),s(".ui-find-overlay").hide()},overlay:function(){s(".ui-find-overlay").on("click",function(){findPosts.close()})},send:function(){var n={ps:s("#find-posts-input").val(),action:"find_posts",_ajax_nonce:s("#_ajax_nonce").val()},i=s(".find-box-search .spinner");i.addClass("is-active"),s.ajax(ajaxurl,{type:"POST",data:n,dataType:"json"}).always(function(){i.removeClass("is-active")}).done(function(n){n.success||s("#find-posts-response").text(attachMediaBoxL10n.error),s("#find-posts-response").html(n.data)}).fail(function(){s("#find-posts-response").text(attachMediaBoxL10n.error)})}},s(document).ready(function(){var n,i=s("#wp-media-grid");i.length&&window.wp&&window.wp.media&&(n=_wpMediaGridSettings,window.wp.media({frame:"manage",container:i,library:n.queryVars}).open()),s("#find-posts-submit").click(function(n){s('#find-posts-response input[type="radio"]:checked').length||n.preventDefault()}),s("#find-posts .find-box-search :input").keypress(function(n){if(13==n.which)return findPosts.send(),!1}),s("#find-posts-search").click(findPosts.send),s("#find-posts-close").click(findPosts.close),s("#doaction, #doaction2").click(function(i){s('select[name^="action"]').each(function(){var n=s(this).val();"attach"===n?(i.preventDefault(),findPosts.open()):"delete"===n&&(showNotice.warn()||i.preventDefault())})}),s(".find-box-inside").on("click","tr",function(){s(this).find(".found-radio input").prop("checked",!0)})})}(jQuery);