thumbnail JS fixes. props scribu. see #10928
git-svn-id: http://svn.automattic.com/wordpress/trunk@12111 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
34f36995f2
commit
085c01ac7a
|
@ -1,14 +1,17 @@
|
|||
function WPSetAsThumbnail(id){
|
||||
jQuery('#media-item-' + id + ' > a.wp-post-thumbnail').text( setPostThumbnailL10n.saving ).attr('href', '#');
|
||||
var $link = jQuery('#media-item-' + id + ' a.wp-post-thumbnail');
|
||||
|
||||
$link.text( setPostThumbnailL10n.saving );
|
||||
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;
|
||||
$link.text( setPostThumbnailL10n.setThumbnail );
|
||||
if ( str == '0' ) {
|
||||
alert( setPostThumbnailL10n.error );
|
||||
} else {
|
||||
jQuery('a.wp-post-thumbnail').text( setPostThumbnailL10n.setThumbnail );
|
||||
jQuery('#media-item-' + id + ' > a.wp-post-thumbnail').hide();
|
||||
jQuery('a.wp-post-thumbnail').show();
|
||||
$link.hide();
|
||||
win.WPSetThumbnailID(id);
|
||||
win.WPSetThumbnailHTML(str);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
function WPSetAsThumbnail(id){jQuery("#media-item-"+id+" > a.wp-post-thumbnail").text(setPostThumbnailL10n.saving).attr("href","#");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;if(str=="0"){alert(setPostThumbnailL10n.error)}else{jQuery("a.wp-post-thumbnail").text(setPostThumbnailL10n.setThumbnail);jQuery("#media-item-"+id+" > a.wp-post-thumbnail").hide();win.WPSetThumbnailID(id);win.WPSetThumbnailHTML(str)}})};
|
||||
function WPSetAsThumbnail(id){var $link=jQuery("#media-item-"+id+" a.wp-post-thumbnail");$link.text(setPostThumbnailL10n.saving);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;$link.text(setPostThumbnailL10n.setThumbnail);if(str=="0"){alert(setPostThumbnailL10n.error)}else{jQuery("a.wp-post-thumbnail").show();$link.hide();win.WPSetThumbnailID(id);win.WPSetThumbnailHTML(str)}})};
|
|
@ -372,10 +372,10 @@ function wp_default_scripts( &$scripts ) {
|
|||
$scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), '20090929' );
|
||||
$scripts->add_data( 'image-edit', 'group', 1 );
|
||||
|
||||
$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20091015' );
|
||||
$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20091021' );
|
||||
$scripts->add_data( 'set-post-thumbnail', 'group', 1 );
|
||||
$scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
|
||||
'setThumbnail' => __( 'Use for thumbnail' ),
|
||||
'setThumbnail' => __( 'Use as thumbnail' ),
|
||||
'saving' => __( 'Saving...' ),
|
||||
'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' )
|
||||
) );
|
||||
|
|
Loading…
Reference in New Issue