Ticket #24291: 24291.20.diff
File 24291.20.diff, 7.6 KB (added by , 12 years ago) |
---|
-
wp-includes/script-loader.php
407 407 'comma' => _x( ',', 'tag delimiter' ), 408 408 ) ); 409 409 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 ); 411 411 412 412 $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 ); 413 413 -
wp-includes/js/media-views.js
2125 2125 2126 2126 show: function() { 2127 2127 var $el = this.$el.show(); 2128 console.log( this ); 2129 console.log( $el ); 2128 2130 2129 2131 // Ensure that the animation is triggered by waiting until 2130 2132 // the transparent element is painted into the DOM. … … 4299 4301 this.$('img').attr( 'src', this.model.get('url') ); 4300 4302 } 4301 4303 }); 4302 }(jQuery)); 4303 No newline at end of file 4304 }(jQuery)); -
wp-admin/includes/post-formats.php
38 38 ?> 39 39 </div> 40 40 <?php endif ?> 41 <label for="wp_format_image"><?php42 if ( current_user_can( 'unfiltered_html' ) )43 _e( 'Image HTML or URL' );44 else45 _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>48 41 <div data-format="image" class="wp-format-media-holder hide-if-no-js"> 42 <div><h3><?php _e( 'Drop files to upload' ); ?></h3></div> 49 43 <a href="#" class="wp-format-media-select" 50 44 data-choose="<?php esc_attr_e( 'Choose an Image' ); ?>" 51 45 data-update="<?php esc_attr_e( 'Select Image' ); ?>"> 52 46 <?php _e( 'Select / Upload Image' ); ?> 53 47 </a> 54 48 </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> 55 60 </div> 56 61 57 62 <div class="field wp-format-link"> -
wp-admin/js/post-formats.js
17 17 shortContentFormats = ['status', 'aside'], 18 18 noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery']; 19 19 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 20 68 function switchFormatClass( format ) { 21 69 formatField.val( format ); 22 70 … … 163 211 switchFormat( $( e.currentTarget ) ); 164 212 } ); 165 213 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 166 221 // Media selection 167 222 $( '.wp-format-media-select' ).click( function (e) { 168 223 e.preventDefault(); -
wp-admin/css/wp-admin.css
4043 4043 overflow: hidden; 4044 4044 width: 40%; 4045 4045 height: auto; 4046 padding: 55px 0 20px;4047 4046 border: 1px dashed #dfdfdf; 4048 4047 background: #f5f5f5 url(../images/media-button-2x.png) no-repeat 50% 25%; 4048 box-sizing: border-box; 4049 position:relative; 4049 4050 } 4050 4051 4051 4052 .wp-format-media-holder:hover { 4052 4053 background-color: #eee; 4053 4054 } 4054 4055 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 4055 4095 .wp-format-media-preview { 4056 4096 margin-bottom: 20px; 4057 4097 } 4058 4098 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 4059 4111 .wp-format-status #titlewrap, 4060 4112 .wp-format-image .wp-media-buttons .insert-media, 4061 4113 .wp-format-audio .wp-media-buttons .insert-media, … … 4072 4124 4073 4125 .wp-format-media-select { 4074 4126 display: block; 4075 height: 200px; 4127 height: 20px; 4128 padding: 55px 0 20px; 4076 4129 text-align: center; 4077 4130 } 4078 4131 … … 4081 4134 max-height: 100%; 4082 4135 } 4083 4136 4084 .wp-format-media-select {4085 height: 20px;4086 }4087 4088 4137 .empty .wp-format-media-metaedit { 4089 4138 height: 20px; 4090 4139 display: block; … … 4101 4150 #wp_format_video { 4102 4151 float: left; 4103 4152 margin-right: 23px; 4104 max-width: 50%;4153 max-width: 40%; 4105 4154 min-height: 97px; 4106 4155 } 4107 4156