diff --git a/helpers/middleman_casper_helpers.rb b/helpers/middleman_casper_helpers.rb index 36ef13f..92789bd 100644 --- a/helpers/middleman_casper_helpers.rb +++ b/helpers/middleman_casper_helpers.rb @@ -128,53 +128,12 @@ module MiddlemanCasperHelpers def author_path "#{blog.options.prefix.to_s}/author/#{blog_author.name.parameterize}/" end - def author_email_link(span_class = nil) + def author_email + # The email address is stored encoded in the blog sources raw_email = blog_author.email.to_s.scan(/\d+;/).map{|c| c[2..-2].to_i}.pack('U*') + obfuscated_email = raw_email.tr('!-~', 'P-~!-O').unpack('U*').map{ |code| "#{code.to_s};"}.join - # We emit the email address as HTML encoded ROT47 string - email = raw_email.tr('!-~', 'P-~!-O').unpack('U*').map{ |code| "#{code.to_s};"}.join - - if span_class - writer = <<-JAVASCRIPT.tap { |s| s.gsub!(/^#{s.scan(/^[ \t]+(?=\S)/).min}/, '') }.html_safe - document.addEventListener("DOMContentLoaded", function() { - Array.prototype.forEach.call(document.getElementsByClassName("#{span_class}"), function(element){ element.innerHTML = link; }); - }, false); - JAVASCRIPT - else - writer = 'document.write(link);' - end - - script = <<-HTML.tap { |s| s.gsub!(/^#{s.scan(/^[ \t]+(?=\S)/).min}/, '') } - - HTML - script << '' unless span_class - script.html_safe - end - - def author_email_span(span_class) - %{(Please enable JavaScript to show the email address)}.html_safe + %{(Please enable JavaScript to show the email address)}.html_safe end def og_type diff --git a/source/author.html.haml b/source/author.html.haml index 0650c4c..e32e158 100644 --- a/source/author.html.haml +++ b/source/author.html.haml @@ -5,7 +5,6 @@ cover: cover.jpg cover_license: '[Cover Image](https://unsplash.com/photos/2ShvY8Lf6l0) by [Lukasz Szmigiel](https://unsplash.com/szmigieldesign), [CC Zero 1.0](https://unsplash.com/license)' --- -= author_email_link('author-email') %header.main-header.author-head{cover} %nav.main-nav.overlay.clearfix %a.home-button.icon-angle-left{href: home_path} @@ -37,8 +36,8 @@ cover_license: '[Cover Image](https://unsplash.com/photos/2ShvY8Lf6l0) by [Lukas integral part of the community by not only providing source code but also advice, help, and organisational support to advance the status quo. - If you want to contact me, preferrably send an email to - #{author_email_span('author-email')} in either German or English. I am + If you want to contact me, preferrably send an email to #{author_email} + in either German or English. I am [#{blog_author.profile_links[:github][:user]}](#{blog_author.profile_links[:github][:link]}) on GitHub and [@#{blog_author.profile_links[:twitter][:user]}](#{blog_author.profile_links[:twitter][:link]}) on Twitter. I try to help people on [Stack Overflow](#{blog_author.profile_links[:stackoverflow][:link]}). diff --git a/source/impressum.md.erb b/source/impressum.md.erb index 615d65f..1f41319 100644 --- a/source/impressum.md.erb +++ b/source/impressum.md.erb @@ -13,7 +13,7 @@ GERMANY
E-Mail: - <%= author_email_link %> + <%= author_email %>
Diese Daten dürfen nicht zu Werbezwecken genutzt werden.