home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (image_captcha.js)

This example Drupal source code file (image_captcha.js) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

edit-image-captcha-bilinear-interpolation-wrapper, edit-image-captcha-distortion-amplitude, edit-image-captcha-dot-noise, edit-image-captcha-line-noise, edit-image-captcha-noise-level-wrapper, function, hide, if, noise_level_shower, php, slow, speed, typeof, var

The image_captcha.js Drupal example source code

// $Id: image_captcha.js,v 1.1.2.2 2010/11/29 23:34:44 soxofaan Exp $

// JavaScript behaviors for the Image CAPTCHA admin page
Drupal.behaviors.imageCaptchaAdmin = 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 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)

};

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal image_captcha.js source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.