home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Blogs / wordpress2.6.exe / wordpress2.6 / wp-admin / js / custom-fields.js < prev    next >
Encoding:
Text File  |  2008-03-03  |  968 b   |  34 lines

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