From 085c01ac7a10fda57dfc4974fbb513ee68f2966c Mon Sep 17 00:00:00 2001 From: markjaquith Date: Mon, 26 Oct 2009 18:02:44 +0000 Subject: [PATCH] thumbnail JS fixes. props scribu. see #10928 git-svn-id: http://svn.automattic.com/wordpress/trunk@12111 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/set-post-thumbnail.dev.js | 11 +++++++---- wp-admin/js/set-post-thumbnail.js | 2 +- wp-includes/script-loader.php | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/wp-admin/js/set-post-thumbnail.dev.js b/wp-admin/js/set-post-thumbnail.dev.js index d331bd4a10..fffdc1c3ed 100644 --- a/wp-admin/js/set-post-thumbnail.dev.js +++ b/wp-admin/js/set-post-thumbnail.dev.js @@ -1,17 +1,20 @@ 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); } } ); -} \ No newline at end of file +} diff --git a/wp-admin/js/set-post-thumbnail.js b/wp-admin/js/set-post-thumbnail.js index 3967c8e994..d432a7b69d 100644 --- a/wp-admin/js/set-post-thumbnail.js +++ b/wp-admin/js/set-post-thumbnail.js @@ -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)}})}; \ No newline at end of file +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)}})}; \ No newline at end of file diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 9fcb7d7980..76bb7dbb99 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -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.' ) ) );