1 jQuery(document).ready( function($) {
2 var before, addBefore, addAfter, delBefore;
5 var nonce = $('#newmeta [name="_ajax_nonce"]').val(), postId = $('#post_ID').val();
6 if ( !nonce || !postId ) { return false; }
10 addBefore = function( s ) {
12 if ( !b ) { return false; }
13 s.data = s.data.replace(/_ajax_nonce=[a-f0-9]+/, '_ajax_nonce=' + b[0]) + '&post_id=' + b[1];
17 addAfter = function( r, s ) {
18 var postId = $('postid', r).text(), h;
19 if ( !postId ) { return; }
20 $('#post_ID').attr( 'name', 'post_ID' ).val( postId );
21 h = $('#hiddenaction');
22 if ( 'post' == h.val() ) { h.val( 'postajaxpost' ); }
25 delBefore = function( s ) {
26 var b = before(); if ( !b ) return false;
27 s.data._ajax_nonce = b[0]; s.data.post_id = b[1];
32 .wpList( { addBefore: addBefore, addAfter: addAfter, delBefore: delBefore } )
33 .find('.updatemeta, .deletemeta').attr( 'type', 'button' );