/* Mod Name: Jaws SpamGuard Plugin URI: http://kublun.com/spamguard Description: Client-side javascript computes an md5 code, server double checks. Blocks all spam bots. XHTML 1.1 compliant. Author: Wieland E. Kublun < wieland.kublun@gmx.net > Author URI: http://kublun.com Version: 0.2 Date: 26/09/2006 Greets: Héctor Bautista Flores - http://hbautista.usoli.org José Carlos Nieto - http://xiam.menteslibres.org Elliot Back - http://elliottback.com/ Paul Andrew Johnston - http://pajhome.org.uk/crypt/md5 */ function getBrowserEngine() { if (navigator.userAgent.indexOf('Gecko') > 0) return 'gecko'; else if (navigator.userAgent.indexOf('MSIE') > 0) { // opera says it's MSIE 6.0 compatible? WTF? if (navigator.userAgent.indexOf('Opera')) { return 'msie'; } else { return 'opera'; } } } function setEventListener(obj, event, callback) { switch (getBrowserEngine()) { case 'msie': obj.attachEvent('on'+event, callback); break; default: obj.addEventListener(event, callback, 0); break; } } var jsSpamGuardOnce = 0; function jsSpamGuard() { if (!jsSpamGuardOnce) { for (i = 0; i < document.forms.length; i++) { var currForm = document.forms[i]; // creating a new input called "auth", this element will hold an random authentication // string. var newInput = document.createElement('input'); newInput.name = 'auth'; newInput.style.display = 'none'; newInput.value = JAWS_SG; currForm.appendChild(newInput); } jsSpamGuardOnce = 1; } } // You can set here "keydown" or "mousedown" for more complexity setEventListener(document, "keydown", function() { jsSpamGuard() });