Ticket #19570: 19570.14.diff
File 19570.14.diff, 10.1 KB (added by , 11 years ago) |
---|
-
wp-admin/js/post-formats.js
1 1 (function($){ 2 3 2 // Post formats selection 4 $('.post-format- select a').on( 'click.post-format', function(e){3 $('.post-format-options a').on( 'click', function(e){ 5 4 var $this = $(this), 6 5 editor, 7 6 body, 7 parent = $this.parent(), 8 8 format = $this.data('wp-format'), 9 container = $('#post-body-content'); 9 container = $('#post-body-content'), 10 description = $('.post-format-description'); 10 11 11 $('.post-format-select a.nav-tab-active').removeClass('nav-tab-active'); 12 $this.addClass('nav-tab-active').blur(); 12 parent.find('a.active').removeClass('active'); 13 $this.addClass('active'); 14 $('#icon-edit').removeClass(postFormats.currentPostFormat).addClass(format); 13 15 $('#post_format').val(format); 14 16 15 17 container.get(0).className = container.get(0).className.replace( /\bwp-format-[^ ]+/, '' ); 16 18 container.addClass('wp-format-' + format); 19 $('#title').focus(); 17 20 21 // Update description line 22 description.html($this.data('description')); 23 24 if (description.not(':visible')) 25 description.slideDown('fast'); 26 18 27 if ( typeof tinymce != 'undefined' ) { 19 28 editor = tinymce.get('content'); 20 29 … … 25 34 } 26 35 } 27 36 37 postFormats.currentPostFormat = format; 38 28 39 e.preventDefault(); 40 }).on('mouseenter focusin', function () { 41 $('.post-format-tip').html( $(this).prop('title') ); 42 }).on('mouseleave focusout', function () { 43 $('.post-format-tip').html( $('.post-format-options a.active').prop('title') ); 29 44 }); 30 31 })(jQuery); 45 })(jQuery); 46 No newline at end of file -
wp-admin/edit-form-advanced.php
138 138 $format_class = " class='wp-format-{$post_format}'"; 139 139 } 140 140 141 if ( post_type_supports( $post_type, 'post-formats' ) ) { 142 $all_post_formats = array( 143 'standard' => array ( 144 'description' => __('Add a title and description for your post below.') 145 ), 146 'image' => array ( 147 'description' => __('Select an image using the Add Media button below.') 148 ), 149 'gallery' => array ( 150 'description' => __('Use the Add Media button below to select images for your gallery.') 151 ), 152 'link' => array ( 153 'description' => __('Add a link URL below.') 154 ), 155 'video' => array ( 156 'description' => __('Paste a video embed URL below, or click Add Media to upload a video.') 157 ), 158 'audio' => array ( 159 'description' => __('Paste an audio embed URL below, or click Add Media to upload an audio file.') 160 ), 161 'chat' => array ( 162 'description' => __('Paste a chat transcript below.') 163 ), 164 'status' => array ( 165 'description' => __('What are you up to? Enter your status message below.') 166 ), 167 'quote' => array ( 168 'description' => __('Enter a quote below.') 169 ), 170 'aside' => array ( 171 'description' => __('Enter a quick thought or side topic below.') 172 ) 173 ); 174 $post_format_options = ''; 175 176 foreach ( $all_post_formats as $slug => $attr ) { 177 $class = ''; 178 if ( $post_format == $slug ) { 179 $class = 'class="active"'; 180 $active_post_type_slug = $slug; 181 $active_post_type_label = ucfirst( $slug ); 182 $active_post_format_description = $attr['description']; 183 } 184 185 $post_format_options .= '<a ' . $class . ' href="?format=' . $slug . '" data-description="' . $attr['description'] . '" data-wp-format="' . $slug . '" title="' . ucfirst( sprintf( __( '%s Post' ), $slug ) ) . '"><div class="' . $slug . '"></div></a>'; 186 } 187 } 188 189 $current_post_format = array( 'currentPostFormat' => esc_html( $active_post_type_slug ) ); 190 wp_localize_script( 'post', 'postFormats', $current_post_format ); 191 141 192 if ( post_type_supports($post_type, 'page-attributes') ) 142 193 add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); 143 194 … … 337 388 ?> 338 389 339 390 <div id="poststuff"> 340 341 <?php342 if ( post_type_supports( $post_type, 'post-formats' ) ) {343 $all_post_formats = get_post_format_strings();344 345 echo '<h2 class="nav-tab-wrapper post-format-select">';346 347 foreach ( $all_post_formats as $slug => $label ) {348 if ( $post_format == $slug )349 $class = 'nav-tab nav-tab-active';350 else351 $class = 'nav-tab';352 353 echo '<a class="' . $class . '" href="?format=' . $slug . '" data-wp-format="' . $slug . '">' . $label . '</a>';354 }355 356 echo '</h2>';357 }358 ?>359 360 391 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> 361 392 <div id="post-body-content"<?php echo $format_class; ?>> 362 393 394 <?php if ( ! empty( $post_format_options ) ) : ?> 395 <div class="post-format-options"> 396 <span class="post-format-tip">Standard Post</span> 397 <?php echo $post_format_options; ?> 398 </div> 399 <div class="post-format-description"></div> 400 <?php endif; ?> 401 363 402 <?php if ( post_type_supports($post_type, 'title') ) { ?> 364 403 <div id="titlediv"> 365 404 <div id="titlewrap"> -
wp-admin/css/wp-admin-rtl.css
23 23 11.1 - Custom Fields 24 24 11.2 - Post Revisions 25 25 11.3 - Featured Images 26 11.4 - Post Format Selection 26 27 12.0 - Categories 27 28 13.0 - Tags 28 29 14.0 - Media Screen … … 967 968 } 968 969 969 970 /*------------------------------------------------------------------------------ 971 11.4 - Post format selection 972 ------------------------------------------------------------------------------*/ 973 974 .post-format-options a { 975 border-left: 1px solid #ebebeb; 976 border-right: none; 977 } 978 979 .post-format-options a:first-child { 980 -webkit-border-bottom-left-radius: 0; 981 -webkit-border-top-left-radius: 0; 982 border-bottom-left-radius: 0; 983 border-top-left-radius: 0; 984 } 985 986 .post-format-options a:last-child { 987 -webkit-border-bottom-right-radius: 3px; 988 -webkit-border-top-right-radius: 3px; 989 border-bottom-right-radius: 3px; 990 border-top-right-radius: 3px; 991 } 992 993 .post-format-tip { 994 float: left; 995 } 996 997 /*------------------------------------------------------------------------------ 970 998 12.0 - Categories 971 999 ------------------------------------------------------------------------------*/ 972 1000 -
wp-admin/css/wp-admin.css
24 24 11.1 - Custom Fields 25 25 11.2 - Post Revisions 26 26 11.3 - Featured Images 27 11.4 - Post Format Selection 27 28 12.0 - Categories 28 29 13.0 - Tags 29 30 14.0 - Media Screen … … 4066 4067 } 4067 4068 4068 4069 /*------------------------------------------------------------------------------ 4070 11.4 - Post format selection 4071 ------------------------------------------------------------------------------*/ 4072 4073 #icon-edit.standard { 4074 background: url(../images/post-formats32.png) no-repeat -3px -4px; 4075 } 4076 4077 #icon-edit.image { 4078 background: url(../images/post-formats32.png) no-repeat -43px -4px; 4079 } 4080 4081 #icon-edit.gallery { 4082 background: url(../images/post-formats32.png) no-repeat -83px -4px; 4083 } 4084 4085 #icon-edit.audio { 4086 background: url(../images/post-formats32.png) no-repeat -123px -4px; 4087 } 4088 4089 #icon-edit.video { 4090 background: url(../images/post-formats32.png) no-repeat -163px -4px; 4091 } 4092 4093 #icon-edit.chat { 4094 background: url(../images/post-formats32.png) no-repeat -202px -4px; 4095 } 4096 4097 #icon-edit.status { 4098 background: url(../images/post-formats32.png) no-repeat -242px -4px; 4099 } 4100 4101 #icon-edit.aside { 4102 background: url(../images/post-formats32.png) no-repeat -282px -4px; 4103 } 4104 4105 #icon-edit.quote { 4106 background: url(../images/post-formats32.png) no-repeat -322px -4px; 4107 } 4108 4109 #icon-edit.link { 4110 background: url(../images/post-formats32.png) no-repeat -362px -4px; 4111 } 4112 4113 .post-format-description { 4114 color: #666; 4115 display: none; 4116 margin: 10px 0; 4117 } 4118 4119 .post-format-options { 4120 height: 29px; 4121 background: #f9f9f9; 4122 border: 1px solid #dfdfdf; 4123 -webkit-border-radius: 3px; 4124 border-radius: 3px; 4125 margin: 0 0 9px 1px; 4126 padding: 0; 4127 } 4128 4129 .post-format-options a { 4130 border-right: 1px solid #ebebeb; 4131 display: inline-block; 4132 height: 16px; 4133 width: 16px; 4134 padding: 6px; 4135 position: relative; 4136 text-decoration: none; 4137 } 4138 4139 .post-format-options a:first-child { 4140 -webkit-border-bottom-left-radius: 3px; 4141 -webkit-border-top-left-radius: 3px; 4142 border-bottom-left-radius: 3px; 4143 border-top-left-radius: 3px; 4144 } 4145 4146 .post-format-options a.active, 4147 .post-format-options a:focus, 4148 .post-format-options a:hover { 4149 background: #fff; 4150 outline: none; 4151 opacity: 1; 4152 } 4153 4154 .post-format-options a div { 4155 height: 16px; 4156 width: 16px; 4157 opacity: 0.4; 4158 } 4159 4160 .post-format-options a.active div, 4161 .post-format-options a:focus div, 4162 .post-format-options a:hover div { 4163 opacity: 1; 4164 } 4165 4166 .post-format-options .standard { 4167 background: url(../images/post-formats.png) no-repeat -8px -8px; 4168 } 4169 4170 .post-format-options .image { 4171 background: url(../images/post-formats.png) no-repeat -40px -8px; 4172 } 4173 4174 .post-format-options .gallery { 4175 background: url(../images/post-formats.png) no-repeat -72px -8px; 4176 } 4177 4178 .post-format-options .audio { 4179 background: url(../images/post-formats.png) no-repeat -104px -8px; 4180 } 4181 4182 .post-format-options .video { 4183 background: url(../images/post-formats.png) no-repeat -136px -8px; 4184 } 4185 4186 .post-format-options .chat { 4187 background: url(../images/post-formats.png) no-repeat -168px -8px; 4188 } 4189 4190 .post-format-options .status { 4191 background: url(../images/post-formats.png) no-repeat -200px -8px; 4192 } 4193 4194 .post-format-options .aside { 4195 background: url(../images/post-formats.png) no-repeat -232px -8px; 4196 } 4197 4198 .post-format-options .quote { 4199 background: url(../images/post-formats.png) no-repeat -264px -8px; 4200 } 4201 4202 .post-format-options .link { 4203 background: url(../images/post-formats.png) no-repeat -296px -8px; 4204 } 4205 4206 .post-format-tip { 4207 color: #999; 4208 font-size: 14px; 4209 float: right; 4210 padding: 6px 10px; 4211 text-transform: capitalize; 4212 } 4213 4214 /*------------------------------------------------------------------------------ 4069 4215 12.0 - Categories 4070 4216 ------------------------------------------------------------------------------*/ 4071 4217