Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ config/*.sphinx.conf
config/initializers/development_mail.rb
db/sphinx
public/assets
.DS_Store
._*
8 changes: 8 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 1 addition & 3 deletions app/views/feedback_messages/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down
4 changes: 1 addition & 3 deletions app/views/info/about.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
13 changes: 13 additions & 0 deletions public/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
7 changes: 7 additions & 0 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require File.dirname(__FILE__) + '/../spec_helper'

describe ApplicationHelper do
it "encrypts an email address" do
helper.encrypt_email('foo@bar.com').should eq([102, 111, 111, 64, 98, 97, 114, 46, 99, 111, 109])
end
end