Permalink
Browse files

new file: MIT-LICENSE

	new file:   README.md
	new file:   obfuscator.html
  • Loading branch information...
1 parent 5b5b572 commit f149c8bf15fb0a363d29ac74ea09196ca13ea70d Florian Bersier committed Mar 20, 2012
Showing with 180 additions and 0 deletions.
  1. +20 −0 MIT-LICENSE
  2. +23 −0 README.md
  3. +137 −0 obfuscator.html
View
@@ -0,0 +1,20 @@
+Copyright (c) 2012 Florian Bersier
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall
+be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
+THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -0,0 +1,23 @@
+# Email Obfuscator
+
+Easy-to-use substitution cipher encrypting via ROT13 email addresses to avoid them getting harvested by spam-bots while keeping the mailto: feature. It rests on JavaScript and includes a pure CSS fallback.
+
+## ROT13 function (JavaScript)
+
+ String.prototype.rotate = function() {
+ return this.replace(/[a-z0-9]/ig, function(chr) {
+ var cc = chr.charCodeAt(0);
+ if (cc >= 65 && cc <= 90) cc = 65 + ((cc - 52) % 26);
+ else if (cc >= 97 && cc <= 122) cc = 97 + ((cc - 84) % 26);
+ else if (cc >= 48 && cc <= 57) cc = 48 + ((cc - 43) % 10);
+ return String.fromCharCode(cc);
+ });
+ };
+
+## Reverse strings (CSS fallback)
+
+ String.prototype.reverse = function() {
+
+ return this.split( '' ).reverse().join( '' );
+
+ };
View
@@ -0,0 +1,137 @@
+<!DOCTYPE html>
+<!--MIT LICENSED-->
+<html itemscope itemtype="http://schema.org/Product">
+<head>
+<title>Email Obfuscation via ROT13 Cypher</title>
+<!-- metadata-->
+<meta charset="utf-8">
+<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
+<meta http-equiv="Content-Language" content="en" />
+<meta http-equiv="keywords" content="ROT13,algorithm,converter,javascript,tool,online,free" />
+<meta name="author" content="Florian Bersier" />
+<meta name="Description" content="An easy-to-use substitution cipher that encrypts via ROT13 your email addresses to avoid them getting harvested by spam-bots while keeping the mailto: feature." />
+<!-- favicon -->
+<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
+<!-- css stylesheet-->
+<style>
+body{margin:0;padding:0;width:100%;font:1em Helvetica,Arial,sans-serif;color:#333;}
+a{text-decoration:none}a:hover{text-decoration:underline}
+ul p{margin:4px 0}
+.wrapper{width:980px;margin:0 auto;}
+h1{margin-top:6%}p.i{line-height:24px;margin-bottom:25px}
+ul{list-style:none;padding:0;margin:0 0 0 8%}ul li{display:inline-block;vertical-align:top}ul li:first-child{margin-right:60px}
+input[type="text"]{padding:3px 10px;border:1px solid #eee;width:230px}
+label{display:inline-block;width:110px}label.lg{width:180px;margin-left:40px}
+.tip{color:#999;font-size:0.75em;line-height:14px}
+.info{position:absolute;display:none;margin-left:300px;width:360px;height:25px;background:lightyellow;line-height:25px;text-align:center;font-size:13px;border-left:3px dashed #f1f1f1;border-right:3px dashed #f1f1f1}
+textarea{width:90%;border:25px solid #f1f1f1;padding:15px;line-height:20px;outline:none;border-radius:2px;-moz-border-radius:2px;-webkit-border-radius:2px}
+.footer{color:#999;font-size:0.85em;text-align:center}
+ul.share{position:absolute;top:9%;margin-left:650px;width:290px}ul.share li{display:inline-block;margin:0}
+</style>
+</head>
+<body>
+<div class="wrapper">
+<h1>Email Obfuscator</h1>
+
+<p class="i">This easy-to-use <a href="http://en.wikipedia.org/wiki/Substitution_cipher" target="_blank" title="What is it?">substitution cipher</a> encrypts via ROT13 your email addresses to avoid them getting harvested by spam-bots while keeping the <i>mailto:</i> feature. It rests on JavaScript and includes a pure CSS fallback. Feel free to bookmark it and share it!</p>
+
+<ul>
+<li>
+<p><label for="email">Email Address</label><input type="text" class="zz" id="email" value="" /></p>
+<span class="tip">Type the email address you want to obfuscate.</span>
+
+<li>
+<p><label for="anchor">Anchor text</label><input type="text" class="zz" id="anchor" value="" /></p>
+<span class="tip">The visible, clickable text attached to the mailto link, <i>eg</i> "Contact us".</span>
+</ul>
+<br />
+<ul>
+<li>
+<p><label for="subject">Email Subject</label><input type="text" id="subject" value="" /></p>
+<span class="tip">The subject attached to the mailto if any, <i>eg</i> "Information request".</span>
+<li>
+<p><label for="html5">HTML5 syntax</label><input checked="checked" id="html5" type="checkbox"></p>
+<li>
+<p><label class="lg" for="target">Open link in new window</label><input checked="checked" id="target" type="checkbox"></p>
+</ul>
+
+<br /><br /><div class="info">Once done, copy and paste the code below</div><textarea id="result"></textarea>
+
+<div class="footer">
+<p>Developed by <a href="http://www.florianbersier.com">Florian Bersier</a> &ndash; 2012 | MIT Licensed</p>
+</div><!--#footer-->
+
+<ul class="share">
+<li class="go"><div class="g-plusone" data-size="medium"></div>
+<li><fb:like href="" layout="button_count" show_faces="false" width="70" font=""></fb:like>
+<li><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="xpressyoo">Tweet</a>
+</ul><!--#share-->
+
+</div>
+
+<!--jQuery-->
+<script src="http://code.jquery.com/jquery.min.js"></script>
+<script>
+// Style
+$('input').focus(function() { $(".info").css('display','block'); });
+// FNs
+
+// Reverse strings (CSS fallback)
+String.prototype.reverse = function() { return this.split( '' ).reverse().join( '' ); };
+
+// ROT13 function
+String.prototype.rotate = function() { return this.replace(/[a-z0-9]/ig, function(chr) {
+ var cc = chr.charCodeAt(0);
+ if (cc >= 65 && cc <= 90) cc = 65 + ((cc - 52) % 26);
+ else if (cc >= 97 && cc <= 122) cc = 97 + ((cc - 84) % 26);
+ else if (cc >= 48 && cc <= 57) cc = 48 + ((cc - 43) % 10);
+ return String.fromCharCode(cc);
+ });
+ };
+
+// INIT
+$("#html5").change(function () {
+if ($(this).is(':checked')){var ht = '';}else{var ht = ' type="text/javascript"';}
+
+$("#target").change(function () {
+if ($(this).is(':checked')){var target = 'gnetrg=\\"_oynax\\"';}else{var target = '';}
+$("input").keyup(function () {
+
+var email = $("#email").val();
+var emailrev = email.reverse();//Noscript
+var anchor = $("#anchor").val();
+var subject = $("#subject").val();
+
+// ROT13
+var emailb = email.rotate();
+var anchorb = anchor.rotate();
+var subjectb = '?fhowrpg=' + subject.rotate();
+
+// OUTPUT
+if (subject === ''){var subjectb = '';$('#result').css('height','120px');}else{$('#result').css('height','140px');}
+var help = '<!--Place the code below where you want the link to be displayed-->';
+var noscript = '<noscript><span style="unicode-bidi:bidi-override;direction:rtl;">' + emailrev + '</span></noscript>';
+var code = help + '\n<script'+ ht +'>\n'+'document.write("<n uers=\\"znvygb:' + emailb + subjectb + '\\" '+ target +'>' + anchorb + '</n>".replace(/[a-zA-Z]/g,function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26);}));'+'\n<\/script>\n' + noscript;
+$("#result").val(code);
+}).keyup();
+}).change();
+}).change();
+
+$("#result").focus(function() {
+ $this = $(this);
+ $this.select();
+
+ // Work around Chrome's little problem
+ $this.mouseup(function() {
+ // Prevent further mouseup intervention
+ $this.unbind("mouseup");
+ return false;
+ });
+});
+
+</script>
+<script src="https://apis.google.com/js/plusone.js"></script>
+<script src="http://platform.twitter.com/widgets.js"></script>
+<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
+</body>
+</html>

0 comments on commit f149c8b

Please sign in to comment.