2009-10-07 18:18:09 -04:00
|
|
|
function WPSetAsThumbnail(id){
|
2009-12-10 03:03:26 -05:00
|
|
|
var $link = jQuery('a#wp-post-thumbnail-' + id);
|
2009-10-26 14:02:44 -04:00
|
|
|
|
|
|
|
$link.text( setPostThumbnailL10n.saving );
|
2009-10-07 18:18:09 -04:00
|
|
|
jQuery.post(ajaxurl, {
|
|
|
|
action:"set-post-thumbnail", post_id: post_id, thumbnail_id: id, cookie: encodeURIComponent(document.cookie)
|
|
|
|
}, function(str){
|
|
|
|
var win = window.dialogArguments || opener || parent || top;
|
2009-10-26 14:02:44 -04:00
|
|
|
$link.text( setPostThumbnailL10n.setThumbnail );
|
2009-10-07 18:18:09 -04:00
|
|
|
if ( str == '0' ) {
|
|
|
|
alert( setPostThumbnailL10n.error );
|
|
|
|
} else {
|
2009-10-26 14:02:44 -04:00
|
|
|
jQuery('a.wp-post-thumbnail').show();
|
2009-12-10 02:34:32 -05:00
|
|
|
$link.text( setPostThumbnailL10n.done );
|
|
|
|
$link.fadeOut( 2000 );
|
2009-10-07 18:18:09 -04:00
|
|
|
win.WPSetThumbnailID(id);
|
|
|
|
win.WPSetThumbnailHTML(str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2009-10-26 14:02:44 -04:00
|
|
|
}
|