web/wp-admin/js/media.dev.js
changeset 194 32102edaa81b
parent 136 bde1974c263b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
    26 
    26 
    27 		send : function() {
    27 		send : function() {
    28 			var post = {
    28 			var post = {
    29 				ps: $('#find-posts-input').val(),
    29 				ps: $('#find-posts-input').val(),
    30 				action: 'find_posts',
    30 				action: 'find_posts',
    31 				_ajax_nonce: $('#_ajax_nonce').val()
    31 				_ajax_nonce: $('#_ajax_nonce').val(),
       
    32 				post_type: $('input[name="find-posts-what"]:checked').val()
    32 			};
    33 			};
    33 
    34 
    34 			if ( $('#find-posts-pages').is(':checked') ) {
       
    35 				post['pages'] = 1;
       
    36 			} else {
       
    37 				post['posts'] = 1;
       
    38 			}
       
    39 			$.ajax({
    35 			$.ajax({
    40 				type : 'POST',
    36 				type : 'POST',
    41 				url : ajaxurl,
    37 				url : ajaxurl,
    42 				data : post,
    38 				data : post,
    43 				success : function(x) { findPosts.show(x); },
    39 				success : function(x) { findPosts.show(x); },
    76 	$(document).ready(function() {
    72 	$(document).ready(function() {
    77 		$('#find-posts-submit').click(function(e) {
    73 		$('#find-posts-submit').click(function(e) {
    78 			if ( '' == $('#find-posts-response').html() )
    74 			if ( '' == $('#find-posts-response').html() )
    79 				e.preventDefault();
    75 				e.preventDefault();
    80 		});
    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 );
    81 		$('#doaction, #doaction2').click(function(e){
    85 		$('#doaction, #doaction2').click(function(e){
    82 			$('select[name^="action"]').each(function(){
    86 			$('select[name^="action"]').each(function(){
    83 				if ( $(this).val() == 'attach' ) {
    87 				if ( $(this).val() == 'attach' ) {
    84 					e.preventDefault();
    88 					e.preventDefault();
    85 					findPosts.open();
    89 					findPosts.open();