Ticket #24291: 24291.16.diff
File 24291.16.diff, 9.1 KB (added by , 12 years ago) |
---|
-
wp-admin/css/wp-admin.css
body .ui-slider-tooltip { 4007 4007 overflow: hidden; 4008 4008 width: 40%; 4009 4009 height: auto; 4010 padding: 55px 0 20px;4011 4010 border: 1px dashed #dfdfdf; 4012 4011 background: #f5f5f5 url(../images/media-button-2x.png) no-repeat 50% 25%; 4012 box-sizing: border-box; 4013 4013 } 4014 4014 4015 4015 .wp-format-media-holder:hover { 4016 4016 background-color: #eee; 4017 4017 } 4018 4018 4019 .wp-format-image .wp-format-media-holder { 4020 margin-top: 17px; 4021 } 4022 4019 4023 .wp-format-media-preview { 4020 4024 margin-bottom: 20px; 4021 4025 } 4022 4026 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 4039 body.wp-format-image .attachment-display-settings { 4040 display: none; 4041 } 4042 4023 4043 .wp-format-status #titlewrap, 4024 4044 .wp-format-image .wp-media-buttons .insert-media, 4025 4045 .wp-format-audio .wp-media-buttons .insert-media, … … body .ui-slider-tooltip { 4036 4056 4037 4057 .wp-format-media-select { 4038 4058 display: block; 4039 height: 200px; 4059 height: 20px; 4060 padding: 55px 0 20px; 4040 4061 text-align: center; 4041 4062 } 4042 4063 … … body .ui-slider-tooltip { 4045 4066 max-height: 100%; 4046 4067 } 4047 4068 4048 .wp-format-media-select {4049 height: 20px;4050 }4051 4052 4069 .empty .wp-format-media-metaedit { 4053 4070 height: 20px; 4054 4071 display: block; … … body .ui-slider-tooltip { 4065 4082 #wp_format_video { 4066 4083 float: left; 4067 4084 margin-right: 23px; 4068 max-width: 50%;4085 max-width: 40%; 4069 4086 min-height: 97px; 4070 4087 } 4071 4088 4072 #icon-edit.wp-format-standard,4089 body.wp-format-standard #icon-edit, 4073 4090 .post-format-options .standard { 4074 4091 background: url(../images/post-formats32.png) no-repeat -3px -4px; 4075 4092 } 4076 4093 4077 #icon-edit.wp-format-image,4094 body.wp-format-image #icon-edit, 4078 4095 .post-format-options .image { 4079 4096 background: url(../images/post-formats32.png) no-repeat -43px -4px; 4080 4097 } 4081 4098 4082 #icon-edit.wp-format-gallery,4099 body.wp-format-gallery #icon-edit, 4083 4100 .post-format-options .gallery { 4084 4101 background: url(../images/post-formats32.png) no-repeat -83px -4px; 4085 4102 } 4086 4103 4087 #icon-edit.wp-format-audio,4104 body.wp-format-audio #icon-edit, 4088 4105 .post-format-options .audio { 4089 4106 background: url(../images/post-formats32.png) no-repeat -123px -4px; 4090 4107 } 4091 4108 4092 #icon-edit.wp-format-video,4109 body.wp-format-video #icon-edit, 4093 4110 .post-format-options .video { 4094 4111 background: url(../images/post-formats32.png) no-repeat -163px -4px; 4095 4112 } 4096 4113 4097 #icon-edit.wp-format-chat,4114 body.wp-format-chat #icon-edit, 4098 4115 .post-format-options .chat { 4099 4116 background: url(../images/post-formats32.png) no-repeat -202px -4px; 4100 4117 } 4101 4118 4102 #icon-edit.wp-format-status,4119 body.wp-format-status #icon-edit, 4103 4120 .post-format-options .status { 4104 4121 background: url(../images/post-formats32.png) no-repeat -242px -4px; 4105 4122 } 4106 4123 4107 #icon-edit.wp-format-aside,4124 body.wp-format-aside #icon-edit, 4108 4125 .post-format-options .aside { 4109 4126 background: url(../images/post-formats32.png) no-repeat -282px -4px; 4110 4127 } 4111 4128 4112 #icon-edit.wp-format-quote,4129 body.wp-format-quote #icon-edit, 4113 4130 .post-format-options .quote { 4114 4131 background: url(../images/post-formats32.png) no-repeat -322px -4px; 4115 4132 } 4116 4133 4117 #icon-edit.wp-format-link,4134 body.wp-format-link #icon-edit, 4118 4135 .post-format-options .link { 4119 4136 background: url(../images/post-formats32.png) no-repeat -362px -4px; 4120 4137 } -
wp-admin/includes/post-formats.php
wp_nonce_field( 'show-post-format-ui_' . $post_type, 'show_post_format_ui_nonce' 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"> 49 42 <a href="#" class="wp-format-media-select" 50 43 data-choose="<?php esc_attr_e( 'Choose an Image' ); ?>" … … wp_nonce_field( 'show-post-format-ui_' . $post_type, 'show_post_format_ui_nonce' 52 45 <?php _e( 'Select / Upload Image' ); ?> 53 46 </a> 54 47 </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> 55 59 </div> 56 60 57 61 <div class="field wp-format-link"> -
wp-admin/js/post-formats.js
window.wp = window.wp || {}; 6 6 "use strict"; 7 7 8 8 var mediaFrame, insertMediaButton, container, icon, formatField, 9 body, 9 10 lastMimeType, 10 11 classRegex = /\s?\bwp-format-[^ ]+/g, 11 12 shortHeight = 120, … … window.wp = window.wp || {}; 17 18 shortContentFormats = ['status', 'aside'], 18 19 noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery']; 19 20 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 20 64 function switchFormatClass( format ) { 21 65 formatField.val( format ); 22 66 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, '' ) ) 29 69 .addClass( 'wp-format-' + format ); 70 }); 30 71 } 31 72 32 73 function resizeContent( format, noAnimate ) { … … window.wp = window.wp || {}; 137 178 } 138 179 139 180 $(function () { 181 body = $( 'body' ); 140 182 container = $( '#post-body-content' ); 141 183 icon = $( '.icon32' ); 142 184 formatField = $( '#post_format' ); … … window.wp = window.wp || {}; 163 205 switchFormat( $( e.currentTarget ) ); 164 206 } ); 165 207 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 166 215 // Media selection 167 216 $( '.wp-format-media-select' ).click( function (e) { 168 217 e.preventDefault(); … … window.wp = window.wp || {}; 242 291 mediaPreview( attachment ); 243 292 } else { 244 293 html = wp.media.string.image({ 245 align : getUserSetting( 'align' ),246 size : getUserSetting( 'imgsize' ),294 size: 'full', 295 align : false, 247 296 link : getUserSetting( 'urlbutton' ) 248 297 }, attachment); 249 298 -
wp-includes/script-loader.php
function wp_default_scripts( &$scripts ) { 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