1 /* global setPostThumbnailL10n, ajaxurl, post_id, alert */
2 /* exported WPSetAsThumbnail */
4 function WPSetAsThumbnail( id, nonce ) {
5 var $link = jQuery('a#wp-post-thumbnail-' + id);
7 $link.text( setPostThumbnailL10n.saving );
9 action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
11 var win = window.dialogArguments || opener || parent || top;
12 $link.text( setPostThumbnailL10n.setThumbnail );
14 alert( setPostThumbnailL10n.error );
16 jQuery('a.wp-post-thumbnail').show();
17 $link.text( setPostThumbnailL10n.done );
18 $link.fadeOut( 2000 );
19 win.WPSetThumbnailID(id);
20 win.WPSetThumbnailHTML(str);