X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/8d426d983babe3d2683ed62b6675073d21bd5d94..b0af42626632f8750ac9e88338be7e196bd4f91d:/redakcja/static/email_mangler/email_mangler.js?ds=inline diff --git a/redakcja/static/email_mangler/email_mangler.js b/redakcja/static/email_mangler/email_mangler.js new file mode 100755 index 00000000..03c1a915 --- /dev/null +++ b/redakcja/static/email_mangler/email_mangler.js @@ -0,0 +1,21 @@ +var rot13 = function(s){ + return s.replace(/[a-zA-Z]/g, function(c){ + return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26); + }); +}; + +(function($) { + $(function() { + + $(".mangled").each(function() { + $this = $(this); + var email = rot13($this.attr('data-addr1')) + '@' + + rot13($this.attr('data-addr2')); + $this.attr('href', "mailto:" + email); + $this.html(email); + }); + + + }); +})(jQuery); +