Make WordPress Core

Ticket #24291: 24291.20.diff

File 24291.20.diff, 7.6 KB (added by aaroncampbell, 12 years ago)
  • wp-includes/script-loader.php

     
    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
  • wp-includes/js/media-views.js

     
    21252125
    21262126                show: function() {
    21272127                        var $el = this.$el.show();
     2128                        console.log( this );
     2129                        console.log( $el );
    21282130
    21292131                        // Ensure that the animation is triggered by waiting until
    21302132                        // the transparent element is painted into the DOM.
     
    42994301                        this.$('img').attr( 'src', this.model.get('url') );
    43004302                }
    43014303        });
    4302 }(jQuery));
    4303  No newline at end of file
     4304}(jQuery));
  • wp-admin/includes/post-formats.php

     
    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">
     42                                <div><h3><?php _e( 'Drop files to upload' ); ?></h3></div>
    4943                                <a href="#" class="wp-format-media-select"
    5044                                        data-choose="<?php esc_attr_e( 'Choose an Image' ); ?>"
    5145                                        data-update="<?php esc_attr_e( 'Select Image' ); ?>">
    5246                                        <?php _e( 'Select / Upload Image' ); ?>
    5347                                </a>
    5448                        </div>
     49                        <div class="wp-format-image-textarea hide-if-js">
     50                                <label for="wp_format_image"><?php
     51                                        if ( current_user_can( 'unfiltered_html' ) )
     52                                                _e( 'Image HTML or URL' );
     53                                        else
     54                                                _e( 'Image URL' );
     55                                ?></label>
     56                                <textarea id="wp_format_image" type="text" name="_format_image" class="widefat"><?php esc_html_e( $format_meta['image'] ); ?></textarea>
     57                        </div>
     58                        <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>
     59                                <span style="display: none"><?php printf( __( '(or %sselect/upload an image%s)' ), '<a href="#">', '</a>' ); ?></span></p>
    5560                </div>
    5661
    5762                <div class="field wp-format-link">
  • wp-admin/js/post-formats.js

     
    1717                shortContentFormats = ['status', 'aside'],
    1818                noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'];
    1919
     20        var imageFormatUploadProgress = function ( uploader, file ) {
     21                var $bar = $( '#' + uploader.settings.drop_element + ' .media-progress-bar div' );
     22                $bar.width( file.percent + '%' );
     23        }
     24        var imageFormatUploadStart = function ( uploader ) {
     25                $( '#' + uploader.settings.drop_element ).append('<div class="media-progress-bar"><div></div></div>');
     26        }
     27        var imageFormatUploadSuccess = function ( attachment ) {
     28                var $holder, $field, html = wp.media.string.image({
     29                        align : getUserSetting( 'align' ),
     30                        size : getUserSetting( 'imgsize' ),
     31                        link : getUserSetting( 'urlbutton' )
     32                }, {
     33                        url : attachment.get('url'),
     34                        width : attachment.get('width'),
     35                        height : attachment.get('height')
     36                });
     37
     38                $holder = $('.wp-format-media-holder[data-format=image]');
     39                $( '.media-progress-bar', $holder ).remove();
     40                $field = $( '#wp_format_' + $holder.data( 'format' ) );
     41
     42                // set the hidden input's value
     43                $field.val( html );
     44
     45                $( '#image-preview' ).remove();
     46
     47                $holder.parent().prepend( ['<div id="image-preview" class="wp-format-media-preview">',
     48                        '<img src="', attachment.get('url'), '"',
     49                        attachment.get('width') ? ' width="' + attachment.get('width') + '"' : '',
     50                        attachment.get('height') ? ' height="' + attachment.get('height') + '"' : '',
     51                        ' />',
     52                '</div>'].join( '' ) );
     53        }
     54
     55        var uploader = $.extend({
     56                dropzone:  $('.wp-format-media-holder[data-format=image]'),
     57                success:   imageFormatUploadSuccess,
     58                plupload:  {},
     59                params:    {}
     60        }, {} );
     61        uploader = new wp.Uploader( uploader );
     62        uploader.uploader.bind( 'BeforeUpload', imageFormatUploadStart );
     63        uploader.uploader.bind( 'UploadProgress', imageFormatUploadProgress );
     64        //queue.on( 'add remove reset', this.visibility, this );
     65        //queue.on( 'add remove reset change:percent', this.progress, this );
     66        //queue.on( 'add remove reset change:uploading', this.info, this );
     67
    2068        function switchFormatClass( format ) {
    2169                formatField.val( format );
    2270
     
    163211                        switchFormat( $( e.currentTarget ) );
    164212                } );
    165213
     214                // Toggle select/upload and URL/HTML for images
     215                $( '.use-url-or-html' ).on( 'click', 'a', function(e) {
     216                        e.preventDefault();
     217                        $( '.wp-format-media-holder, .wp-format-image-textarea' ).toggle();
     218                        $(this).closest( 'p' ).find( 'span' ).toggle();
     219                });
     220
    166221                // Media selection
    167222                $( '.wp-format-media-select' ).click( function (e) {
    168223                        e.preventDefault();
  • wp-admin/css/wp-admin.css

     
    40434043        overflow: hidden;
    40444044        width: 40%;
    40454045        height: auto;
    4046         padding: 55px 0 20px;
    40474046        border: 1px dashed #dfdfdf;
    40484047        background: #f5f5f5 url(../images/media-button-2x.png) no-repeat 50% 25%;
     4048        box-sizing: border-box;
     4049        position:relative;
    40494050}
    40504051
    40514052.wp-format-media-holder:hover {
    40524053        background-color: #eee;
    40534054}
    40544055
     4056.wp-format-media-holder.drag-over {
     4057        background: rgba( 0, 86, 132, 0.9 );
     4058        border-color:transparent;
     4059}
     4060
     4061.wp-format-media-holder div {
     4062        display: none;
     4063}
     4064.wp-format-media-holder.drag-over div {
     4065        position: absolute;
     4066        top: 10px;
     4067        left: 10px;
     4068        right: 10px;
     4069        bottom: 10px;
     4070        border: 1px dashed #fff;
     4071        display:block;
     4072}
     4073
     4074#poststuff .wp-format-media-holder.drag-over div h3 {
     4075
     4076        position: absolute;
     4077        top: 50%;
     4078        left: 0;
     4079        right: 0;
     4080        -webkit-transform: translateY( -50% );
     4081        -moz-transform:    translateY( -50% );
     4082        -ms-transform:     translateY( -50% );
     4083        -o-transform:      translateY( -50% );
     4084        transform:         translateY( -50% );
     4085
     4086        font-size: 20px;
     4087        font-weight: 200;
     4088        color: #fff;
     4089        padding: 0;
     4090        text-align:center;
     4091        font-family: sans-serif;
     4092}
     4093
     4094
    40554095.wp-format-media-preview {
    40564096        margin-bottom: 20px;
    40574097}
    40584098
     4099#image-preview img {
     4100        width: auto;
     4101        max-height: 300px;
     4102}
     4103
     4104.wp-format-image p.use-url-or-html {
     4105        padding-top: 10px;
     4106        clear: both;
     4107        width: 40%;
     4108        text-align: center;
     4109}
     4110
    40594111.wp-format-status #titlewrap,
    40604112.wp-format-image .wp-media-buttons .insert-media,
    40614113.wp-format-audio .wp-media-buttons .insert-media,
     
    40724124
    40734125.wp-format-media-select {
    40744126        display: block;
    4075         height: 200px;
     4127        height: 20px;
     4128        padding: 55px 0 20px;
    40764129        text-align: center;
    40774130}
    40784131
     
    40814134        max-height: 100%;
    40824135}
    40834136
    4084 .wp-format-media-select {
    4085         height: 20px;
    4086 }
    4087 
    40884137.empty .wp-format-media-metaedit {
    40894138        height: 20px;
    40904139        display: block;
     
    41014150#wp_format_video {
    41024151        float: left;
    41034152        margin-right: 23px;
    4104         max-width: 50%;
     4153        max-width: 40%;
    41054154        min-height: 97px;
    41064155}
    41074156