WordPress.org

Make WordPress Core

Changeset 20761


Ignore:
Timestamp:
05/10/2012 12:15:53 AM (7 years ago)
Author:
koopersmith
Message:

Theme Customizer: Add a fallback UI for browsers that do not support drag and drop upload. see #19910, #20452, #20582.

Location:
trunk/wp-includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-customize-control.php

    r20598 r20761  
    390390            <?php _e('Drop a file here or <a href="#" class="upload">select a file</a>.'); ?>
    391391        </div>
     392        <a class="button-secondary upload-fallback"><?php _e('Select File'); ?></a>
    392393        <?php
    393394    }
  • trunk/wp-includes/css/customize-controls.dev.css

    r20674 r20761  
    474474    position: relative;
    475475}
     476
     477.customize-control-image .upload-dropzone,
     478.uploader-drag-drop .customize-control-image .upload-fallback {
     479    display: none;
     480}
     481
     482.uploader-drag-drop .customize-control-image .upload-dropzone {
     483    display: block;
     484}
  • trunk/wp-includes/js/customize-controls.dev.js

    r20758 r20761  
    138138            this.success = $.proxy( this.success, this );
    139139
    140             this.uploader = new wp.Uploader({
     140            this.uploader = $.extend({
    141141                container: this.container,
    142142                browser:   this.container.find('.upload'),
    143143                dropzone:  this.container.find('.upload-dropzone'),
    144144                success:   this.success
    145             });
     145            }, this.uploader || {} );
     146
     147            this.uploader = new wp.Uploader( this.uploader );
    146148
    147149            this.remover = this.container.find('.remove');
     
    170172            var control = this,
    171173                panels;
     174
     175            this.uploader = {};
     176            if ( ! wp.Uploader.dragdrop )
     177                this.uploader.browser = this.container.find( '.upload-fallback' );
    172178
    173179            api.UploadControl.prototype.ready.call( this );
  • trunk/wp-includes/js/plupload/wp-plupload.dev.js

    r20758 r20761  
    33
    44(function( exports, $ ) {
    5     var Uploader, body;
    6 
    7     body = $( document.body );
     5    var Uploader;
    86
    97    /*
     
    7674
    7775        this.browser.on( 'mouseenter', this.refresh );
    78         body.toggleClass( 'uploader-drag-drop', this.uploader.features.dragdrop );
    7976
    8077        this.uploader.bind( 'UploadProgress', this.progress );
     
    123120        });
    124121    };
     122
     123    Uploader.dragdrop = (function() {
     124        // Thank you, Modernizr!
     125        // http://modernizr.com/
     126        var div = document.createElement('div');
     127        return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
     128    }());
     129
     130    $( function() {
     131        if ( Uploader.dragdrop )
     132            $( document.body ).addClass('uploader-drag-drop');
     133    });
    125134
    126135    Uploader.uuid = 0;
Note: See TracChangeset for help on using the changeset viewer.