summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefaan Lippens2010-11-20 00:42:32 (GMT)
committer Stefaan Lippens2010-11-20 00:42:32 (GMT)
commit9ef5ce05ce03fc3988e51d213b806a47db904ce0 (patch)
treedb547f65f215caade324d89dbddbb2268331bcd2
parent9a14c1eb5fc583f439e61ca7890abb665772e9d3 (diff)
fixed jquery magic on image CAPTCHA admin page7.x-1.0-alpha1
-rw-r--r--image_captcha/image_captcha.js68
1 files changed, 34 insertions, 34 deletions
diff --git a/image_captcha/image_captcha.js b/image_captcha/image_captcha.js
index 8e10d8f..9ca45b7 100644
--- a/image_captcha/image_captcha.js
+++ b/image_captcha/image_captcha.js
@@ -1,42 +1,42 @@
// $Id$
-(function ($) {
+(function($) {
-//TODO: change this to Drupal.behaviors.captchaadmin = function (context) {}
-$(document).ready(function(){
+ Drupal.behaviors.captchaAdmin = {
+ attach : function(context) {
- // Helper function to show/hide noise level widget.
- var noise_level_shower = function(speed) {
- speed = (typeof speed == 'undefined') ? 'slow' : speed;
- if ($("#edit-image-captcha-dot-noise").is(":checked") || $("#edit-image-captcha-line-noise").is(":checked")) {
- $("#edit-image-captcha-noise-level-wrapper").show(speed);
- }
- else {
- $("#edit-image-captcha-noise-level-wrapper").hide(speed);
- }
- }
- // Add onclick handler to the dot and line noise check boxes.
- $("#edit-image-captcha-dot-noise").click(noise_level_shower);
- $("#edit-image-captcha-line-noise").click(noise_level_shower);
- // Show or hide appropriately on page load.
- noise_level_shower(0);
+ // Helper function to show/hide noise level widget.
+ var noise_level_shower = function(speed) {
+ speed = (typeof speed == 'undefined') ? 'slow' : speed;
+ if ($("#edit-image-captcha-dot-noise").is(":checked")
+ || $("#edit-image-captcha-line-noise").is(":checked")) {
+ $(".form-item-image-captcha-noise-level").show(speed);
+ } else {
+ $(".form-item-image-captcha-noise-level").hide(speed);
+ }
+ }
+ // Add onclick handler to the dot and line noise check boxes.
+ $("#edit-image-captcha-dot-noise").click(noise_level_shower);
+ $("#edit-image-captcha-line-noise").click(noise_level_shower);
+ // Show or hide appropriately on page load.
+ noise_level_shower(0);
- // Helper function to show/hide smooth distortion widget.
- var smooth_distortion_shower = function(speed) {
- speed = (typeof speed == 'undefined') ? 'slow' : speed;
- if ($("#edit-image-captcha-distortion-amplitude").val() > 0) {
- $("#edit-image-captcha-bilinear-interpolation-wrapper").show(speed);
- }
- else {
- $("#edit-image-captcha-bilinear-interpolation-wrapper").hide(speed);
- }
- }
- // Add onchange handler to the distortion level select widget.
- $("#edit-image-captcha-distortion-amplitude").change(smooth_distortion_shower);
- // Show or hide appropriately on page load.
- smooth_distortion_shower(0)
+ // Helper function to show/hide smooth distortion widget.
+ var smooth_distortion_shower = function(speed) {
+ speed = (typeof speed == 'undefined') ? 'slow' : speed;
+ if ($("#edit-image-captcha-distortion-amplitude").val() > 0) {
+ $(".form-item-image-captcha-bilinear-interpolation").show(speed);
+ } else {
+ $(".form-item-image-captcha-bilinear-interpolation").hide(speed);
+ }
+ }
+ // Add onchange handler to the distortion level select widget.
+ $("#edit-image-captcha-distortion-amplitude").change(
+ smooth_distortion_shower);
+ // Show or hide appropriately on page load.
+ smooth_distortion_shower(0)
-});
+ }
+ };
})(jQuery);
-