4 var pickColor = function(a) {
5 farbtastic.setColor(a);
6 $('#link-color').val(a);
7 $('#link-color-example').css('background-color', a);
10 $(document).ready( function() {
11 $('#default-color').wrapInner('<a href="#" />');
13 farbtastic = $.farbtastic('#colorPickerDiv', pickColor);
15 pickColor( $('#link-color').val() );
17 $('.pickcolor').click( function(e) {
18 $('#colorPickerDiv').show();
22 $('#link-color').keyup( function() {
23 var a = $('#link-color').val(),
26 a = a.replace(/[^a-fA-F0-9]/, '');
28 $('#link-color').val(a);
29 if ( a.length === 3 || a.length === 6 )
33 $(document).mousedown( function() {
34 $('#colorPickerDiv').hide();
37 $('#default-color a').click( function(e) {
38 pickColor( '#' + this.innerHTML.replace(/[^a-fA-F0-9]/, '') );
42 $('.image-radio-option.color-scheme input:radio').change( function() {
43 var currentDefault = $('#default-color a'),
44 newDefault = $(this).next().val();
46 if ( $('#link-color').val() == currentDefault.text() )
47 pickColor( newDefault );
49 currentDefault.text( newDefault );