3 function pickColor(color) {
4 farbtastic.setColor(color);
5 jQuery('#background-color').val(color);
6 jQuery('#custom-background-image').css('background-color', color);
7 if ( color && color !== '#' )
8 jQuery('#clearcolor').show();
10 jQuery('#clearcolor').hide();
13 jQuery(document).ready(function() {
14 jQuery('#pickcolor').click(function() {
15 jQuery('#colorPickerDiv').show();
19 jQuery('#clearcolor a').click( function(e) {
24 jQuery('#background-color').keyup(function() {
25 var _hex = jQuery('#background-color').val(), hex = _hex;
26 if ( hex.charAt(0) != '#' )
28 hex = hex.replace(/[^#a-fA-F0-9]+/, '');
30 jQuery('#background-color').val(hex);
31 if ( hex.length == 4 || hex.length == 7 )
35 jQuery('input[name="background-position-x"]').change(function() {
36 jQuery('#custom-background-image').css('background-position', jQuery(this).val() + ' top');
39 jQuery('input[name="background-repeat"]').change(function() {
40 jQuery('#custom-background-image').css('background-repeat', jQuery(this).val());
43 farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) {
46 pickColor(jQuery('#background-color').val());
48 jQuery(document).mousedown(function(){
49 jQuery('#colorPickerDiv').each(function(){
50 var display = jQuery(this).css('display');
51 if ( display == 'block' )
52 jQuery(this).fadeOut(2);