Thursday, 15 April 2010

javascript - Greasemonkey (using the waitForKeyElements utility) - how to call a function after a specific element has been displayed on screen -



javascript - Greasemonkey (using the waitForKeyElements utility) - how to call a function after a specific element has been displayed on screen -

(in continuance this question of mine). i've been writing this userscript site metal-archives.com. when opening band page (example) land discography>complete discography. script applies discography tab , it's sub-tabs (complete discography, main, lives, demos, misc) : splits column "reviews" in 2 , makes table sortable.

i want (using waitforkeyelements utility in script in greasemonkey) function (which adds column table, based on it's contents, appendcolumn(x) ) called after table within discography > finish discography has been displayed (i think as: after lastly header of table has been displayed). id value of lastly header of table (misc.) stored in array position: myarray[end]

so, failed tries far (based on this answer user brock adams kindly suggested in initial question) variants of:

function appendcolumn(x){....} function triggercall(jnode) { appendcolumn(0); or --> jnode.appendcolumn(0); } waitforkeyelements (myarray[end], triggercall); // no parentheses after triggercall

assuming appendcolumn function works, is, on reloads; rewrite , phone call waitforkeyelements().

you don't need of rigamorole, utilize class names display , discog selector. so:

waitforkeyelements (".display.discog", appendcolumn); function appendcolumn(jnode) { var tbl = jnode[0]; // table reference var i; var newcell, newtext; var tr = tbl.thead.children[0], th = document.createelement('th'); // rest of function same... //...

javascript jquery greasemonkey

No comments:

Post a Comment