I strongly suspect a better option would be to inject a <script> element into the Facebook page, containing an alternate implementation of MegaphoneHelper. (Presumably this alternate implementation would do nothing, or perhaps at most log messages to the console.)
Something like this (untested, but resembling code I've written before): var nodScript = document.createElement("script"); nodScript.innerHTML = "MegaphoneHelper = {};"; document.body.appendChild(nodScript); document.body.removeChild(nodScript); Try it and let us know how it works. On 2009-12-13 17:03, Schlake wrote: > There's this annoying website I use (facebook). It has a series of > onloadRegisters calls. I want to get rid of one of them. I tried > this, and the alert() statements tell me it worked, but firebug shows > the end page unmodified and the code still runs. I've decided to give > up and just ask someone. > > var doc = document.getElementsByTagName('script'); > for (var i = 0; i< doc.length; i++){ > if (doc[i].innerHTML.indexOf( 'MegaphoneHelper' )> 0) { > window.alert( "Found it!" ); > // window.alert( doc[i].innerHTML ); > doc[i].innerHTML = doc[i].innerHTML.replace( "MegaphoneHelper", > "bogus" ); > // window.alert( doc[i].innerHTML ); > if (doc[i].innerHTML.indexOf( 'MegaphoneHelper' )> 0) { > window.alert( 'It is still there!' ); > } else { window.alert( 'It is gone now!' ); } > } > } > > My goal here is prevent facebook from subjecting me to modal dialogs > now or ever again. > -- cc | pseudonymous |<http://carlclark.mp/> -- You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To post to this group, send email to greasemonkey-us...@googlegroups.com. To unsubscribe from this group, send email to greasemonkey-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.