Skip to content

Instantly share code, notes, and snippets.

@fidlerryan
Created February 28, 2020 02:23
Show Gist options
  • Save fidlerryan/ae01e335d7b8dce07ea2c262f1c40b5b to your computer and use it in GitHub Desktop.
Save fidlerryan/ae01e335d7b8dce07ea2c262f1c40b5b to your computer and use it in GitHub Desktop.
Joomla's Email Protection Script in an AJAX Response
azXhr.onload = function(){
if( azXhr.status === 200 ){
var azDirectory = document.getElementById( 'modazdirectory' );
// replace with the DOM with the results of the AJAX call
azDirectory.innerHTML = azXhr.responseText;
// look for embedded scripts within the HTML
var azEmailCloak = azDirectory.querySelectorAll( 'script' );
for( var i = 0; i < azEmailCloak.length; i++ ){
// execute the scripts using the safer Function method as opposed to eval
var azParsed = new Function( azEmailCloak[i].innerHTML );
return azParsed();
}
// re-bind event handlers
} else {
// request failed
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment