/[drupal]/contributions/modules/spamspan/spamspan.js
ViewVC logotype

Contents of /contributions/modules/spamspan/spamspan.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Wed Jan 17 21:33:58 2007 UTC (2 years, 10 months ago) by lakka
Branch: MAIN
CVS Tags: DRUPAL-5--1-0, HEAD
Branch point for: DRUPAL-5
Changes since 1.2: +12 -9 lines
File MIME type: text/javascript
Compress JS, bug fixes, load JS on each page
1 /*
2 --------------------------------------------------------------------------
3 (c) 2007 Lawrence Akka
4 - jquery version of the spamspan code (c) 2006 SpamSpan (www.spamspan.com)
5
6 This program is distributed under the terms of the GNU General Public
7 Licence version 2, available at http://www.gnu.org/licenses/gpl.txt
8 --------------------------------------------------------------------------
9 */
10
11 /*
12 IF YOU MAKE ANY CHANGES HERE COMPRESS THIS SOURCE CODE USING
13 http://alex.dojotoolkit.org/shrinksafe/ TO MAKE spamspan.compressed.js
14 */
15
16
17 // load SpamSpan
18 if (Drupal.jsEnabled) {
19 $(function () {
20 // get each span with class spamSpanMainClass
21 $("span." + Drupal.settings.spamspan.m).each(function (index) {
22 // for each such span, set mail to the relevant value, removing spaces
23 var _mail = ($("span." + Drupal.settings.spamspan.u, this).text() +
24 "@" +
25 $("span." + Drupal.settings.spamspan.d, this).text())
26 .replace(/\s+/g, '')
27 .replace(/[\[\(\{]?[dD][oO0][tT][\}\)\]]?/g, '.');
28 var _anchorText = $("span" + Drupal.settings.spamspan.t, this).text();
29 // create the <a> element, and replace the original span contents
30 $(this).after(
31 $("<a></a>")
32 .attr("href", "mailto:" + _mail)
33 .html(_anchorText ? _anchorText : _mail)
34 .addClass("spamspan")
35 ).remove();
36 } );
37 } )
38 }

  ViewVC Help
Powered by ViewVC 1.1.2