WordPress.org

Make WordPress Core

Ticket #10928: fix_set_thumbnail_js.diff

File fix_set_thumbnail_js.diff, 3.5 KB (added by scribu, 9 years ago)
  • wp-includes/script-loader.php

     
    372372                $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), '20090929' );
    373373                $scripts->add_data( 'image-edit', 'group', 1 );
    374374
    375                 $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20091015' );
     375                $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), '20091021' );
    376376                $scripts->add_data( 'set-post-thumbnail', 'group', 1 );
    377377                $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
    378                         'setThumbnail' => __( 'Use for thumbnail' ),
     378                        'setThumbnail' => __( 'Use as thumbnail' ),
    379379                        'saving' => __( 'Saving...' ),
    380380                        'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' )
    381381                ) );
  • wp-admin/js/set-post-thumbnail.dev.js

     
    11function WPSetAsThumbnail(id){
    2         jQuery('#media-item-' + id + ' > a.wp-post-thumbnail').text( setPostThumbnailL10n.saving ).attr('href', '#');
     2        var $link = jQuery('#media-item-' + id + ' a.wp-post-thumbnail');
     3
     4        $link.text( setPostThumbnailL10n.saving );
    35        jQuery.post(ajaxurl, {
    46                action:"set-post-thumbnail", post_id: post_id, thumbnail_id: id, cookie: encodeURIComponent(document.cookie)
    57        }, function(str){
    68                var win = window.dialogArguments || opener || parent || top;
     9                $link.text( setPostThumbnailL10n.setThumbnail );
    710                if ( str == '0' ) {
    811                        alert( setPostThumbnailL10n.error );
    912                } else {
    10                         jQuery('a.wp-post-thumbnail').text( setPostThumbnailL10n.setThumbnail );
    11                         jQuery('#media-item-' + id + ' > a.wp-post-thumbnail').hide();
     13                        jQuery('a.wp-post-thumbnail').show();
     14                        $link.hide();
    1215                        win.WPSetThumbnailID(id);
    1316                        win.WPSetThumbnailHTML(str);
    1417                }
    1518        }
    1619        );
    17 }
    18  No newline at end of file
     20}
  • wp-admin/js/set-post-thumbnail.js

     
    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)}})};
    2  No newline at end of file
     1function 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)}})};
     2 No newline at end of file