wp/wp-admin/js/set-post-thumbnail.js
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 9 177826044cd9
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
     1 function WPSetAsThumbnail(id, nonce){
     1 /* global setPostThumbnailL10n, ajaxurl, post_id, alert */
       
     2 /* exported WPSetAsThumbnail */
       
     3 
       
     4 function WPSetAsThumbnail( id, nonce ) {
     2 	var $link = jQuery('a#wp-post-thumbnail-' + id);
     5 	var $link = jQuery('a#wp-post-thumbnail-' + id);
     3 
     6 
     4 	$link.text( setPostThumbnailL10n.saving );
     7 	$link.text( setPostThumbnailL10n.saving );
     5 	jQuery.post(ajaxurl, {
     8 	jQuery.post(ajaxurl, {
     6 		action:"set-post-thumbnail", post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
     9 		action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
     7 	}, function(str){
    10 	}, function(str){
     8 		var win = window.dialogArguments || opener || parent || top;
    11 		var win = window.dialogArguments || opener || parent || top;
     9 		$link.text( setPostThumbnailL10n.setThumbnail );
    12 		$link.text( setPostThumbnailL10n.setThumbnail );
    10 		if ( str == '0' ) {
    13 		if ( str == '0' ) {
    11 			alert( setPostThumbnailL10n.error );
    14 			alert( setPostThumbnailL10n.error );