Changeset 20120 for trunk/wp-includes/js/customize-controls.dev.js
- Timestamp:
- 03/06/2012 02:03:50 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/customize-controls.dev.js
r20106 r20120 127 127 return; 128 128 129 var previewer,130 controls = $('[name^="' + api.settings.prefix + '"]');129 var controls = $('[name^="' + api.settings.prefix + '"]'), 130 previewer, pickers, validateColor; 131 131 132 132 // Initialize Previewer … … 161 161 }); 162 162 163 // Set up color pickers 164 pickers = $('.color-picker'); 165 validateColor = function( to ) { 166 return /^[a-fA-F0-9]{3}([a-fA-F0-9]{3})?$/.test( to ) ? to : null; 167 }; 168 169 $( '.farbtastic-placeholder', pickers ).each( function() { 170 var picker = $(this), 171 text = new api.Element( picker.siblings('input') ), 172 parent = picker.parent(), 173 toggle = parent.siblings('a'), 174 value = api( parent.siblings('input').prop('name').replace( api.settings.prefix, '' ) ), 175 farb; 176 177 value.validate = validateColor; 178 text.link( value ); 179 value.link( text ); 180 181 farb = $.farbtastic( this, function( color ) { 182 value.set( color.replace( '#', '' ) ); 183 }); 184 185 value.bind( function( color ) { 186 color = '#' + color; 187 toggle.css( 'background', color ); 188 farb.setColor( color ); 189 }); 190 }); 191 192 $('.color-picker a').click( function(e) { 193 $(this).siblings('div').toggle(); 194 }); 195 163 196 // Fetch prefixed settings. 164 197 $('[name^="' + api.settings.prefix + '"]').each( function() {
Note: See TracChangeset
for help on using the changeset viewer.