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 || {};
|
window.wp = window.wp || {};
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
var container, mediaFrame, lastMimeType, mediaPreview,
|
var container, mediaFrame, lastMimeType, mediaPreview, lastHeight, content,
|
||||||
noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
|
|
||||||
$container = $( '.post-formats-fields' ),
|
$container = $( '.post-formats-fields' ),
|
||||||
|
shortClass = 'short-format',
|
||||||
|
shortContentFormats = ['status', 'aside'],
|
||||||
|
noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
|
||||||
$screenIcon = $( '.icon32' );
|
$screenIcon = $( '.icon32' );
|
||||||
|
|
||||||
|
|
||||||
function switchFormatClass( format ) {
|
function switchFormatClass( format ) {
|
||||||
container.get(0).className = container.get(0).className.replace( /\s?\bwp-format-[^ ]+/g, '' );
|
container.get(0).className = container.get(0).className.replace( /\s?\bwp-format-[^ ]+/g, '' );
|
||||||
container.addClass('wp-format-' + format);
|
container.addClass('wp-format-' + format);
|
||||||
|
@ -13,6 +16,18 @@ window.wp = window.wp || {};
|
||||||
$screenIcon.addClass('wp-format-' + format);
|
$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) {
|
function switchFormat($this) {
|
||||||
var editor, body,
|
var editor, body,
|
||||||
parent = $this.parent(),
|
parent = $this.parent(),
|
||||||
|
@ -38,6 +53,8 @@ window.wp = window.wp || {};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resizeContent( -1 < $.inArray( format, shortContentFormats ) );
|
||||||
|
|
||||||
postTitle.focus();
|
postTitle.focus();
|
||||||
|
|
||||||
if ( '' === postTitle.val() )
|
if ( '' === postTitle.val() )
|
||||||
|
@ -71,7 +88,7 @@ window.wp = window.wp || {};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Post formats selection
|
// Post formats selection
|
||||||
$('.post-format-options').on( 'click', 'a', function(e){
|
$('.post-format-options').on( 'click', 'a', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
switchFormat($(this));
|
switchFormat($(this));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue