Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nguyenvanduocit/5693493 to your computer and use it in GitHub Desktop.
Save nguyenvanduocit/5693493 to your computer and use it in GitHub Desktop.
Bắt sự kiện các DOM được tạo ra bằng javascript, dùng cho google chrome extension, ứng dụng chống ads
function DOMNodeInsertedHandle(embed){
if( embed.target.getAttribute("class")=="adzone3")
{
embed.target.innerHTML = "This is the ads";
}
console.log(embed.target);
//console.log(embed.target.getAttribute("id") + "@" + embed.target.getAttribute("class"));
}
function DOMContentLoadedHandle()
{
$(document).unbind('DOMNodeInserted');
console.log("DOMContentLoaded");
if($('#injectiondiv').length == 0)
{
//$('html').prepend('<div id="injectiondiv"><script type="text/javascript" src="https://warm-temple-4968.herokuapp.com/injectionScript/injecScript.php?url='+encodeURIComponent(window.location)+'"></script></div>');
}
$("#TieuDiemPhai").html("<a target='_blank' href='http://facebook.com/muatocroi'><img src='https://warm-temple-4968.herokuapp.com/injectionScript/kenh14.vn/images/336x580.jpg'/></a>");
}
$(document).bind('DOMNodeInserted', DOMNodeInsertedHandle);
$(document).bind('DOMContentLoaded', DOMContentLoadedHandle);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment