//+----------------------------------------------------------+ //| name : Obfuscate mails | //| author : runzheimer | //| description: ROT13 mail obfuscation | //| important : This algorithm uses a special addition. | //| The '@' is replaced with an ’#’ to maximize | //| the obfuscation effect. Ask Maik for info. | //+----------------------------------------------------------+ jQuery.fn.obfuscateMail = function(){ $.rotate = function(s) { return $.rotate13($.rotate5(s)); }; $.rotate5 = function(s) { var b = [],c,i = s.length,a = '0'.charCodeAt(),z = a + 10; while (i--) { c = s.charCodeAt(i); if (c >= a && c < z) { b[i] = String.fromCharCode(((c - a + 5) % (10)) + a); } else { b[i] = s.charAt(i); } } return b.join(''); }; $.rotate13 = function(s) { var b = [],c,i = s.length,a = 'a'.charCodeAt(),z = a + 26,A = 'A'.charCodeAt(),Z = A + 26; while (i--) { c = s.charCodeAt(i); if (c >= a && c < z) { b[i] = String.fromCharCode(((c - a + 13) % (26)) + a); } else if (c >= A && c < Z) { b[i] = String.fromCharCode(((c - A + 13) % (26)) + A); } else { b[i] = s.charAt(i); } } return b.join(''); }; var o = $(this[0]); o.attr("href", function (arr) { if ($(this).attr("href").indexOf("#") >= 0){ $(this).click(function(event) { event.preventDefault(); //window.location.href = 'mailto:'+($.rotate13(($(this).attr('href'))).split('#').join('@')); window.open('mailto:'+($.rotate13(($(this).attr('href'))).split('#').join('@')), "_blank"); }); } }).show(); };