Ticket #21206: iris-twentyeleven.diff
File iris-twentyeleven.diff, 10.2 KB (added by , 13 years ago) |
---|
-
wp-includes/script-loader.php
399 399 400 400 $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' ); 401 401 402 $iris_deps = array( 'jquery-ui-draggable', 'jquery-ui-slider' ); 403 if ( wp_is_mobile() ) 404 $iris_deps[] = 'touch-punch'; 405 $scripts->add( 'iris', '/wp-admin/js/iris.js', $iris_deps, false, 1 ); 406 407 $scripts->add( 'wp-color-picker', "/wp-admin/js/wp-color-picker$suffix.js", array( 'iris' ), false, 1 ); 408 did_action( 'init' ) && $scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array( 409 'clear' => __( 'Clear' ), 410 'defaultString' => __( 'Default' ), 411 'pick' => __( 'Select a Color' ) 412 )); 413 402 414 $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), false, 1 ); 403 415 404 416 $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" ); … … 426 438 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.') 427 439 ) ); 428 440 429 $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array(' farbtastic'), false, 1 );441 $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array('wp-color-picker'), false, 1 ); 430 442 $scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array('jquery'), false, 1 ); 431 443 } 432 444 } … … 479 491 $styles->add( 'install', "/wp-admin/css/install$suffix.css" ); 480 492 $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css' ); 481 493 $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u1' ); 494 $styles->add( 'wp-color-picker', '/wp-admin/css/wp-color-picker.css' ); 482 495 $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' ); 483 496 $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' ); 484 497 $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css" ); -
wp-content/themes/twentyeleven/inc/theme-options.php
17 17 */ 18 18 function twentyeleven_admin_enqueue_scripts( $hook_suffix ) { 19 19 wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' ); 20 wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( ' farbtastic' ), '2011-06-10' );21 wp_enqueue_style( 'farbtastic');20 wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( 'wp-color-picker' ), '2012-08-22' ); 21 wp_enqueue_style('wp-color-picker'); 22 22 } 23 23 add_action( 'admin_print_styles-appearance_page_theme_options', 'twentyeleven_admin_enqueue_scripts' ); 24 24 … … 268 268 function twentyeleven_settings_field_link_color() { 269 269 $options = twentyeleven_get_theme_options(); 270 270 ?> 271 <input type="text" name="twentyeleven_theme_options[link_color]" id="link-color" value="<?php echo esc_attr( $options['link_color'] ); ?>" /> 272 <a href="#" class="pickcolor hide-if-no-js" id="link-color-example"></a> 273 <input type="button" class="pickcolor button hide-if-no-js" value="<?php esc_attr_e( 'Select a Color', 'twentyeleven' ); ?>" /> 274 <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div> 275 <br /> 276 <span><?php printf( __( 'Default color: %s', 'twentyeleven' ), '<span id="default-color">' . twentyeleven_get_default_link_color( $options['color_scheme'] ) . '</span>' ); ?></span> 271 <?php $default_color = 'data-default-color="' . twentyeleven_get_default_link_color( $options['color_scheme'] ) . '"'; ?> 272 <input type="text" name="twentyeleven_theme_options[link_color]" id="link-color" value="<?php echo esc_attr( $options['link_color'] ); ?>" <?php echo $default_color ?>/> 277 273 <?php 278 274 } 279 275 -
wp-content/themes/twentyeleven/inc/theme-options.js
1 var farbtastic;2 3 1 (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 2 10 3 $(document).ready( function() { 11 $('#default-color').wrapInner('<a href="#" />'); 12 13 farbtastic = $.farbtastic('#colorPickerDiv', pickColor); 14 15 pickColor( $('#link-color').val() ); 16 17 $('.pickcolor').click( function(e) { 18 $('#colorPickerDiv').show(); 19 e.preventDefault(); 20 }); 21 22 $('#link-color').keyup( function() { 23 var a = $('#link-color').val(), 24 b = a; 25 26 a = a.replace(/[^a-fA-F0-9]/, ''); 27 if ( '#' + a !== b ) 28 $('#link-color').val(a); 29 if ( a.length === 3 || a.length === 6 ) 30 pickColor( '#' + a ); 31 }); 32 33 $(document).mousedown( function() { 34 $('#colorPickerDiv').hide(); 35 }); 36 37 $('#default-color a').click( function(e) { 38 pickColor( '#' + this.innerHTML.replace(/[^a-fA-F0-9]/, '') ); 39 e.preventDefault(); 40 }); 41 4 5 $('#link-color').wpColorPicker(); 6 42 7 $('.image-radio-option.color-scheme input:radio').change( function() { 43 var currentDefault = $('# default-color a'),8 var currentDefault = $('#link-color').attr('data-default-color'), 44 9 newDefault = $(this).next().val(); 45 10 46 if ( $('#link-color').val() == currentDefault.text() ) 47 pickColor( newDefault ); 48 49 currentDefault.text( newDefault ); 11 if ( $('#link-color').val() == currentDefault.toString() ) { 12 $("#link-color").iris("option", "color", newDefault ) 13 } 50 14 }); 15 51 16 }); 52 17 })(jQuery); 18 No newline at end of file -
wp-admin/js/custom-background.dev.js
1 var farbtastic, pickColor;2 3 1 (function($) { 4 2 5 var defaultColor = '';6 7 pickColor = function(color) {8 farbtastic.setColor(color);9 $('#background-color').val(color);10 $('#custom-background-image').css('background-color', color);11 // If we have a default color, and they match, then we need to hide the 'Default' link.12 // Otherwise, we hide the 'Clear' link when it is empty.13 if ( ( defaultColor && color === defaultColor ) || ( ! defaultColor && ( '' === color || '#' === color ) ) )14 $('#clearcolor').hide();15 else16 $('#clearcolor').show();17 }18 19 3 $(document).ready(function() { 4 var bgImage = $("#custom-background-image"); 20 5 21 defaultColor = $('#defaultcolor').val(); 22 23 $('#pickcolor').click(function() { 24 $('#colorPickerDiv').show(); 25 return false; 6 $('#background-color').wpColorPicker({ 7 change: function( event, ui ) { 8 bgImage.css('background-color', ui.color.toString()); 9 }, 10 clear: function() { 11 bgImage.css('background-color', ''); 12 } 26 13 }); 27 14 28 $('#clearcolor a').click( function(e) {29 pickColor( defaultColor );30 e.preventDefault();31 });32 33 $('#background-color').keyup(function() {34 var _hex = $('#background-color').val(), hex = _hex;35 if ( hex.charAt(0) != '#' )36 hex = '#' + hex;37 hex = hex.replace(/[^#a-fA-F0-9]+/, '');38 if ( hex != _hex )39 $('#background-color').val(hex);40 if ( hex.length == 4 || hex.length == 7 )41 pickColor( hex );42 });43 44 15 $('input[name="background-position-x"]').change(function() { 45 $('#custom-background-image').css('background-position', $(this).val() + ' top');16 bgImage.css('background-position', $(this).val() + ' top'); 46 17 }); 47 18 48 19 $('input[name="background-repeat"]').change(function() { 49 $('#custom-background-image').css('background-repeat', $(this).val());20 bgImage.css('background-repeat', $(this).val()); 50 21 }); 51 52 farbtastic = $.farbtastic('#colorPickerDiv', function(color) {53 pickColor(color);54 });55 pickColor($('#background-color').val());56 57 $(document).mousedown(function(){58 $('#colorPickerDiv').each(function(){59 var display = $(this).css('display');60 if ( display == 'block' )61 $(this).fadeOut(2);62 });63 });64 22 }); 65 23 66 24 })(jQuery); 67 No newline at end of file -
wp-admin/custom-background.php
108 108 add_thickbox(); 109 109 wp_enqueue_script('media-upload'); 110 110 wp_enqueue_script('custom-background'); 111 wp_enqueue_style(' farbtastic');111 wp_enqueue_style('wp-color-picker'); 112 112 } 113 113 114 114 /** … … 327 327 <tr valign="top"> 328 328 <th scope="row"><?php _e( 'Background Color' ); ?></th> 329 329 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend> 330 <?php $show_clear = get_theme_mod('background_color') ? '' : ' style="display:none"'; ?> 331 <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()) ?>" /> 332 <a class="hide-if-no-js" href="#" id="pickcolor"><?php _e('Select a Color'); ?></a> <span<?php echo $show_clear; ?> class="hide-if-no-js" id="clearcolor"> (<a href="#"><?php current_theme_supports( 'custom-background', 'default-color' ) ? _e( 'Default' ) : _e( 'Clear' ); ?></a>)</span> 333 <input type="hidden" id="defaultcolor" value="<?php if ( current_theme_supports( 'custom-background', 'default-color' ) ) echo '#' . esc_attr( get_theme_support( 'custom-background', 'default-color' ) ); ?>" /> 334 <div id="colorPickerDiv" style="z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;"></div> 330 <?php $default_color = current_theme_supports( 'custom-background', 'default-color' ) ? 'data-default-color="#' . esc_attr( get_theme_support( 'custom-background', 'default-color' ) ) . '" ' : ''; ?> 331 <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()) ?>" <?php echo $default_color ?>/> 335 332 </fieldset></td> 336 333 </tr> 337 334 </tbody>