diff --git a/wp-content/themes/twentyeleven/inc/theme-options.css b/wp-content/themes/twentyeleven/inc/theme-options.css index 61cb64d02..568fa9b02 100644 --- a/wp-content/themes/twentyeleven/inc/theme-options.css +++ b/wp-content/themes/twentyeleven/inc/theme-options.css @@ -19,4 +19,13 @@ } .image-radio-option img { margin: 0 0 0 -2px; +} +#link-color-example { + padding: 4px 14px; + margin: 0 7px 0 3px; + -moz-border-radius: 4px; + -khtml-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + border: 1px solid #dfdfdf; } \ No newline at end of file diff --git a/wp-content/themes/twentyeleven/inc/theme-options.js b/wp-content/themes/twentyeleven/inc/theme-options.js index c09796ba9..c0dfde227 100644 --- a/wp-content/themes/twentyeleven/inc/theme-options.js +++ b/wp-content/themes/twentyeleven/inc/theme-options.js @@ -1,39 +1,35 @@ var farbtastic; -function pickColor(a) { - farbtastic.setColor(a); - jQuery("#link-color").val(a); - jQuery("#link-color").css("background-color", a); -} -jQuery(document).ready(function() { - jQuery("#pickcolor").click(function() { - jQuery("#colorPickerDiv").show(); - return false; - }); - jQuery("#link-color").keyup(function() { - var b = jQuery("#link-color").val(), - a = b; - if (a.charAt(0) != "#") { - a = "#" + a; - } - a = a.replace(/[^#a-fA-F0-9]+/, ""); - if (a != b) { - jQuery("#link-color").val(a); - } - if (a.length == 4 || a.length == 7) { - pickColor(a); - } - }); - farbtastic = jQuery.farbtastic("#colorPickerDiv", - function(a) { - pickColor(a); - }); - pickColor(jQuery("#link-color").val()); - jQuery(document).mousedown(function() { - jQuery("#colorPickerDiv").each(function() { - var a = jQuery(this).css("display"); - if (a == "block") { - jQuery(this).fadeOut(2); - } + +(function($){ + var pickColor = function(a) { + farbtastic.setColor(a); + $('#link-color').val(a); + $('#link-color-example').css('background-color', a); + } + + $(document).ready( function() { + farbtastic = $.farbtastic('#colorPickerDiv', pickColor); + + pickColor( $('#link-color').val() ); + + $('#pickcolor').click( function(e) { + $('#colorPickerDiv').show(); + e.preventDefault(); + }); + + $('#link-color').keyup( function() { + var a = $('#link-color').val(), + b = a; + + a = a.replace(/[^a-fA-F0-9]/, ''); + if ( '#' + a !== b ) + $('#link-color').val(a); + if ( a.length === 3 || a.length === 6 ) + pickColor( '#' + a ); + }); + + $(document).mousedown( function() { + $('#colorPickerDiv').hide(); }); }); -}); \ No newline at end of file +})(jQuery); \ No newline at end of file diff --git a/wp-content/themes/twentyeleven/inc/theme-options.php b/wp-content/themes/twentyeleven/inc/theme-options.php index 640de706d..49b3382db 100644 --- a/wp-content/themes/twentyeleven/inc/theme-options.php +++ b/wp-content/themes/twentyeleven/inc/theme-options.php @@ -21,10 +21,9 @@ function twentyeleven_admin_enqueue_scripts( $hook_suffix ) { if ( $hook_suffix != 'appearance_page_theme_options' ) return; - wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', '', '0.1' ); - wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js' ); + wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' ); + wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( 'farbtastic' ), '2011-04-28' ); wp_enqueue_style( 'farbtastic' ); - wp_enqueue_script( 'farbtastic' ); } add_action( 'admin_enqueue_scripts', 'twentyeleven_admin_enqueue_scripts' ); @@ -193,7 +192,7 @@ function theme_options_render_page() {
- +