CoreFiles by mySites.guru
custom-fields.js33 lines, 968 bytes, from wordpress-2.7.1.zip
Raw History Compare with 2.7
md5
29b80d93f3d1b24bd5529c23acd1719a
sha1
44ef46e811b38b7ed8d4c9f416aef7fead173601
sha256
889720f47585df228ccda1b4133391681ee5bcc971237992c5fae750cccfeb22
jQuery( function($) {
	var before = function() {
		var nonce = $('#newmeta [@name=_ajax_nonce]').val();
		var postId = $('#post_ID').val();
		if ( !nonce || !postId ) { return false; }
		return [nonce,postId];
	}

	var addBefore = function( s ) {
		var b = before();
		if ( !b ) { return false; }
		s.data = s.data.replace(/_ajax_nonce=[a-f0-9]+/, '_ajax_nonce=' + b[0]) + '&post_id=' + b[1];
		return s;
	};

	var addAfter = function( r, s ) {
		var postId = $('postid', r).text();
		if ( !postId ) { return; }
		$('#post_ID').attr( 'name', 'post_ID' ).val( postId );
		var h = $('#hiddenaction');
		if ( 'post' == h.val() ) { h.val( 'postajaxpost' ); }
	};

	var delBefore = function( s ) {
		var b = before(); if ( !b ) return false;
		s.data._ajax_nonce = b[0]; s.data.post_id = b[1];
		return s;
	}

	$('#the-list')
		.wpList( { addBefore: addBefore, addAfter: addAfter, delBefore: delBefore } )
		.find('.updatemeta, .deletemeta').attr( 'type', 'button' );
} );

The same content is in 25 releases, WordPress 2.5-RC1 to 2.7.1. See them all, or every version of this file.