Changeset 23854
- Timestamp:
- 03/29/2013 07:46:24 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/post-formats.js
r23853 r23854 2 2 3 3 (function($) { 4 var mediaFrame, lastMimeType, lastMenu, mediaPreview; 4 var container, mediaFrame, lastMimeType, lastMenu, mediaPreview, noUIFormats = ['standard', 'chat', 'status', 'aside']; 5 6 function switchFormatClass( format ) { 7 container.get(0).className = container.get(0).className.replace( /\bwp-format-[^ ]+/, '' ); 8 container.addClass('wp-format-' + format); 9 } 10 5 11 $(function(){ 6 12 var $container = $( '.post-formats-fields' ); … … 8 14 // Post formats selection 9 15 $('.post-format-options').on( 'click', 'a', function(e){ 16 e.preventDefault(); 10 17 var $this = $(this), editor, body, 11 18 parent = $this.parent(), 12 19 format = $this.data('wp-format'), 13 container = $('#post-body-content'),14 20 description = $('.post-format-description'); 21 22 if ( typeof container === 'undefined' ) 23 container = $('#post-body-content'); 24 25 // Already on this post format. Bail. 26 if ( format === postFormats.currentPostFormat ) 27 return; 15 28 16 29 parent.find('a.active').removeClass('active'); … … 19 32 $('#post_format').val(format); 20 33 21 $container.slideUp( 200, function(){ 22 container.get(0).className = container.get(0).className.replace( /\bwp-format-[^ ]+/, '' ); 23 container.addClass('wp-format-' + format); 24 $container.slideDown( 400 ); 25 }); 34 if ( -1 < $.inArray( format, noUIFormats ) && -1 < $.inArray( postFormats.currentPostFormat, noUIFormats ) ) { 35 switchFormatClass( format ); // No slide 36 } else { 37 $container.slideUp( 200, function(){ 38 switchFormatClass( format ); 39 $container.slideDown( 400 ); 40 }); 41 } 26 42 27 43 $('#title').focus(); … … 44 60 45 61 postFormats.currentPostFormat = format; 46 47 e.preventDefault();48 62 }).on('mouseenter focusin', 'a', function () { 49 63 $('.post-format-tip').html( $(this).prop('title') );
Note: See TracChangeset
for help on using the changeset viewer.