Rearrange source to src dir.
[redakcja.git] / src / redakcja / static / email_mangler / email_mangler.js
1 var rot13 = function(s){
2     return s.replace(/[a-zA-Z]/g, function(c){
3         return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
4     });
5 };
6
7 (function($) {
8     $(function() {
9
10         $(".mangled").each(function() {
11             $this = $(this);
12             var email = rot13($this.attr('data-addr1')) + '@' +
13                 rot13($this.attr('data-addr2'));
14             $this.attr('href', "mailto:" + email);
15             $this.html(email);
16         });
17
18
19     });
20 })(jQuery);
21