Theme Customizer: Ensure color pickers initialize to the correct color. see #19910.

git-svn-id: http://svn.automattic.com/wordpress/trunk@20121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
koopersmith 2012-03-06 02:14:27 +00:00
parent 380985868b
commit 5338b8fd73
1 changed files with 6 additions and 3 deletions

View File

@ -172,7 +172,7 @@
parent = picker.parent(), parent = picker.parent(),
toggle = parent.siblings('a'), toggle = parent.siblings('a'),
value = api( parent.siblings('input').prop('name').replace( api.settings.prefix, '' ) ), value = api( parent.siblings('input').prop('name').replace( api.settings.prefix, '' ) ),
farb; farb, update;
value.validate = validateColor; value.validate = validateColor;
text.link( value ); text.link( value );
@ -182,11 +182,14 @@
value.set( color.replace( '#', '' ) ); value.set( color.replace( '#', '' ) );
}); });
value.bind( function( color ) { update = function( color ) {
color = '#' + color; color = '#' + color;
toggle.css( 'background', color ); toggle.css( 'background', color );
farb.setColor( color ); farb.setColor( color );
}); };
value.bind( update );
update( value() );
}); });
$('.color-picker a').click( function(e) { $('.color-picker a').click( function(e) {