Projet

Général

Profil

Paste
Télécharger (796 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / calendar / js / calendar_colorpicker.js @ 651307cd

1
/**
2
 * Implementation of hook_elements.
3
 *
4
 * Much of the colorpicker code was adapted from the Colorpicker module.
5
 * That module has no stable release yet nor any D6 branch.
6
 */
7
/*
8
 *  Bind the colorpicker event to the form element
9
 */
10
(function ($) {
11
  Drupal.behaviors.field_example_colorpicker = {
12
    attach: function(context) {
13
      $(".edit-calendar-colorpicker").live("focus", function(event) {
14
        var edit_field = this;
15
        var picker = $(this).closest('div').parent().find(".calendar-colorpicker");
16

    
17
        // Hide all color pickers except this one.
18
        $(".calendar-colorpicker").hide();
19
        $(picker).show();
20
        $.farbtastic(picker, function(color) {
21
          edit_field.value = color;
22
        }).setColor(edit_field.value);
23
      });
24
    }
25
  }
26
})(jQuery);
27