Projet

Général

Profil

Paste
Télécharger (1,51 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / captcha / image_captcha / image_captcha.js @ ac1bc5de

1
(function($) {
2

    
3
  Drupal.behaviors.captchaAdmin = {
4
    attach : function(context) {
5

    
6
      // Helper function to show/hide noise level widget.
7
      var noise_level_shower = function(speed) {
8
        speed = (typeof speed == 'undefined') ? 'slow' : speed;
9
        if ($("#edit-image-captcha-dot-noise").is(":checked") || $("#edit-image-captcha-line-noise").is(":checked")) {
10
          $(".form-item-image-captcha-noise-level").show(speed);
11
        } else {
12
          $(".form-item-image-captcha-noise-level").hide(speed);
13
        }
14
      };
15
      // Add onclick handler to the dot and line noise check boxes.
16
      $("#edit-image-captcha-dot-noise").click(noise_level_shower);
17
      $("#edit-image-captcha-line-noise").click(noise_level_shower);
18
      // Show or hide appropriately on page load.
19
      noise_level_shower(0);
20

    
21
      // Helper function to show/hide smooth distortion widget.
22
      var smooth_distortion_shower = function(speed) {
23
        speed = (typeof speed == 'undefined') ? 'slow' : speed;
24
        if ($("#edit-image-captcha-distortion-amplitude").val() > 0) {
25
          $(".form-item-image-captcha-bilinear-interpolation").show(speed);
26
        } else {
27
          $(".form-item-image-captcha-bilinear-interpolation").hide(speed);
28
        }
29
      };
30
      // Add onchange handler to the distortion level select widget.
31
      $("#edit-image-captcha-distortion-amplitude").change(
32
          smooth_distortion_shower);
33
      // Show or hide appropriately on page load.
34
      smooth_distortion_shower(0);
35

    
36
    }
37
  };
38

    
39
})(jQuery);