wp/wp-admin/js/set-post-thumbnail.js
changeset 9 177826044cd9
parent 5 5e2f62d02dcd
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
       
     1 /**
       
     2  * @output wp-admin/js/set-post-thumbnail.js
       
     3  */
       
     4 
     1 /* global setPostThumbnailL10n, ajaxurl, post_id, alert */
     5 /* global setPostThumbnailL10n, ajaxurl, post_id, alert */
     2 /* exported WPSetAsThumbnail */
     6 /* exported WPSetAsThumbnail */
     3 
     7 
     4 function WPSetAsThumbnail( id, nonce ) {
     8 window.WPSetAsThumbnail = function( id, nonce ) {
     5 	var $link = jQuery('a#wp-post-thumbnail-' + id);
     9 	var $link = jQuery('a#wp-post-thumbnail-' + id);
     6 
    10 
     7 	$link.text( setPostThumbnailL10n.saving );
    11 	$link.text( setPostThumbnailL10n.saving );
     8 	jQuery.post(ajaxurl, {
    12 	jQuery.post(ajaxurl, {
     9 		action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
    13 		action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
    19 			win.WPSetThumbnailID(id);
    23 			win.WPSetThumbnailID(id);
    20 			win.WPSetThumbnailHTML(str);
    24 			win.WPSetThumbnailHTML(str);
    21 		}
    25 		}
    22 	}
    26 	}
    23 	);
    27 	);
    24 }
    28 };