Make the content area smaller for Aside/Status posts.
props wonderboymusic. fixes #23992. git-svn-id: http://core.svn.wordpress.org/trunk@24077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4ab8bee42d
commit
5f08d11b11
|
@ -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));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue