web/wp-admin/js/set-post-thumbnail.dev.js
changeset 204 09a1c134465b
parent 203 f507feede89a
child 205 a4f7897e21a9
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
     1 function WPSetAsThumbnail(id, nonce){
       
     2 	var $link = jQuery('a#wp-post-thumbnail-' + id);
       
     3 
       
     4 	$link.text( setPostThumbnailL10n.saving );
       
     5 	jQuery.post(ajaxurl, {
       
     6 		action:"set-post-thumbnail", post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent(document.cookie)
       
     7 	}, function(str){
       
     8 		var win = window.dialogArguments || opener || parent || top;
       
     9 		$link.text( setPostThumbnailL10n.setThumbnail );
       
    10 		if ( str == '0' ) {
       
    11 			alert( setPostThumbnailL10n.error );
       
    12 		} else {
       
    13 			jQuery('a.wp-post-thumbnail').show();
       
    14 			$link.text( setPostThumbnailL10n.done );
       
    15 			$link.fadeOut( 2000 );
       
    16 			win.WPSetThumbnailID(id);
       
    17 			win.WPSetThumbnailHTML(str);
       
    18 		}
       
    19 	}
       
    20 	);
       
    21 }