| [ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 2 var findPosts; 3 (function($){ 4 findPosts = { 5 open : function(af_name, af_val) { 6 var st = document.documentElement.scrollTop || $(document).scrollTop(); 7 8 if ( af_name && af_val ) { 9 $('#affected').attr('name', af_name).val(af_val); 10 } 11 $('#find-posts').show().draggable({ 12 handle: '#find-posts-head' 13 }).css({'top':st + 50 + 'px','left':'50%','marginLeft':'-250px'}); 14 15 $('#find-posts-input').focus().keyup(function(e){ 16 if (e.which == 27) { findPosts.close(); } // close on Escape 17 }); 18 19 return false; 20 }, 21 22 close : function() { 23 $('#find-posts-response').html(''); 24 $('#find-posts').draggable('destroy').hide(); 25 }, 26 27 send : function() { 28 var post = { 29 ps: $('#find-posts-input').val(), 30 action: 'find_posts', 31 _ajax_nonce: $('#_ajax_nonce').val(), 32 post_type: $('input[name="find-posts-what"]:checked').val() 33 }; 34 35 $.ajax({ 36 type : 'POST', 37 url : ajaxurl, 38 data : post, 39 success : function(x) { findPosts.show(x); }, 40 error : function(r) { findPosts.error(r); } 41 }); 42 }, 43 44 show : function(x) { 45 46 if ( typeof(x) == 'string' ) { 47 this.error({'responseText': x}); 48 return; 49 } 50 51 var r = wpAjax.parseAjaxResponse(x); 52 53 if ( r.errors ) { 54 this.error({'responseText': wpAjax.broken}); 55 } 56 r = r.responses[0]; 57 $('#find-posts-response').html(r.data); 58 }, 59 60 error : function(r) { 61 var er = r.statusText; 62 63 if ( r.responseText ) { 64 er = r.responseText.replace( /<.[^<>]*?>/g, '' ); 65 } 66 if ( er ) { 67 $('#find-posts-response').html(er); 68 } 69 } 70 }; 71 72 $(document).ready(function() { 73 $('#find-posts-submit').click(function(e) { 74 if ( '' == $('#find-posts-response').html() ) 75 e.preventDefault(); 76 }); 77 $( '#find-posts .find-box-search :input' ).keypress( function( event ) { 78 if ( 13 == event.which ) { 79 findPosts.send(); 80 return false; 81 } 82 } ); 83 $( '#find-posts-search' ).click( findPosts.send ); 84 $( '#find-posts-close' ).click( findPosts.close ); 85 $('#doaction, #doaction2').click(function(e){ 86 $('select[name^="action"]').each(function(){ 87 if ( $(this).val() == 'attach' ) { 88 e.preventDefault(); 89 findPosts.open(); 90 } 91 }); 92 }); 93 }); 94 })(jQuery);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri May 25 03:56:23 2012 | Hosted by follow the white rabbit. |