Post Formats: Change post screen icon on selection. props markjaquith. fixes #24140.

git-svn-id: https://develop.svn.wordpress.org/trunk@24039 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2013-04-19 22:00:10 +00:00
parent 36be772bd5
commit 24901103a9
3 changed files with 16 additions and 13 deletions

View File

@ -4031,52 +4031,52 @@ body .ui-tooltip {
min-height: 97px; min-height: 97px;
} }
#icon-edit.standard, #icon-edit.wp-format-standard,
.post-format-options .standard { .post-format-options .standard {
background: url(../images/post-formats32.png) no-repeat -3px -4px; background: url(../images/post-formats32.png) no-repeat -3px -4px;
} }
#icon-edit.image, #icon-edit.wp-format-image,
.post-format-options .image { .post-format-options .image {
background: url(../images/post-formats32.png) no-repeat -43px -4px; background: url(../images/post-formats32.png) no-repeat -43px -4px;
} }
#icon-edit.gallery, #icon-edit.wp-format-gallery,
.post-format-options .gallery { .post-format-options .gallery {
background: url(../images/post-formats32.png) no-repeat -83px -4px; background: url(../images/post-formats32.png) no-repeat -83px -4px;
} }
#icon-edit.audio, #icon-edit.wp-format-audio,
.post-format-options .audio { .post-format-options .audio {
background: url(../images/post-formats32.png) no-repeat -123px -4px; background: url(../images/post-formats32.png) no-repeat -123px -4px;
} }
#icon-edit.video, #icon-edit.wp-format-video,
.post-format-options .video { .post-format-options .video {
background: url(../images/post-formats32.png) no-repeat -163px -4px; background: url(../images/post-formats32.png) no-repeat -163px -4px;
} }
#icon-edit.chat, #icon-edit.wp-format-chat,
.post-format-options .chat { .post-format-options .chat {
background: url(../images/post-formats32.png) no-repeat -202px -4px; background: url(../images/post-formats32.png) no-repeat -202px -4px;
} }
#icon-edit.status, #icon-edit.wp-format-status,
.post-format-options .status { .post-format-options .status {
background: url(../images/post-formats32.png) no-repeat -242px -4px; background: url(../images/post-formats32.png) no-repeat -242px -4px;
} }
#icon-edit.aside, #icon-edit.wp-format-aside,
.post-format-options .aside { .post-format-options .aside {
background: url(../images/post-formats32.png) no-repeat -282px -4px; background: url(../images/post-formats32.png) no-repeat -282px -4px;
} }
#icon-edit.quote, #icon-edit.wp-format-quote,
.post-format-options .quote { .post-format-options .quote {
background: url(../images/post-formats32.png) no-repeat -322px -4px; background: url(../images/post-formats32.png) no-repeat -322px -4px;
} }
#icon-edit.link, #icon-edit.wp-format-link,
.post-format-options .link { .post-format-options .link {
background: url(../images/post-formats32.png) no-repeat -362px -4px; background: url(../images/post-formats32.png) no-repeat -362px -4px;
} }

View File

@ -171,7 +171,7 @@ function get_screen_icon( $screen = '' ) {
if ( $post_ID ) { if ( $post_ID ) {
$format = get_post_format( $post_ID ); $format = get_post_format( $post_ID );
if ( $format ) if ( $format )
$class .= ' ' . $format; $class .= ' wp-format-' . $format;
} }
} }

View File

@ -3,11 +3,14 @@ window.wp = window.wp || {};
(function($) { (function($) {
var container, mediaFrame, lastMimeType, mediaPreview, var container, mediaFrame, lastMimeType, mediaPreview,
noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'], noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery'],
$container = $( '.post-formats-fields' ); $container = $( '.post-formats-fields' ),
$screenIcon = $( '.icon32' );
function switchFormatClass( format ) { function switchFormatClass( format ) {
container.get(0).className = container.get(0).className.replace( /\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);
$screenIcon.get(0).className = $screenIcon.get(0).className.replace( /\s?\bwp-format-[^ ]+/g, '' );
$screenIcon.addClass('wp-format-' + format);
} }
function switchFormat($this) { function switchFormat($this) {