26 lines
700 B
JavaScript
26 lines
700 B
JavaScript
/**
|
|
* @file
|
|
* Javascript for Field Example.
|
|
*/
|
|
|
|
/**
|
|
* Provides a farbtastic colorpicker for the fancier widget.
|
|
*/
|
|
(function ($) {
|
|
Drupal.behaviors.field_example_colorpicker = {
|
|
attach: function(context) {
|
|
$(".edit-field-example-colorpicker").live("focus", function(event) {
|
|
var edit_field = this;
|
|
var picker = $(this).closest('div').parent().find(".field-example-colorpicker");
|
|
|
|
// Hide all color pickers except this one.
|
|
$(".field-example-colorpicker").hide();
|
|
$(picker).show();
|
|
$.farbtastic(picker, function(color) {
|
|
edit_field.value = color;
|
|
}).setColor(edit_field.value);
|
|
});
|
|
}
|
|
}
|
|
})(jQuery);
|