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