5 open : function(af_name, af_val) {
6 var st = document.documentElement.scrollTop || $(document).scrollTop(),
7 overlay = $( '.ui-find-overlay' );
9 if ( overlay.length == 0 ) {
10 $( 'body' ).append( '<div class="ui-find-overlay"></div>' );
16 if ( af_name && af_val ) {
17 $('#affected').attr('name', af_name).val(af_val);
19 $('#find-posts').show().draggable({
20 handle: '#find-posts-head'
21 }).css({'top':st + 50 + 'px','left':'50%','marginLeft':'-328px'});
23 $('#find-posts-input').focus().keyup(function(e){
24 if (e.which == 27) { findPosts.close(); } // close on Escape
27 // Pull some results up by default
34 $('#find-posts-response').html('');
35 $('#find-posts').draggable('destroy').hide();
36 $( '.ui-find-overlay' ).hide();
39 overlay : function() {
40 $( '.ui-find-overlay' ).css(
41 { 'z-index': '999', 'width': $( document ).width() + 'px', 'height': $( document ).height() + 'px' }
42 ).on('click', function () {
49 ps: $('#find-posts-input').val(),
51 _ajax_nonce: $('#_ajax_nonce').val()
53 spinner = $( '.find-box-search .spinner' );
61 success : function(x) { findPosts.show(x); spinner.hide(); },
62 error : function(r) { findPosts.error(r); spinner.hide(); }
68 if ( typeof(x) == 'string' ) {
69 this.error({'responseText': x});
73 var r = wpAjax.parseAjaxResponse(x);
76 this.error({'responseText': wpAjax.broken});
79 $('#find-posts-response').html(r.data);
81 // Enable whole row to be clicked
82 $( '.found-posts td' ).on( 'click', function () {
83 $( this ).parent().find( '.found-radio input' ).prop( 'checked', true );
88 var er = r.statusText;
90 if ( r.responseText ) {
91 er = r.responseText.replace( /<.[^<>]*?>/g, '' );
94 $('#find-posts-response').html(er);
99 $(document).ready(function() {
100 $('#find-posts-submit').click(function(e) {
101 if ( '' == $('#find-posts-response').html() )
104 $( '#find-posts .find-box-search :input' ).keypress( function( event ) {
105 if ( 13 == event.which ) {
110 $( '#find-posts-search' ).click( findPosts.send );
111 $( '#find-posts-close' ).click( findPosts.close );
112 $('#doaction, #doaction2').click(function(e){
113 $('select[name^="action"]').each(function(){
114 if ( $(this).val() == 'attach' ) {
121 $(window).resize(function() {