This didn't get me anywhere.  But one problem I still have is that the
end page is arriving in my browser unmodified.  I haven't been able to
find any way to modify or inject anything into the web page.  I know
from the window.alert() calls that my code is running, and there are
no errors being logged in the error console, but when I examine the
source of the the page I can't find any evidence that I successfully
edited it.  This is my first foray into JS/GM and I'm obviously not
getting it, whatever it is.  I'll try to find time tomorrow night to
work on this again and see what I can turn up.

On Sun, Dec 13, 2009 at 8:30 PM, cc <[email protected]> wrote:
> 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 [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/greasemonkey-users?hl=en.
>
>
>



-- 
-- Schlake

--

You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.


Reply via email to