Projet

Général

Profil

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

root / drupal7 / sites / all / modules / captcha / image_captcha / image_captcha.js @ 66b5cbf6

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")
10
            || $("#edit-image-captcha-line-noise").is(":checked")) {
11
          $(".form-item-image-captcha-noise-level").show(speed);
12
        } else {
13
          $(".form-item-image-captcha-noise-level").hide(speed);
14
        }
15
      }
16
      // Add onclick handler to the dot and line noise check boxes.
17
      $("#edit-image-captcha-dot-noise").click(noise_level_shower);
18
      $("#edit-image-captcha-line-noise").click(noise_level_shower);
19
      // Show or hide appropriately on page load.
20
      noise_level_shower(0);
21

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

    
37
    }
38
  };
39

    
40
})(jQuery);