Skip to content

Instantly share code, notes, and snippets.

@peteee
Last active May 28, 2018 20:18
Show Gist options
  • Save peteee/1790dba33480c9a4b87b9292d05a7ee8 to your computer and use it in GitHub Desktop.
Save peteee/1790dba33480c9a4b87b9292d05a7ee8 to your computer and use it in GitHub Desktop.
Replace a mailto:email addr. -link with this handy lil snippet
/**
* ROT13 Email Decrypter
* -TextMate-style-
*
* Creates a mailto: -Email link
* Hides Email addresses from spam bots
* Format: [email protected]: [email protected]
*
* @author Peter Oberlaender
*/
var emailName = "grfg",
emailDomain = "grfg",
emailTld = "pbz";
var myRot13Hash = "<n uers=\"znvygb:"+emailName+"\100"+emailDomain+"\056"+emailTld+"\">"+emailName+"\100"+emailDomain+"\056"+emailTld+"<\057n>";
document.write(myRot13Hash.replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment