| 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 |
}
|