Created
February 5, 2012 11:39
-
-
Save xerxesb/1744913 to your computer and use it in GitHub Desktop.
Netbank hackery
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
var BetterNetbank = { | |
inject: function(table) { | |
if ($("#" + table).length > 0) { | |
$('#' + table + ' thead tr').prepend('<th>X</th>'); | |
$('#' + table + 'Body > tr').map(function() { | |
$(this).prepend('<td><input type="checkbox" /></td>'); | |
}); | |
} | |
} | |
} | |
BetterNetbank.inject('transactionsTable'); | |
BetterNetbank.inject('outstandingAuthorizationsTable'); | |
var theShizzle = function() { | |
BetterNetbank.inject('transactionsTable'); | |
BetterNetbank.inject('outstandingAuthorizationsTable'); | |
} | |
var doTheShizzle = function(event) { | |
document.removeEventListener('DOMSubtreeModified', doTheSizzle,true); | |
if (event.target.id == "ctl00_BodyPlaceHolder_updatePanelResults" && event.target.innerHtml != "") | |
theShizzle(); | |
document.addEventListener('DOMSubtreeModified', doTheSizzle,true); | |
return true; | |
} | |
document.addEventListener('DOMSubtreeModified', doTheSizzle,true); | |
//$('#ctl00_BodyPlaceHolder_btnSearch_field').bind('click', theShizzle); | |
//$('#ctl00_BodyPlaceHolder_divDetails').bind('DOMAttrModified', theShizzle); | |
//$('#ctl00_BodyPlaceHolder_updatePanelResults').bind('DOMSubtreeModified', theShizzle); | |
$(document).bind('DOMSubtreeModified', theShizzle); | |
var c = $('#ctl00_BodyPlaceHolder_divDetails'); | |
c.__setAttribute = c.setAttribute; | |
c.setAttribute = function(){ | |
alert('new item added'); | |
c.__setAttribute.apply(c, arguments); |
updated JS (see above). same problem though - here line 17 "transactions" is undefined
Line 16 is superfluous but not harmful. Remove the event
function parameter and then try calling theShizzle();
in a console window. Same error?
If the page is just sitting idle, "theShizzle" in the console yields ReferenceError: theShizzle is not defined
If i break into the callback and access theShizzle, it finds the object perfectly well...
Just going to record here that the issue was the Chrome Extension sandbox.
stupid sandbox
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
They're related issues of scope. I wonder if it's related to the way jQuery is attaching the binding. Declare the function non-anonymously above the event binding and pass the function through as an argument? That way you can call the function yourself in a console without using the binding.