public
Fork of rmm5t/smhelper-obfuscated-email
Description: A staticmatic helper to obfuscate mailto links using javascript.
Clone URL: git://github.com/swalker/smhelper-obfuscated-email.git
+ link_to instead of link
+ alternate content tag method
swalker (author)
Thu Aug 14 15:21:51 -0700 2008
commit  7954650bc49777a797d1d6afafe932f42a2eb116
tree    daad28d511c294c17558ce9b31ecd8e981e4b3da
parent  747b4a2fbfa1379aab7dcbff9705176f310fe574
...
20
21
22
23
 
24
25
26
 
27
28
29
30
 
31
32
33
...
20
21
22
 
23
24
25
 
26
27
 
 
 
28
29
30
31
0
@@ -20,14 +20,12 @@ module ObfuscatedEmailHelper
0
     obfuscated_link(title || email, "mailto:#{email}", options)
0
   end
0
   alias obfuscated_mail_to obfuscated_mail
0
-
0
+
0
   def obfuscated_link(title, href = "", options = {})
0
     chars, random = [], rand(255)
0
- plain = link(title, href, options)
0
+ plain = link_to(title, href, options)
0
     plain.each_byte { |c| chars << "#{c + random}-#{random}" }
0
- tag(:script, :type => "text/javascript") do
0
- "document.write(String.fromCharCode(#{chars.join(',')}));"
0
- end
0
+ content_tag(:script, "document.write(String.fromCharCode(#{chars.join(',')}));", :type => "text/javascript")
0
   end
0
   alias obfuscated_link_to obfuscated_link
0
 end

Comments

    No one has commented yet.