Ticket #24291: 24291.22.diff
File 24291.22.diff, 12.4 KB (added by , 12 years ago) |
---|
-
wp-admin/admin-header.php
85 85 $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); 86 86 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); 87 87 88 if ( isset( $post ) && is_a( $post, 'WP_Post' ) ) 89 $admin_body_class .= ' wp-format-' . get_post_format( $post ); 90 88 91 if ( wp_is_mobile() ) 89 92 $admin_body_class .= ' mobile'; 90 93 -
wp-admin/css/wp-admin.css
3968 3968 margin-bottom: 15px; 3969 3969 } 3970 3970 3971 .wp-format-gallery .post-formats-fields,3972 .wp-format-image .post-formats-fields,3973 .wp-format-link .post-formats-fields,3974 .wp-format-quote .post-formats-fields,3975 .wp-format-video .post-formats-fields,3976 .wp-format-audio .post-formats-fields,3977 .wp-format-gallery .field.wp-format-gallery,3978 .wp-format-image .field.wp-format-image,3979 .wp-format-chat .field.wp-format-chat,3980 .wp-format-link .field.wp-format-link,3981 .wp-format-quote .field.wp-format-quote,3982 .wp-format-video .field.wp-format-video,3983 .wp-format-audio .field.wp-format-audio {3971 #post-body-content.wp-format-gallery .post-formats-fields, 3972 #post-body-content.wp-format-image .post-formats-fields, 3973 #post-body-content.wp-format-link .post-formats-fields, 3974 #post-body-content.wp-format-quote .post-formats-fields, 3975 #post-body-content.wp-format-video .post-formats-fields, 3976 #post-body-content.wp-format-audio .post-formats-fields, 3977 #post-body-content.wp-format-gallery .field.wp-format-gallery, 3978 #post-body-content.wp-format-image .field.wp-format-image, 3979 #post-body-content.wp-format-chat .field.wp-format-chat, 3980 #post-body-content.wp-format-link .field.wp-format-link, 3981 #post-body-content.wp-format-quote .field.wp-format-quote, 3982 #post-body-content.wp-format-video .field.wp-format-video, 3983 #post-body-content.wp-format-audio .field.wp-format-audio { 3984 3984 display: block; 3985 3985 } 3986 3986 … … 3996 3996 font-size: 1.2em; 3997 3997 } 3998 3998 3999 .wp-format-image label,4000 .wp-format-video label,4001 .wp-format-audio label {3999 #post-body-content.wp-format-image label, 4000 #post-body-content.wp-format-video label, 4001 #post-body-content.wp-format-audio label { 4002 4002 float: left; 4003 4003 } 4004 4004 … … 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 position:relative; 4013 4014 } 4014 4015 4015 4016 .wp-format-media-holder:hover { 4016 4017 background-color: #eee; 4017 4018 } 4018 4019 4020 .wp-format-media-holder.drag-over { 4021 background: rgba( 0, 86, 132, 0.9 ); 4022 border-color:transparent; 4023 } 4024 4025 .wp-format-media-holder div { 4026 display: none; 4027 } 4028 .wp-format-media-holder.drag-over div { 4029 position: absolute; 4030 top: 10px; 4031 left: 10px; 4032 right: 10px; 4033 bottom: 10px; 4034 border: 1px dashed #fff; 4035 display:block; 4036 } 4037 4038 #poststuff .wp-format-media-holder.drag-over div h3 { 4039 4040 position: absolute; 4041 top: 50%; 4042 left: 0; 4043 right: 0; 4044 -webkit-transform: translateY( -50% ); 4045 -moz-transform: translateY( -50% ); 4046 -ms-transform: translateY( -50% ); 4047 -o-transform: translateY( -50% ); 4048 transform: translateY( -50% ); 4049 4050 font-size: 20px; 4051 font-weight: 200; 4052 color: #fff; 4053 padding: 0; 4054 text-align:center; 4055 font-family: sans-serif; 4056 } 4057 4058 #post-body-content.wp-format-image .wp-format-media-holder { 4059 margin-top: 17px; 4060 } 4061 4019 4062 .wp-format-media-preview { 4020 margin -bottom: 20px;4063 margin: 20px 0; 4021 4064 } 4022 4065 4023 .wp-format-status #titlewrap, 4024 .wp-format-image .wp-media-buttons .insert-media, 4025 .wp-format-audio .wp-media-buttons .insert-media, 4026 .wp-format-video .wp-media-buttons .insert-media, 4027 .wp-format-aside .wp-media-buttons .insert-media, 4028 .wp-format-status .wp-media-buttons .insert-media { 4066 #image-preview img { 4067 width: auto; 4068 max-height: 300px; 4069 } 4070 4071 #post-body-content .wp-format-image p.use-url-or-html { 4072 padding-top: 10px; 4073 clear: both; 4074 width: 40%; 4075 text-align: center; 4076 } 4077 4078 body.wp-format-image .attachment-display-settings { 4029 4079 display: none; 4030 4080 } 4031 4081 4082 body.wp-format-status #titlewrap, 4083 body.wp-format-image .wp-media-buttons .insert-media, 4084 body.wp-format-audio .wp-media-buttons .insert-media, 4085 body.wp-format-video .wp-media-buttons .insert-media, 4086 body.wp-format-aside .wp-media-buttons .insert-media, 4087 body.wp-format-status .wp-media-buttons .insert-media { 4088 display: none; 4089 } 4090 4032 4091 .mejs-audio audio, 4033 4092 .mejs-video video { 4034 4093 display: block; … … 4036 4095 4037 4096 .wp-format-media-select { 4038 4097 display: block; 4039 height: 200px; 4098 height: 20px; 4099 padding: 55px 0 20px; 4040 4100 text-align: center; 4041 4101 } 4042 4102 … … 4045 4105 max-height: 100%; 4046 4106 } 4047 4107 4048 .wp-format-media-select {4049 height: 20px;4050 }4051 4052 4108 .empty .wp-format-media-metaedit { 4053 4109 height: 20px; 4054 4110 display: block; … … 4065 4121 #wp_format_video { 4066 4122 float: left; 4067 4123 margin-right: 23px; 4068 max-width: 50%;4124 max-width: 40%; 4069 4125 min-height: 97px; 4070 4126 } 4071 4127 4072 #icon-edit.wp-format-standard,4128 body.wp-format-standard #icon-edit, 4073 4129 .post-format-options .standard { 4074 4130 background: url(../images/post-formats32.png) no-repeat -3px -4px; 4075 4131 } 4076 4132 4077 #icon-edit.wp-format-image,4133 body.wp-format-image #icon-edit, 4078 4134 .post-format-options .image { 4079 4135 background: url(../images/post-formats32.png) no-repeat -43px -4px; 4080 4136 } 4081 4137 4082 #icon-edit.wp-format-gallery,4138 body.wp-format-gallery #icon-edit, 4083 4139 .post-format-options .gallery { 4084 4140 background: url(../images/post-formats32.png) no-repeat -83px -4px; 4085 4141 } 4086 4142 4087 #icon-edit.wp-format-audio,4143 body.wp-format-audio #icon-edit, 4088 4144 .post-format-options .audio { 4089 4145 background: url(../images/post-formats32.png) no-repeat -123px -4px; 4090 4146 } 4091 4147 4092 #icon-edit.wp-format-video,4148 body.wp-format-video #icon-edit, 4093 4149 .post-format-options .video { 4094 4150 background: url(../images/post-formats32.png) no-repeat -163px -4px; 4095 4151 } 4096 4152 4097 #icon-edit.wp-format-chat,4153 body.wp-format-chat #icon-edit, 4098 4154 .post-format-options .chat { 4099 4155 background: url(../images/post-formats32.png) no-repeat -202px -4px; 4100 4156 } 4101 4157 4102 #icon-edit.wp-format-status,4158 body.wp-format-status #icon-edit, 4103 4159 .post-format-options .status { 4104 4160 background: url(../images/post-formats32.png) no-repeat -242px -4px; 4105 4161 } 4106 4162 4107 #icon-edit.wp-format-aside,4163 body.wp-format-aside #icon-edit, 4108 4164 .post-format-options .aside { 4109 4165 background: url(../images/post-formats32.png) no-repeat -282px -4px; 4110 4166 } 4111 4167 4112 #icon-edit.wp-format-quote,4168 body.wp-format-quote #icon-edit, 4113 4169 .post-format-options .quote { 4114 4170 background: url(../images/post-formats32.png) no-repeat -322px -4px; 4115 4171 } 4116 4172 4117 #icon-edit.wp-format-link,4173 body.wp-format-link #icon-edit, 4118 4174 .post-format-options .link { 4119 4175 background: url(../images/post-formats32.png) no-repeat -362px -4px; 4120 4176 } -
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 image file 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
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, … … 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 container24 .prop( 'className', container.prop( 'className' ).replace( classRegex, '' ) )67 $.each( [ container, icon, body ], function(i, thing) { 68 thing.prop( 'className', thing.prop( 'className' ).replace( classRegex, '' ) ) 25 69 .addClass( 'wp-format-' + format ); 26 27 icon 28 .prop( 'className', icon.prop( 'className' ).replace( classRegex, '' ) ) 29 .addClass( 'wp-format-' + format ); 70 }); 30 71 } 31 72 32 73 function resizeContent( format, noAnimate ) { … … 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' ); … … 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(); … … 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
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