home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 March / maximum-cd-2012-03.iso / DiscContents / npp.5.9.6.2.Installer.exe / user.manual / sites / all / modules / captcha / captcha5dbc.js
Encoding:
JavaScript  |  2011-07-18  |  1.3 KB  |  37 lines

  1. // $Id: captcha.js,v 1.2.2.3 2011/02/06 20:45:12 soxofaan Exp $
  2.  
  3. // Javascript behaviors for general CAPTCHA functionality.
  4. Drupal.behaviors.captcha = 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. // JavaScript behaviors for the CAPTCHA admin page
  16. Drupal.behaviors.captchaAdmin = function (context) {
  17.  
  18.     // Add onclick handler to checkbox for adding a CAPTCHA description
  19.     // so that the textfields for the CAPTCHA description are hidden
  20.     // when no description should be added.
  21.     $("#edit-captcha-add-captcha-description").click(function() {
  22.         if ($("#edit-captcha-add-captcha-description").is(":checked")) {
  23.             // Show the CAPTCHA description textfield(s).
  24.             $("#edit-captcha-description-wrapper").show("slow");
  25.         }
  26.         else {
  27.             // Hide the CAPTCHA description textfield(s).
  28.             $("#edit-captcha-description-wrapper").hide("slow");
  29.         }
  30.     });
  31.     // Hide the CAPTCHA description textfields if option is disabled on page load.
  32.     if (!$("#edit-captcha-add-captcha-description").is(":checked")) {
  33.         $("#edit-captcha-description-wrapper").hide();
  34.     }
  35.  
  36. };
  37.