raw
mp-wp_genesis           1 jQuery( function($) {
mp-wp_genesis 2 var before = function() {
mp-wp_genesis 3 var nonce = $('#newmeta [@name=_ajax_nonce]').val();
mp-wp_genesis 4 var postId = $('#post_ID').val();
mp-wp_genesis 5 if ( !nonce || !postId ) { return false; }
mp-wp_genesis 6 return [nonce,postId];
mp-wp_genesis 7 }
mp-wp_genesis 8
mp-wp_genesis 9 var addBefore = function( s ) {
mp-wp_genesis 10 var b = before();
mp-wp_genesis 11 if ( !b ) { return false; }
mp-wp_genesis 12 s.data = s.data.replace(/_ajax_nonce=[a-f0-9]+/, '_ajax_nonce=' + b[0]) + '&post_id=' + b[1];
mp-wp_genesis 13 return s;
mp-wp_genesis 14 };
mp-wp_genesis 15
mp-wp_genesis 16 var addAfter = function( r, s ) {
mp-wp_genesis 17 var postId = $('postid', r).text();
mp-wp_genesis 18 if ( !postId ) { return; }
mp-wp_genesis 19 $('#post_ID').attr( 'name', 'post_ID' ).val( postId );
mp-wp_genesis 20 var h = $('#hiddenaction');
mp-wp_genesis 21 if ( 'post' == h.val() ) { h.val( 'postajaxpost' ); }
mp-wp_genesis 22 };
mp-wp_genesis 23
mp-wp_genesis 24 var delBefore = function( s ) {
mp-wp_genesis 25 var b = before(); if ( !b ) return false;
mp-wp_genesis 26 s.data._ajax_nonce = b[0]; s.data.post_id = b[1];
mp-wp_genesis 27 return s;
mp-wp_genesis 28 }
mp-wp_genesis 29
mp-wp_genesis 30 $('#the-list')
mp-wp_genesis 31 .wpList( { addBefore: addBefore, addAfter: addAfter, delBefore: delBefore } )
mp-wp_genesis 32 .find('.updatemeta, .deletemeta').attr( 'type', 'button' );
mp-wp_genesis 33 } );