From 601c0c2e52b6b16c2974fac40892533172713a7a Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Thu, 25 Apr 2013 05:58:55 +0000 Subject: [PATCH] Clean up gallery-mode toggling in post-formats.js and make sure it is set on first load. see #24062 git-svn-id: http://core.svn.wordpress.org/trunk@24088 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/post-formats.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/wp-admin/js/post-formats.js b/wp-admin/js/post-formats.js index ed212ebb41..4d31ffb03a 100644 --- a/wp-admin/js/post-formats.js +++ b/wp-admin/js/post-formats.js @@ -93,18 +93,15 @@ window.wp = window.wp || {}; } // If gallery, force it to open to gallery state - if ( 'gallery' === format ) - insertMediaButton.addClass( 'gallery' ); - else - insertMediaButton.removeClass( 'gallery' ); + insertMediaButton.toggleClass( 'gallery', 'gallery' === format ); - postFormats.currentPostFormat = format; - } + postFormats.currentPostFormat = format; + } $(function() { - insertMediaButton = $( '#insert-media-button' ); + insertMediaButton = $( '#insert-media-button' ).toggleClass( 'gallery', 'gallery' === postFormats.currentPostFormat ); $container = $( '.post-formats-fields' ); initialFormat = $( '.post-format-options .active' ).data( 'wp-format' );