Make the content area smaller for Aside/Status posts.

props wonderboymusic. fixes #23992.

git-svn-id: https://develop.svn.wordpress.org/trunk@24077 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2013-04-25 02:07:05 +00:00
parent 6303d1a71a
commit c10958235f
1 changed files with 20 additions and 3 deletions

View File

@ -1,11 +1,14 @@
window.wp = window.wp || {};
(function($) {
var container, mediaFrame, lastMimeType, mediaPreview,
noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
var container, mediaFrame, lastMimeType, mediaPreview, lastHeight, content,
$container = $( '.post-formats-fields' ),
shortClass = 'short-format',
shortContentFormats = ['status', 'aside'],
noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
$screenIcon = $( '.icon32' );
function switchFormatClass( format ) {
container.get(0).className = container.get(0).className.replace( /\s?\bwp-format-[^ ]+/g, '' );
container.addClass('wp-format-' + format);
@ -13,6 +16,18 @@ window.wp = window.wp || {};
$screenIcon.addClass('wp-format-' + format);
}
function resizeContent( shorter ) {
content = content || $('#content, #content_ifr');
if ( shorter ) {
if ( ! content.hasClass(shortClass) ) {
lastHeight = content.height();
content.addClass(shortClass).animate({ height : 120 });
}
} else if ( lastHeight ) {
content.removeClass(shortClass).animate({ height : lastHeight });
}
}
function switchFormat($this) {
var editor, body,
parent = $this.parent(),
@ -38,6 +53,8 @@ window.wp = window.wp || {};
});
}
resizeContent( -1 < $.inArray( format, shortContentFormats ) );
postTitle.focus();
if ( '' === postTitle.val() )
@ -71,7 +88,7 @@ window.wp = window.wp || {};
});
// Post formats selection
$('.post-format-options').on( 'click', 'a', function(e){
$('.post-format-options').on( 'click', 'a', function (e) {
e.preventDefault();
switchFormat($(this));
});