Make WordPress Core

Ticket #24291: 24291.16.diff

File 24291.16.diff, 9.1 KB (added by markjaquith, 12 years ago)
  • wp-admin/css/wp-admin.css

    body .ui-slider-tooltip { 
    40074007        overflow: hidden;
    40084008        width: 40%;
    40094009        height: auto;
    4010         padding: 55px 0 20px;
    40114010        border: 1px dashed #dfdfdf;
    40124011        background: #f5f5f5 url(../images/media-button-2x.png) no-repeat 50% 25%;
     4012        box-sizing: border-box;
    40134013}
    40144014
    40154015.wp-format-media-holder:hover {
    40164016        background-color: #eee;
    40174017}
    40184018
     4019.wp-format-image .wp-format-media-holder {
     4020        margin-top: 17px;
     4021}
     4022
    40194023.wp-format-media-preview {
    40204024        margin-bottom: 20px;
    40214025}
    40224026
     4027#image-preview img {
     4028        width: auto;
     4029        max-height: 300px;
     4030}
     4031
     4032.wp-format-image p.use-url-or-html {
     4033        padding-top: 10px;
     4034        clear: both;
     4035        width: 40%;
     4036        text-align: center;
     4037}
     4038
     4039body.wp-format-image .attachment-display-settings {
     4040        display: none;
     4041}
     4042
    40234043.wp-format-status #titlewrap,
    40244044.wp-format-image .wp-media-buttons .insert-media,
    40254045.wp-format-audio .wp-media-buttons .insert-media,
    body .ui-slider-tooltip { 
    40364056
    40374057.wp-format-media-select {
    40384058        display: block;
    4039         height: 200px;
     4059        height: 20px;
     4060        padding: 55px 0 20px;
    40404061        text-align: center;
    40414062}
    40424063
    body .ui-slider-tooltip { 
    40454066        max-height: 100%;
    40464067}
    40474068
    4048 .wp-format-media-select {
    4049         height: 20px;
    4050 }
    4051 
    40524069.empty .wp-format-media-metaedit {
    40534070        height: 20px;
    40544071        display: block;
    body .ui-slider-tooltip { 
    40654082#wp_format_video {
    40664083        float: left;
    40674084        margin-right: 23px;
    4068         max-width: 50%;
     4085        max-width: 40%;
    40694086        min-height: 97px;
    40704087}
    40714088
    4072 #icon-edit.wp-format-standard,
     4089body.wp-format-standard #icon-edit,
    40734090.post-format-options .standard {
    40744091        background: url(../images/post-formats32.png) no-repeat -3px -4px;
    40754092}
    40764093
    4077 #icon-edit.wp-format-image,
     4094body.wp-format-image #icon-edit,
    40784095.post-format-options .image {
    40794096        background: url(../images/post-formats32.png) no-repeat  -43px -4px;
    40804097}
    40814098
    4082 #icon-edit.wp-format-gallery,
     4099body.wp-format-gallery #icon-edit,
    40834100.post-format-options .gallery {
    40844101        background: url(../images/post-formats32.png) no-repeat -83px -4px;
    40854102}
    40864103
    4087 #icon-edit.wp-format-audio,
     4104body.wp-format-audio #icon-edit,
    40884105.post-format-options .audio {
    40894106        background: url(../images/post-formats32.png) no-repeat -123px -4px;
    40904107}
    40914108
    4092 #icon-edit.wp-format-video,
     4109body.wp-format-video #icon-edit,
    40934110.post-format-options .video {
    40944111        background: url(../images/post-formats32.png) no-repeat -163px -4px;
    40954112}
    40964113
    4097 #icon-edit.wp-format-chat,
     4114body.wp-format-chat #icon-edit,
    40984115.post-format-options .chat {
    40994116        background: url(../images/post-formats32.png) no-repeat -202px -4px;
    41004117}
    41014118
    4102 #icon-edit.wp-format-status,
     4119body.wp-format-status #icon-edit,
    41034120.post-format-options .status {
    41044121        background: url(../images/post-formats32.png) no-repeat -242px -4px;
    41054122}
    41064123
    4107 #icon-edit.wp-format-aside,
     4124body.wp-format-aside #icon-edit,
    41084125.post-format-options .aside {
    41094126        background: url(../images/post-formats32.png) no-repeat -282px -4px;
    41104127}
    41114128
    4112 #icon-edit.wp-format-quote,
     4129body.wp-format-quote #icon-edit,
    41134130.post-format-options .quote {
    41144131        background: url(../images/post-formats32.png) no-repeat -322px -4px;
    41154132}
    41164133
    4117 #icon-edit.wp-format-link,
     4134body.wp-format-link #icon-edit,
    41184135.post-format-options .link {
    41194136        background: url(../images/post-formats32.png) no-repeat -362px -4px;
    41204137}
  • wp-admin/includes/post-formats.php

    wp_nonce_field( 'show-post-format-ui_' . $post_type, 'show_post_format_ui_nonce' 
    3838                                ?>
    3939                        </div>
    4040                        <?php endif ?>
    41                         <label for="wp_format_image"><?php
    42                                 if ( current_user_can( 'unfiltered_html' ) )
    43                                         _e( 'Image HTML or URL' );
    44                                 else
    45                                         _e( 'Image URL' );
    46                         ?></label>
    47                         <textarea id="wp_format_image" type="text" name="_format_image" class="widefat"><?php esc_html_e( $format_meta['image'] ); ?></textarea>
    4841                        <div data-format="image" class="wp-format-media-holder hide-if-no-js">
    4942                                <a href="#" class="wp-format-media-select"
    5043                                        data-choose="<?php esc_attr_e( 'Choose an Image' ); ?>"
    wp_nonce_field( 'show-post-format-ui_' . $post_type, 'show_post_format_ui_nonce' 
    5245                                        <?php _e( 'Select / Upload Image' ); ?>
    5346                                </a>
    5447                        </div>
     48                        <div class="wp-format-image-textarea hide-if-js">
     49                                <label for="wp_format_image"><?php
     50                                        if ( current_user_can( 'unfiltered_html' ) )
     51                                                _e( 'Image HTML or URL' );
     52                                        else
     53                                                _e( 'Image URL' );
     54                                ?></label>
     55                                <textarea id="wp_format_image" type="text" name="_format_image" class="widefat"><?php esc_html_e( $format_meta['image'] ); ?></textarea>
     56                        </div>
     57                        <p class="use-url-or-html hide-if-no-js"><span><?php printf( __( '(or %suse an image URL or HTML%s)' ), '<a href="#">', '</a>' ); ?></span>
     58                                <span style="display: none"><?php printf( __( '(or %sselect/upload an image%s)' ), '<a href="#">', '</a>' ); ?></span></p>
    5559                </div>
    5660
    5761                <div class="field wp-format-link">
  • wp-admin/js/post-formats.js

    window.wp = window.wp || {}; 
    66        "use strict";
    77
    88        var mediaFrame, insertMediaButton, container, icon, formatField,
     9                body,
    910                lastMimeType,
    1011                classRegex = /\s?\bwp-format-[^ ]+/g,
    1112                shortHeight = 120,
    window.wp = window.wp || {}; 
    1718                shortContentFormats = ['status', 'aside'],
    1819                noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'];
    1920
     21        function imageFormatUploadProgress( uploader, file ) {
     22                var $bar = $( '#' + uploader.settings.drop_element + ' .media-progress-bar div' );
     23                $bar.width( file.percent + '%' );
     24        }
     25
     26        function imageFormatUploadStart( uploader ) {
     27                $( '#' + uploader.settings.drop_element + ' .wp-format-media-select' ).append('<div class="media-progress-bar"><div></div></div>');
     28        }
     29
     30        function imageFormatUploadSuccess( attachment ) {
     31                var $holder, $field, html = wp.media.string.image({
     32                        size : 'full',
     33                        align : false,
     34                        link : getUserSetting( 'urlbutton' )
     35                }, attachment.attributes );
     36
     37                $holder = $('.wp-format-media-holder[data-format=image]');
     38                $( '.media-progress-bar', $holder ).remove();
     39                $field = $( '#wp_format_' + $holder.data( 'format' ) );
     40
     41                // set the hidden input's value
     42                $field.val( html );
     43
     44                $( '#image-preview' ).remove();
     45
     46                $holder.parent().prepend( ['<div id="image-preview" class="wp-format-media-preview">',
     47                        '<img src="', attachment.get('url'), '"',
     48                        attachment.get('width') ? ' width="' + attachment.get('width') + '"' : '',
     49                        attachment.get('height') ? ' height="' + attachment.get('height') + '"' : '',
     50                        ' />',
     51                '</div>'].join( '' ) );
     52        }
     53
     54        var uploader = {
     55                dropzone:  $('.wp-format-media-holder[data-format=image]'),
     56                success:   imageFormatUploadSuccess,
     57                plupload:  {},
     58                params:    {}
     59        };
     60        uploader = new wp.Uploader( uploader );
     61        uploader.uploader.bind( 'BeforeUpload', imageFormatUploadStart );
     62        uploader.uploader.bind( 'UploadProgress', imageFormatUploadProgress );
     63
    2064        function switchFormatClass( format ) {
    2165                formatField.val( format );
    2266
    23                 container
    24                         .prop( 'className', container.prop( 'className' ).replace( classRegex, '' ) )
    25                         .addClass( 'wp-format-' + format );
    26 
    27                 icon
    28                         .prop( 'className', icon.prop( 'className' ).replace( classRegex, '' ) )
     67                $.each( [ container, icon, body ], function(i, thing) {
     68                        thing.prop( 'className', thing.prop( 'className' ).replace( classRegex, '' ) )
    2969                        .addClass( 'wp-format-' + format );
     70                });
    3071        }
    3172
    3273        function resizeContent( format, noAnimate ) {
    window.wp = window.wp || {}; 
    137178        }
    138179
    139180        $(function () {
     181                body = $( 'body' );
    140182                container = $( '#post-body-content' );
    141183                icon = $( '.icon32' );
    142184                formatField = $( '#post_format' );
    window.wp = window.wp || {}; 
    163205                        switchFormat( $( e.currentTarget ) );
    164206                } );
    165207
     208                // Toggle select/upload and URL/HTML for images
     209                $( '.use-url-or-html' ).on( 'click', 'a', function(e) {
     210                        e.preventDefault();
     211                        $( '.wp-format-media-holder, .wp-format-image-textarea' ).toggle();
     212                        $(this).closest( 'p' ).find( 'span' ).toggle();
     213                });
     214
    166215                // Media selection
    167216                $( '.wp-format-media-select' ).click( function (e) {
    168217                        e.preventDefault();
    window.wp = window.wp || {}; 
    242291                                        mediaPreview( attachment );
    243292                                } else {
    244293                                        html = wp.media.string.image({
    245                                                 align : getUserSetting( 'align' ),
    246                                                 size : getUserSetting( 'imgsize' ),
     294                                                size: 'full',
     295                                                align : false,
    247296                                                link : getUserSetting( 'urlbutton' )
    248297                                        }, attachment);
    249298
  • wp-includes/script-loader.php

    function wp_default_scripts( &$scripts ) { 
    407407                        'comma' => _x( ',', 'tag delimiter' ),
    408408                ) );
    409409
    410                 $scripts->add( 'post-formats', "/wp-admin/js/post-formats$suffix.js", array( 'media-models' ), false, 1 );
     410                $scripts->add( 'post-formats', "/wp-admin/js/post-formats$suffix.js", array( 'media-models', 'wp-plupload' ), false, 1 );
    411411
    412412                $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
    413413