Another attempt to fix the http blog redirects.
[WebKit-https.git] / Websites / webkit.org / blog / wp-admin / js / set-post-thumbnail.dev.js
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 }