Make WordPress Core

Ticket #24046: 24046-omnipresent-fades.2.diff

File 24046-omnipresent-fades.2.diff, 5.8 KB (added by markjaquith, 12 years ago)
  • wp-admin/css/wp-admin.css

    body .ui-tooltip { 
    41134113        position: relative;
    41144114        text-decoration: none;
    41154115        text-align: center;
     4116        transition: opacity 0.2s linear;
     4117        opacity: 0.4;
     4118}
     4119
     4120.post-format-options:hover a,
     4121.post-format-options a.active {
     4122        opacity: 1.0;
    41164123}
    41174124
    41184125.post-format-options a div {
  • wp-admin/edit-form-advanced.php

    if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_ 
    135135        wp_enqueue_script( 'wp-mediaelement' );
    136136        wp_enqueue_style( 'wp-mediaelement' );
    137137        $post_format = get_post_format();
    138         $post_format_set_class = 'post-format-set';
    139138
    140139        if ( ! $post_format ) {
    141140                $post_format = 'standard';
    142141
    143142                if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) )
    144143                        $post_format = $_REQUEST['format'];
    145                 elseif ( 'auto-draft' == $post->post_status )
    146                         $post_format_set_class = '';
    147144        }
    148145
    149146        $user_wants = get_user_option( 'post_formats_' . $post_type );
  • wp-admin/includes/post-formats.php

    wp_nonce_field( 'show-post-format-ui_' . $post_type, 'show_post_format_ui_nonce' 
    1010
    1111?>
    1212<div class="wp-post-format-ui<?php if ( ! $show_post_format_ui ) echo ' no-ui' ?>">
    13         <div class="post-format-change"><span class="icon <?php echo esc_attr( $post_format ); ?>"></span> <span class="post-format-description"><?php echo $all_post_formats[$post_format]['description']; ?></span> <a href="#"><?php _e('Change format'); ?></a></div>
     13        <div class="post-format-change"><span class="icon <?php echo esc_attr( $post_format ); ?>"></span> <span class="post-format-description"><?php echo $all_post_formats[$post_format]['description']; ?></span></div>
    1414        <div class="post-formats-fields">
    1515
    1616                <input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" />
    wp_nonce_field( 'show-post-format-ui_' . $post_type, 'show_post_format_ui_nonce' 
    144144                        </div>
    145145                </div>
    146146        </div>
    147 </div>
    148  No newline at end of file
     147</div>
  • wp-admin/js/post-formats.js

    window.wp = window.wp || {}; 
    44        var container, $container, mediaFrame, lastMimeType, mediaPreview, lastHeight = 360, content, insertMediaButton,
    55                initialFormat = 'standard',
    66                shortClass = 'short-format',
     7                noTitleFormats = ['status'],
     8                noMediaFormats = ['status', 'aside'],
    79                shortContentFormats = ['status', 'aside'],
    810                noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
    911                $screenIcon = $( '.icon32' );
    1012
    1113
    1214        function switchFormatClass( format ) {
     15                $('#post_format').val(format);
     16                $('.post-format-change').show().find('span.icon').removeClass(postFormats.currentPostFormat).addClass(format);
    1317                container.get(0).className = container.get(0).className.replace( /\s?\bwp-format-[^ ]+/g, '' );
    1418                container.addClass('wp-format-' + format);
    1519                $screenIcon.get(0).className = $screenIcon.get(0).className.replace( /\s?\bwp-format-[^ ]+/g, '' );
    window.wp = window.wp || {}; 
    4549        }
    4650
    4751        function switchFormat($this) {
    48                 var editor, body,
     52                var editor, body, formatTo, formatFrom,
    4953                        parent = $this.parent(),
    5054                        format = $this.data('wp-format'),
    5155                        description = $('.post-format-description'),
    5256                        postTitle = $('#title');
    5357
     58                if ( format === postFormats.currentPostFormat )
     59                        return;
     60
    5461                if ( typeof container === 'undefined' )
    5562                        container = $('#post-body-content');
    5663
    57                 parent.slideUp().find('a.active').removeClass('active');
     64                parent.find('a.active').removeClass('active');
    5865                $this.addClass('active');
    59                 $('#post_format').val(format);
    60                 $('.post-format-change').show().find('span.icon').removeClass(postFormats.currentPostFormat).addClass(format);
    6166
    62                 if ( -1 < $.inArray( format, noUIFormats ) ) {
     67                // Animate the media button going away or coming back
     68                formatTo = -1 < $.inArray( format, noMediaFormats );
     69                formatFrom = -1 < $.inArray( postFormats.currentPostFormat, noMediaFormats );
     70                if ( formatFrom ? !formatTo : formatTo ) // XOR
     71                        insertMediaButton.fadeToggle( 200 );
     72
     73                // Animate the title going away or coming back
     74                formatTo = -1 < $.inArray( format, noTitleFormats );
     75                formatFrom = -1 < $.inArray( postFormats.currentPostFormat, noTitleFormats );
     76                if ( formatFrom ? !formatTo : formatTo ) // XOR
     77                        $('#titlewrap').fadeToggle( 200 );
     78
     79                console.log( format );
     80                console.log( postFormats.currentPostFormat );
     81                console.log( noUIFormats );
     82
     83                if ( -1 < $.inArray( format, noUIFormats ) && -1 < $.inArray( postFormats.currentPostFormat, noUIFormats ) ) {
    6384                        switchFormatClass( format ); // No slide
    64                         $container.hide();
     85                        $container.slideUp();
    6586                } else {
    66                         $container.slideUp( 200, function(){
     87                        $container.slideUp( 400, function(){
    6788                                switchFormatClass( format );
    68                                 $container.slideDown( 400 );
     89                                if ( -1 == $.inArray( format, noUIFormats ) )
     90                                        $container.slideDown( 400 );
    6991                        });
    7092                }
    7193
    window.wp = window.wp || {}; 
    119141                        });
    120142                });
    121143
    122                 $('.post-format-change a').click(function() {
    123                         $('.post-formats-fields, .post-format-change').slideUp();
    124                         $('.post-format-options').slideDown();
    125                         return false;
    126                 });
    127 
    128144                // Post formats selection
    129145                $('.post-format-options').on( 'click', 'a', function (e) {
    130146                        e.preventDefault();