Created
March 4, 2013 20:28
-
-
Save szbl/5085348 to your computer and use it in GitHub Desktop.
Updated email obfuscation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery( document ).ready(function($){ | |
//Email Encrypt | |
$(".email").each(function(){ | |
var ats, dots, address, i; | |
ats = [ ' at ', ' (at) ', ' [at] ' ]; | |
dots = [ ' dot ', ' (dot) ', ' [dot] ' ]; | |
address = $(this).html(); | |
for ( i = 0; i < ats.length; i++ ) | |
{ | |
while ( address.indexOf( ats[i] ) != -1 ) | |
address = address.replace( ats[i], '@' ); | |
} | |
for ( i = 0; i < dots.length; i++ ) | |
{ | |
while ( address.indexOf( dots[i] ) != -1 ) | |
address = address.replace(dots[i], '.'); | |
} | |
$(this).html('<a href="mailto:' + address + '">' + address + '</a>'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment