Projet

Général

Profil

Révision 62e0cc08

Ajouté par Assos Assos il y a plus de 3 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/calendar/js/calendar_colorpicker.js
10 10
(function ($) {
11 11
  Drupal.behaviors.field_example_colorpicker = {
12 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 13

  
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
      });
14
      if ($.isFunction($.fn.on)) {
15
        // For jQuery 1.7+
16
        $(document).on("focus", ".edit-calendar-colorpicker", calendarFocusHandler);
17
      } else {
18
        $(".edit-calendar-colorpicker").live("focus", calendarFocusHandler);
19
      }
20

  
24 21
    }
25 22
  }
23

  
24
  function calendarFocusHandler(event) {
25
    var edit_field = this;
26
    var picker = $(this).closest('div').parent().find(".calendar-colorpicker");
27

  
28
    // Hide all color pickers except this one.
29
    $(".calendar-colorpicker").hide();
30
    $(picker).show();
31
    $.farbtastic(picker, function(color) {
32
      edit_field.value = color;
33
    }).setColor(edit_field.value);
34
  }
26 35
})(jQuery);
27 36

  

Formats disponibles : Unified diff