Make WordPress Core

Ticket #24046: 24046.diff

File 24046.diff, 17.4 KB (added by markjaquith, 12 years ago)

restoring patch from lessbloat (I'm an idiot and overwrote it)

  • wp-admin/css/wp-admin-rtl.css

    table.diff td, table.diff th { 
    971971  11.4 - Post format selection
    972972------------------------------------------------------------------------------*/
    973973
    974 .post-format-options a {
    975         border-left: 1px solid #ebebeb;
    976         border-right: none;
    977 }
    978 
    979 .post-format-options a:first-child {
    980         -webkit-border-bottom-left-radius: 0;
    981         -webkit-border-top-left-radius: 0;
    982         border-bottom-left-radius: 0;
    983         border-top-left-radius: 0;
    984 }
    985974
    986 .post-format-options a:last-child {
    987         -webkit-border-bottom-right-radius: 3px;
    988         -webkit-border-top-right-radius: 3px;
    989         border-bottom-right-radius: 3px;
    990         border-top-right-radius: 3px;
    991 }
    992 
    993 .post-format-tip {
    994         float: left;
    995 }
    996975
    997976/*------------------------------------------------------------------------------
    998977  12.0 - Categories
  • wp-admin/css/wp-admin.css

    ul.cat-checklist { 
    30243024
    30253025#titlediv {
    30263026        position: relative;
    3027         margin-bottom: 10px;
     3027        margin-bottom: 5px;
    30283028}
    30293029
    30303030#titlediv label {
    ul.cat-checklist { 
    30473047        height: 1.7em;
    30483048        width: 100%;
    30493049        outline: none;
     3050        margin: 1px 0;
    30503051}
    30513052
    30523053#titlediv #title-prompt-text,
    input#link_url { 
    30903091        line-height: 23px;
    30913092        min-height: 23px;
    30923093        margin-top: 5px;
    3093         padding: 0 10px;
     3094        border: 1px dotted #eee;
     3095        padding: 6px 6px 5px;
     3096        border-radius: 3px;
     3097        background: #f9f9f9;
    30943098}
    30953099
    30963100#edit-slug-box .cancel {
    body .ui-tooltip { 
    39303934
    39313935.post-formats-fields {
    39323936        display: none;
     3937        margin-bottom: 15px;
    39333938}
    39343939
    39353940.wp-format-gallery .post-formats-fields,
    body .ui-tooltip { 
    40304035        min-height: 97px;
    40314036}
    40324037
    4033 #icon-edit.standard {
     4038#icon-edit.standard,
     4039.post-format-options .standard {
    40344040        background: url(../images/post-formats32.png) no-repeat -3px -4px;
    40354041}
    40364042
    4037 #icon-edit.image {
     4043#icon-edit.image,
     4044.post-format-options .image {
    40384045        background: url(../images/post-formats32.png) no-repeat  -43px -4px;
    40394046}
    40404047
    4041 #icon-edit.gallery {
     4048#icon-edit.gallery,
     4049.post-format-options .gallery {
    40424050        background: url(../images/post-formats32.png) no-repeat -83px -4px;
    40434051}
    40444052
    4045 #icon-edit.audio {
     4053#icon-edit.audio,
     4054.post-format-options .audio {
    40464055        background: url(../images/post-formats32.png) no-repeat -123px -4px;
    40474056}
    40484057
    4049 #icon-edit.video {
     4058#icon-edit.video,
     4059.post-format-options .video {
    40504060        background: url(../images/post-formats32.png) no-repeat -163px -4px;
    40514061}
    40524062
    4053 #icon-edit.chat {
     4063#icon-edit.chat,
     4064.post-format-options .chat {
    40544065        background: url(../images/post-formats32.png) no-repeat -202px -4px;
    40554066}
    40564067
    4057 #icon-edit.status {
     4068#icon-edit.status,
     4069.post-format-options .status {
    40584070        background: url(../images/post-formats32.png) no-repeat -242px -4px;
    40594071}
    40604072
    4061 #icon-edit.aside {
     4073#icon-edit.aside,
     4074.post-format-options .aside {
    40624075        background: url(../images/post-formats32.png) no-repeat -282px -4px;
    40634076}
    40644077
    4065 #icon-edit.quote {
     4078#icon-edit.quote,
     4079.post-format-options .quote {
    40664080        background: url(../images/post-formats32.png) no-repeat -322px -4px;
    40674081}
    40684082
    4069 #icon-edit.link {
     4083#icon-edit.link,
     4084.post-format-options .link {
    40704085        background: url(../images/post-formats32.png) no-repeat -362px -4px;
    40714086}
    40724087
    40734088.post-format-description {
    40744089        color: #666;
    4075         display: none;
    4076         margin: 10px 0;
     4090        font-size: 12px;
    40774091}
    40784092
    40794093.post-format-options {
    4080         height: 29px;
    4081         background: #f9f9f9;
    4082         border: 1px solid #dfdfdf;
    4083         -webkit-border-radius: 3px;
    4084         border-radius: 3px;
    4085         margin: 0 0 9px 1px;
     4094        height: 50px;
     4095        margin: 13px 0 10px;
    40864096        padding: 0;
    40874097}
    40884098
    40894099.post-format-options a {
    4090         border-right: 1px solid #ebebeb;
    40914100        display: inline-block;
    4092         height: 16px;
    4093         width: 16px;
    4094         padding: 6px;
     4101        height: 34px;
     4102        margin-right: 33px;
    40954103        position: relative;
    40964104        text-decoration: none;
     4105        text-align: center;
    40974106}
    40984107
    4099 .post-format-options a:first-child {
    4100         -webkit-border-bottom-left-radius: 3px;
    4101         -webkit-border-top-left-radius: 3px;
    4102         border-bottom-left-radius: 3px;
    4103         border-top-left-radius: 3px;
     4108.post-format-options a div {
     4109        height: 34px;
     4110        width: 34px;
     4111        margin: 0 auto;
    41044112}
    41054113
    4106 .post-format-options a.active,
    4107 .post-format-options a:focus,
    4108 .post-format-options a:hover {
    4109         background: #eee;
    4110         -webkit-box-shadow: inset 0 0 10px #ddd;
    4111         box-shadow: inset 0 0 10px #ddd;
    4112         outline: none;
    4113         opacity: 1;
     4114.post-format-title {
     4115        color: #777;
     4116        display: block;
     4117        margin-top: 4px;
     4118        text-decoration: underline;
    41144119}
    41154120
    4116 .post-format-options a div {
    4117         height: 16px;
    4118         width: 16px;
    4119         opacity: 0.4;
     4121.post-format-change,
     4122.post-format-description {
     4123        display: none;
    41204124}
    41214125
    4122 .post-format-options a.active div,
    4123 .post-format-options a:focus div,
    4124 .post-format-options a:hover div {
    4125         opacity: 1;
     4126.post-format-set .post-format-options {
     4127        display: none;
    41264128}
    41274129
    4128 .post-format-options .standard {
     4130.post-format-set .post-format-change {
     4131        display: block;
     4132}
     4133
     4134#poststuff .post-format-change {
     4135        margin: 11px 0 13px;
     4136        padding: 0;
     4137        font-size: 1.5em;
     4138        line-height: 18px;
     4139        clear: left;
     4140}
     4141
     4142.post-format-change span.icon {
     4143        float: left;
     4144        height: 16px;
     4145        margin: 2px 5px 0 0;
     4146        width: 16px;
     4147}
     4148
     4149.post-format-change span.icon.standard {
    41294150        background: url(../images/post-formats.png) no-repeat -8px -8px;
    41304151}
    41314152
    4132 .post-format-options .image {
     4153.post-format-change span.icon.image {
    41334154        background: url(../images/post-formats.png) no-repeat -40px -8px;
    41344155}
    41354156
    4136 .post-format-options .gallery {
     4157.post-format-change span.icon.gallery {
    41374158        background: url(../images/post-formats.png) no-repeat -72px -8px;
    41384159}
    41394160
    4140 .post-format-options .audio {
     4161.post-format-change span.icon.audio {
    41414162        background: url(../images/post-formats.png) no-repeat -104px -8px;
    41424163}
    41434164
    4144 .post-format-options .video {
     4165.post-format-change span.icon.video {
    41454166        background: url(../images/post-formats.png) no-repeat -136px -8px;
    41464167}
    41474168
    4148 .post-format-options .chat {
     4169.post-format-change span.icon.chat {
    41494170        background: url(../images/post-formats.png) no-repeat -168px -8px;
    41504171}
    41514172
    4152 .post-format-options .status {
     4173.post-format-change span.icon.status {
    41534174        background: url(../images/post-formats.png) no-repeat -200px -8px;
    41544175}
    41554176
    4156 .post-format-options .aside {
     4177.post-format-change span.icon.aside {
    41574178        background: url(../images/post-formats.png) no-repeat -232px -8px;
    41584179}
    41594180
    4160 .post-format-options .quote {
     4181.post-format-change span.icon.quote {
    41614182        background: url(../images/post-formats.png) no-repeat -264px -8px;
    41624183}
    41634184
    4164 .post-format-options .link {
     4185.post-format-change span.icon.link {
    41654186        background: url(../images/post-formats.png) no-repeat -296px -8px;
    41664187}
    41674188
    4168 .post-format-tip {
    4169         color: #999;
    4170         font-size: 14px;
    4171         float: right;
    4172         padding: 6px 10px;
    4173         text-transform: capitalize;
     4189.post-format-change a {
     4190        font-size: 12px;
     4191}
     4192
     4193@media only screen and (max-width: 782px) {
     4194        .post-format-options {
     4195                height: 33px;
     4196        }
     4197       
     4198        .post-format-options a {
     4199                margin-right: 19px;
     4200        }
     4201       
     4202        .post-format-options a div {
     4203                height: 18px;
     4204                width: 16px;
     4205        }
     4206       
     4207        .post-format-options .standard {
     4208                background: url(../images/post-formats.png) no-repeat -8px -8px;
     4209        }
     4210       
     4211        .post-format-options .image {
     4212                background: url(../images/post-formats.png) no-repeat -40px -8px;
     4213        }
     4214       
     4215        .post-format-options .gallery {
     4216                background: url(../images/post-formats.png) no-repeat -72px -8px;
     4217        }
     4218       
     4219        .post-format-options .audio {
     4220                background: url(../images/post-formats.png) no-repeat -104px -8px;
     4221        }
     4222       
     4223        .post-format-options .video {
     4224                background: url(../images/post-formats.png) no-repeat -136px -8px;
     4225        }
     4226       
     4227        .post-format-options .chat {
     4228                background: url(../images/post-formats.png) no-repeat -168px -8px;
     4229        }
     4230       
     4231        .post-format-options .status {
     4232                background: url(../images/post-formats.png) no-repeat -200px -8px;
     4233        }
     4234       
     4235        .post-format-options .aside {
     4236                background: url(../images/post-formats.png) no-repeat -232px -8px;
     4237        }
     4238       
     4239        .post-format-options .quote {
     4240                background: url(../images/post-formats.png) no-repeat -264px -8px;
     4241        }
     4242       
     4243        .post-format-options .link {
     4244                background: url(../images/post-formats.png) no-repeat -296px -8px;
     4245        }
    41744246}
    41754247
    41764248/*------------------------------------------------------------------------------
  • wp-admin/edit-form-advanced.php

    if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'show_po 
    133133        wp_enqueue_script( 'wp-mediaelement' );
    134134        wp_enqueue_style( 'wp-mediaelement' );
    135135        $post_format = get_post_format();
     136        $post_format_set_class = 'post-format-set';
    136137
    137         if ( ! $post_format )
     138        if ( ! $post_format ) {
    138139                $post_format = 'standard';
     140                $post_format_set_class = '';
     141        }
    139142
    140143        $format_class = " class='wp-format-{$post_format}'";
    141144
    142145
    143146        $all_post_formats = array(
    144147                'standard' => array (
    145                         'description' => __( 'Add a title and use the editor to compose your post.' )
     148                        'description' => __( 'Use the editor below to compose your post.' )
    146149                ),
    147150                'image' => array (
    148                         'description' => __( 'Select or upload an image to use for your post.' )
     151                        'description' => __( 'Select or upload an image for your post.' )
    149152                ),
    150153                'gallery' => array (
    151154                        'description' => __( 'Use the Add Media button to select or upload images for your gallery.' )
    if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'show_po 
    166169                        'description' => __( 'Use the editor to compose a status update. What’s new?' )
    167170                ),
    168171                'quote' => array (
    169                         'description' => __( 'Copy a quotation into the box. Also add the source and URL if you have them.' )
     172                        'description' => __( 'Copy a quotation into the box below. Add a source and URL if you have them.' )
    170173                ),
    171174                'aside' => array (
    172                         'description' => __( 'An aside is a quick thought or side topic. Use the editor to compose one.' )
     175                        'description' => __( 'Use the editor to share a quick thought or side topic.' )
    173176                )
    174177        );
    175178        $post_format_options = '';
    if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'show_po 
    181184                        $active_post_type_slug = $slug;
    182185                }
    183186
    184                 $post_format_options .= '<a ' . $class . ' href="?format=' . $slug . '" data-description="' . $attr['description'] . '" data-wp-format="' . $slug . '" title="' . ucfirst( sprintf( __( '%s Post' ), $slug ) ) . '"><div class="' . $slug . '"></div></a>';
     187                $post_format_options .= '<a ' . $class . ' href="?format=' . $slug . '" data-description="' . $attr['description'] . '" data-wp-format="' . $slug . '" title="' . ucfirst( $slug ) . '"><div class="' . $slug . '"></div><span class="post-format-title">' . ucfirst( $slug ) . '</span></a>';
    185188        }
    186189
    187190        $current_post_format = array( 'currentPostFormat' => esc_html( $active_post_type_slug ) );
    if ( 'post' == $post_type ) { 
    358361require_once('./admin-header.php');
    359362?>
    360363
    361 <div class="wrap">
     364<div class="wrap <?php echo $post_format_set_class; ?>">
    362365<?php screen_icon(); ?>
    363366<h2><?php
    364367echo esc_html( $title );
    if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create 
    374377<div id="lost-connection-notice" class="error hidden">
    375378        <p><?php _e("You have lost your connection with the server, and saving has been disabled. This message will vanish once you've reconnected."); ?></p>
    376379</div>
     380<?php if ( ! empty( $post_format_options ) ) : ?>
     381<div class="post-format-options">
     382        <?php echo $post_format_options; ?>
     383</div>
     384<?php endif; ?>
    377385<form name="post" action="post.php" method="post" id="post"<?php do_action('post_edit_form_tag'); ?>>
    378386<?php wp_nonce_field($nonce_action); ?>
    379387<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
    wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); 
    400408<div id="poststuff">
    401409<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
    402410<div id="post-body-content"<?php echo $format_class; ?>>
    403 
    404 <?php if ( ! empty( $post_format_options ) ) : ?>
    405 <div class="post-format-options">
    406         <span class="post-format-tip">Standard Post</span>
    407         <?php echo $post_format_options; ?>
    408 </div>
    409 <?php endif; ?>
    410 
    411411<?php if ( post_type_supports($post_type, 'title') ) { ?>
    412412<div id="titlediv">
    413413<div id="titlewrap">
  • wp-admin/includes/post-formats.php

    global $wp_embed; 
    33$format_meta = get_post_format_meta( $post_ID );
    44
    55?>
    6 <div class="post-format-description"></div>
     6<div class="post-format-change"><span class="icon"></span> <span class="post-format-description"></span> <a href="#"><?php _e('Change format'); ?></a></div>
    77<div class="post-formats-fields">
    88
    99        <input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" />
  • wp-admin/js/post-formats.js

     
    11window.wp = window.wp || {};
    22
    33(function($) {
    4         var container, mediaFrame, lastMimeType, lastMenu, mediaPreview, noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'];
     4        var container, mediaFrame, lastMimeType, lastMenu, mediaPreview,
     5                noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
     6                $container = $( '.post-formats-fields' );
    57
    68        function switchFormatClass( format ) {
    79                container.get(0).className = container.get(0).className.replace( /\bwp-format-[^ ]+/, '' );
    810                container.addClass('wp-format-' + format);
    911        }
    10 
    11         $(function(){
    12                 var $container = $( '.post-formats-fields' );
    13 
    14                 // Post formats selection
    15                 $('.post-format-options').on( 'click', 'a', function(e){
    16                         e.preventDefault();
    17                         var $this = $(this), editor, body,
    18                                 parent = $this.parent(),
    19                                 format = $this.data('wp-format'),
    20                                 description = $('.post-format-description');
     12       
     13        function switchFormat ($this) {
     14                var editor, body,
     15                        parent = $this.parent(),
     16                        format = $this.data('wp-format'),
     17                        description = $('.post-format-description'),
     18                        postTitle = $('#title');
    2119
    2220                if ( typeof container === 'undefined' )
    2321                        container = $('#post-body-content');
    24 
    25                         // Already on this post format. Bail.
    26                         if ( format === postFormats.currentPostFormat )
    27                                 return;
    28 
    29                         parent.find('a.active').removeClass('active');
    30                         $this.addClass('active');
    31                         $('#icon-edit').removeClass(postFormats.currentPostFormat).addClass(format);
    32                         $('#post_format').val(format);
    33 
    34                         if ( -1 < $.inArray( format, noUIFormats ) && -1 < $.inArray( postFormats.currentPostFormat, noUIFormats ) ) {
    35                                 switchFormatClass( format ); // No slide
    36                         } else {
    37                                 $container.slideUp( 200, function(){
    38                                         switchFormatClass( format );
    39                                         $container.slideDown( 400 );
    40                                 });
     22       
     23                parent.slideUp().find('a.active').removeClass('active');
     24                $this.addClass('active');
     25                $('#post_format').val(format);
     26                $('.post-format-change').show().find('span.icon').removeClass(postFormats.currentPostFormat).addClass(format);
     27                container.addClass('wp-format-set');
     28       
     29                if ( -1 < $.inArray( format, noUIFormats ) ) {
     30                        switchFormatClass( format ); // No slide
     31                        $container.hide();
     32                } else {
     33                        $container.slideUp( 200, function(){
     34                                switchFormatClass( format );
     35                                $container.slideDown( 400 );
     36                        });
     37                }
     38       
     39                postTitle.focus();
     40               
     41                if ( '' === postTitle.val() )
     42                        $('#title-prompt-text').removeClass('screen-reader-text');
     43       
     44                // Update description line
     45                description.html($this.data('description'));
     46       
     47                if (description.not(':visible'))
     48                        description.slideDown('fast');
     49       
     50                if ( typeof tinymce != 'undefined' ) {
     51                        editor = tinymce.get('content');
     52       
     53                        if ( editor ) {
     54                                body = editor.getBody();
     55                                body.className = body.className.replace( /\bpost-format-[^ ]+/, '' );
     56                                editor.dom.addClass( body, 'post-format-' + format );
    4157                        }
     58                }
     59       
     60                postFormats.currentPostFormat = format;
     61        }
    4262
    43                         $('#title').focus();
    44 
    45                         // Update description line
    46                         description.html($this.data('description'));
    47 
    48                         if (description.not(':visible'))
    49                                 description.slideDown('fast');
    50 
    51                         if ( typeof tinymce != 'undefined' ) {
    52                                 editor = tinymce.get('content');
    53 
    54                                 if ( editor ) {
    55                                         body = editor.getBody();
    56                                         body.className = body.className.replace( /\bpost-format-[^ ]+/, '' );
    57                                         editor.dom.addClass( body, 'post-format-' + format );
    58                                 }
    59                         }
     63        $(function(){
     64                var ignoreTitleKeydown = false;
     65               
     66                if ( $('.wrap').hasClass('post-format-set') )
     67                        switchFormat($('.post-format-options a[data-wp-format=' + postFormats.currentPostFormat + ']'));
     68               
     69                $('.post-format-change a').click(function () {
     70                        $('.post-formats-fields, .post-format-change').slideUp();
     71                        $('.post-format-options').slideDown();
     72                        return false;
     73                });
     74               
     75                $('#title').on('keydown', function () {
     76                        if (ignoreTitleKeydown || ! $('.post-format-options').is(":visible"))
     77                                return;
    6078
    61                         postFormats.currentPostFormat = format;
    62                 }).on('mouseenter focusin', 'a', function () {
    63                         $('.post-format-tip').html( $(this).prop('title') );
    64                 }).on('mouseleave focusout', 'a', function () {
    65                         $('.post-format-tip').html( $('.post-format-options a.active').prop('title') );
     79                        switchFormat($('.post-format-options a[data-wp-format=' + postFormats.currentPostFormat + ']'));
     80                        $('#title-prompt-text').addClass('screen-reader-text');
     81                       
     82                        ignoreTitleKeydown = true;
     83                });
     84               
     85                // Post formats selection
     86                $('.post-format-options').on( 'click', 'a', function(e){
     87                        e.preventDefault();
     88                        switchFormat($(this));
    6689                });
    6790
    6891                // Media selection