Created
June 2, 2013 12:27
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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