Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bundled email address encoding into Ruby and Javascript functions.

  • Loading branch information...
commit dea8eed50b3e28789bb40034d754603ce6a7f4cc 1 parent 010f192
@wadewest wadewest authored
View
8 app/helpers/application_helper.rb
@@ -57,4 +57,12 @@ def field(f, attribute, options = {})
type = options.delete(:type) || :text_field
content_tag(:div, (f.label(attribute, label_name) + f.send(type, attribute, options)), :class => "field")
end
+
+ def encrypt_email(email_address)
+ email_address.chars.map{|c|c.ord}
+ end
+
+ def encrypt_mailto_link(email_address)
+ "<script>decrypted_mailto_link([#{encrypt_email(email_address).join(',')}])</script>".html_safe
+ end
end
View
4 app/views/feedback_messages/new.html.erb
@@ -6,9 +6,7 @@
<%= form_for @feedback_message do |f| %>
<%= f.error_messages %>
<div class="info">
- <p>You can also contact <a href="http://twitter.com/railscasts">@railscasts</a> on Twitter, or send an email to <script type="text/javascript">document.write(
- "<n uers=\"znvygb:srrqonpx\100envyfpnfgf\056pbz\">srrqonpx\100envyfpnfgf\056pbz<\057n>".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}));
- </script>.</p>
+ <p>You can also contact <a href="http://twitter.com/railscasts">@railscasts</a> on Twitter, or send an email to <%= encrypt_mailto_linK("feedback@addoncasts.com")%>.</p>
</div>
<div class="special_email_field">
<%= label_tag :email %>
View
4 app/views/info/about.html.erb
@@ -16,9 +16,7 @@
<p><a href="http://media.railscasts.com/resources/textmate_theme.zip">Download Textmate Theme</a></p>
<h2>Contact</h2>
- <p>If you have any comments, suggestions, questions, etc. I'd love to hear them! Please use the <%= link_to "Feedback Page", feedback_path %> or send an email to <script type="text/javascript">document.write(
-"<n uers=\"znvygb:srrqonpx\100envyfpnfgf\056pbz\">srrqonpx\100envyfpnfgf\056pbz<\057n>".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}));
-</script>.</p>
+ <p>If you have any comments, suggestions, questions, etc. I'd love to hear them! Please use the <%= link_to "Feedback Page", feedback_path %> or send an email to <%= encrypt_mailto_link("feedback@railscasts.com") %>.</p>
<h2>Moderators</h2>
<p>Thank you to all moderators who help keep the site clean and up to date:</p>
View
13 public/javascripts/application.js
@@ -1,3 +1,16 @@
+function decrypted_email(riddle) {
+ var email_address = '';
+ for ( var i = 0; i < riddle.length; i++ ) {
+ email_address += String.fromCharCode(riddle[i])
+ }
+ return email_address
+}
+
+function decrypted_mailto_link(riddle) {
+ var email_address = decrypted_email(riddle)
+ document.write("<a href=\"mailto:"+email_address+"\">"+email_address+"</a>")
+}
+
$(function() {
if ($("#episode").length > 0) {
sublimevideo.ready(function() {
Please sign in to comment.
Something went wrong with that request. Please try again.