2009-10-08 00:18:09 +02:00
|
|
|
function WPSetAsThumbnail(id){
|
2009-12-10 09:03:26 +01:00
|
|
|
var $link = jQuery('a#wp-post-thumbnail-' + id);
|
2009-10-26 19:02:44 +01:00
|
|
|
|
|
|
|
$link.text( setPostThumbnailL10n.saving );
|
2009-10-08 00:18:09 +02: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 19:02:44 +01:00
|
|
|
$link.text( setPostThumbnailL10n.setThumbnail );
|
2009-10-08 00:18:09 +02:00
|
|
|
if ( str == '0' ) {
|
|
|
|
alert( setPostThumbnailL10n.error );
|
|
|
|
} else {
|
2009-10-26 19:02:44 +01:00
|
|
|
jQuery('a.wp-post-thumbnail').show();
|
2009-12-10 08:34:32 +01:00
|
|
|
$link.text( setPostThumbnailL10n.done );
|
|
|
|
$link.fadeOut( 2000 );
|
2009-10-08 00:18:09 +02:00
|
|
|
win.WPSetThumbnailID(id);
|
|
|
|
win.WPSetThumbnailHTML(str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2009-10-26 19:02:44 +01:00
|
|
|
}
|