Ticket #17198: farbtastic-color-input.diff
| File farbtastic-color-input.diff, 2.6 KB (added by , 15 years ago) |
|---|
-
wp-content/themes/twentyeleven/inc/theme-options.php
192 192 <td> 193 193 <fieldset><legend class="screen-reader-text"><span><?php _e( 'Link Color', 'twentyeleven' ); ?></span></legend> 194 194 <input type="text" name="twentyeleven_theme_options[link_color]" id="link-color" value="<?php echo esc_attr( $options['link_color'] ); ?>" /> 195 < span id="link-color-example"></span> <a class="hide-if-no-js" href="#" id="pickcolor"><?php _e( 'Select a Color', 'twentyeleven' ); ?></a>195 <a class="hide-if-no-js" href="#" id="pickcolor"><?php _e( 'Select a Color', 'twentyeleven' ); ?></a> 196 196 <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div> 197 197 <br /> 198 198 <small class="description"><?php printf( __( 'Default color: %s', 'twentyeleven' ), $default_options['link_color'] ); ?></small> -
wp-content/themes/twentyeleven/inc/theme-options.css
19 19 } 20 20 .image-radio-option img { 21 21 margin: 0 0 0 -2px; 22 }23 #link-color-example {24 padding: 4px 14px;25 margin: 0 7px 0 3px;26 -moz-border-radius: 4px;27 -khtml-border-radius: 4px;28 -webkit-border-radius: 4px;29 border-radius: 4px;30 border: 1px solid #dfdfdf;31 22 } 32 No newline at end of file -
wp-content/themes/twentyeleven/inc/theme-options.js
1 1 var farbtastic; 2 2 3 3 (function($){ 4 var pickColor = function(a) {5 farbtastic.setColor(a);6 $('#link-color').val(a);7 $('#link-color-example').css('background-color', a);8 }9 10 4 $(document).ready( function() { 11 farbtastic = $.farbtastic('#colorPickerDiv', pickColor);5 farbtastic = $.farbtastic('#colorPickerDiv', '#link-color'); 12 6 13 pickColor( $('#link-color').val() );14 15 7 $('#pickcolor').click( function(e) { 16 8 $('#colorPickerDiv').show(); 17 9 e.preventDefault(); … … 25 17 if ( '#' + a !== b ) 26 18 $('#link-color').val(a); 27 19 if ( a.length === 3 || a.length === 6 ) 28 pickColor( '#' + a );20 a = '#' + a; 29 21 }); 30 22 31 23 $(document).mousedown( function() {