Created
May 2, 2013 09:49
-
-
Save itsterry/5501248 to your computer and use it in GitHub Desktop.
This file contains 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
#turn an email address into a javascript-built email link, to frustrate email harvest bots | |
def protected_email_link(e=nil) | |
if e.present? | |
name,domain=e.split('@') | |
content_tag(:script,type:"text/javascript") do | |
raw("emailE=('#{name}'+'@'+'#{domain}');"+ | |
"document.write('<a href=\"mailto:' + emailE + '\">'+ emailE + '</a>');") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment