root / drupal7 / sites / all / modules / captcha / captcha.js @ d719f12f
1 | 85ad3d82 | Assos Assos | (function ($) { |
---|---|---|---|
2 | |||
3 | Drupal.behaviors.captcha = { |
||
4 | attach: function (context) { |
||
5 | |||
6 | // Turn off autocompletion for the CAPTCHA response field.
|
||
7 | // We do it here with Javascript (instead of directly in the markup)
|
||
8 | // because this autocomplete attribute is not standard and
|
||
9 | // it would break (X)HTML compliance.
|
||
10 | $("#edit-captcha-response").attr("autocomplete", "off"); |
||
11 | |||
12 | } |
||
13 | }; |
||
14 | |||
15 | Drupal.behaviors.captchaAdmin = { |
||
16 | attach: function (context) { |
||
17 | ac1bc5de | Assos Assos | // Add onclick handler to checkbox for adding a CAPTCHA description
|
18 | // so that the textfields for the CAPTCHA description are hidden
|
||
19 | // when no description should be added.
|
||
20 | 85ad3d82 | Assos Assos | // @todo: div.form-item-captcha-description depends on theming, maybe
|
21 | // it's better to add our own wrapper with id (instead of a class).
|
||
22 | ac1bc5de | Assos Assos | $("#edit-captcha-add-captcha-description").click(function() { |
23 | if ($("#edit-captcha-add-captcha-description").is(":checked")) { |
||
24 | // Show the CAPTCHA description textfield(s).
|
||
25 | $("div.form-item-captcha-description").show('slow'); |
||
26 | } |
||
27 | else {
|
||
28 | // Hide the CAPTCHA description textfield(s).
|
||
29 | $("div.form-item-captcha-description").hide('slow'); |
||
30 | } |
||
31 | }); |
||
32 | // Hide the CAPTCHA description textfields if option is disabled on page load.
|
||
33 | if (!$("#edit-captcha-add-captcha-description").is(":checked")) { |
||
34 | $("div.form-item-captcha-description").hide(); |
||
35 | } |
||
36 | 85ad3d82 | Assos Assos | } |
37 | |||
38 | }; |
||
39 | |||
40 | })(jQuery); |