Skip to content

Instantly share code, notes, and snippets.

@suhajdab
Created August 14, 2012 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suhajdab/3348158 to your computer and use it in GitHub Desktop.
Save suhajdab/3348158 to your computer and use it in GitHub Desktop.
Email obfuscation by css ( http://jsfiddle.net/suhajdab/dZsVB/ )
Here is an obfuscated email address: <a class="obsfuscated" href="#">moc.elpmaxe@zyx</a>.​​​
.obsfuscated {
unicode-bidi:bidi-override;
direction: rtl;
}
(function ( classname ) {
'use strict'
function onMouseover( e ) {
this.className = this.className.replace(classname,'');
this.removeEventListener('mouseover', onMouseover);
this.innerHTML = this.innerHTML.split('').reverse().join('');
this.setAttribute('href','mailto:' + this.innerHTML);
}
var els = document.querySelectorAll('.' + classname);
for ( var i = 0, el; el = els[ i ]; i++ ) {
el.addEventListener('mouseover', onMouseover, false);
}
})('obsfuscated');​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment