wp/wp-admin/js/set-post-thumbnail.js
author ymh <ymh.work@gmail.com>
Fri, 05 Sep 2025 18:40:08 +0200
changeset 21 48c4eec2b7e6
parent 16 a86126ab1dd4
permissions -rw-r--r--
Add CLAUDE.md documentation and sync WordPress core files - Add comprehensive CLAUDE.md documentation file with project architecture, development setup, database operations, WordPress CLI usage, file sync procedures, and Mercurial commands - Update WordPress core files from wordpress/ to wp/ directory - Sync latest WordPress admin interface, includes, and core functionality - Update plugins: portfolio plugin with latest BWS framework and fancybox integration - Maintain custom configuration and theme files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
     1
/**
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
     2
 * @output wp-admin/js/set-post-thumbnail.js
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
     3
 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
     4
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
     5
/* global ajaxurl, post_id, alert */
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     6
/* exported WPSetAsThumbnail */
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
     7
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
     8
window.WPSetAsThumbnail = function( id, nonce ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
	var $link = jQuery('a#wp-post-thumbnail-' + id);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    11
	$link.text( wp.i18n.__( 'Saving…' ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
	jQuery.post(ajaxurl, {
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    13
		action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
	}, function(str){
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
		var win = window.dialogArguments || opener || parent || top;
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    16
		$link.text( wp.i18n.__( 'Use as featured image' ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
		if ( str == '0' ) {
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    18
			alert( wp.i18n.__( 'Could not set that as the thumbnail image. Try a different attachment.' ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
		} else {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
			jQuery('a.wp-post-thumbnail').show();
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    21
			$link.text( wp.i18n.__( 'Done' ) );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
			$link.fadeOut( 2000 );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
			win.WPSetThumbnailID(id);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
			win.WPSetThumbnailHTML(str);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
	);
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    28
};