CoreFiles by mySites.guru
set-post-thumbnail.js28 lines, 876 bytes, from wordpress-6.2.zip
Raw History Compare with 6.1.16
md5
3a314eb02806e8786c018f58ddfcbf27
sha1
b13afbe997b82aebcb55889d3bae4f31863be1ce
sha256
45ed6c0473f932521499fa2f8481ad2664820d4d8683729b47d571846751f480
/**
 * @output wp-admin/js/set-post-thumbnail.js
 */

/* global ajaxurl, post_id, alert */
/* exported WPSetAsThumbnail */

window.WPSetAsThumbnail = function( id, nonce ) {
	var $link = jQuery('a#wp-post-thumbnail-' + id);

	$link.text( wp.i18n.__( 'Saving…' ) );
	jQuery.post(ajaxurl, {
		action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
	}, function(str){
		var win = window.dialogArguments || opener || parent || top;
		$link.text( wp.i18n.__( 'Use as featured image' ) );
		if ( str == '0' ) {
			alert( wp.i18n.__( 'Could not set that as the thumbnail image. Try a different attachment.' ) );
		} else {
			jQuery('a.wp-post-thumbnail').show();
			$link.text( wp.i18n.__( 'Done' ) );
			$link.fadeOut( 2000 );
			win.WPSetThumbnailID(id);
			win.WPSetThumbnailHTML(str);
		}
	}
	);
};

The same content is in 445 releases, WordPress 5.5-beta1 to 7.2-RC1. See them all, or every version of this file.