First of all, changes to the page after it has been loaded don't
automatically go thru the greasemonkey script, unless you've installed
relevant event handlers. It seems that the 24 hour tab button just
changes the layout of the page and maybe fetches data, but does not
reload and thus does not trigger another invocation of the
greasemonkey script.
In addition, document.evaluate may fail when the page has a default
name space and you've failed to provide a resolver. For example, if
you're looking for divs and the page's default namespace is
xmlns="http://www.w3.org/1999/xhtml";

then your document.evaluate should be written this way:

document.evaluate("//a:div", document, resolver, ...

where resolver is a function() { return "http://www.w3.org/1999/
xhtml"; }


On Aug 5, 11:42 am, SA <[email protected]> wrote:
> I have a simple script to search and replace stuff on the web - as a
> trivial example here:
>
> // ==UserScript==
> // @name           nobble
> // @namespace      http://news.bbc.co.uk/weather/forecast/346
> // @include        *
> // ==/UserScript==
> textNodes = document.evaluate( "//text()", document, null,
> XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
> var searchRE = new RegExp('mb','g');// I know doesn't need regexp for
> this
> var replace = 'MB';
> for (var i=0;i<textNodes.snapshotLength;i++){
>         var node = textNodes.snapshotItem(i);
>         node.data = node.data.replace(searchRE, replace);
>         }
>
> On the bbc weather forecast this works fine 
> initially:http://news.bbc.co.uk/weather/forecast/4168
> but if the 24hour forecast button is pressed the resulting webpage is
> unaffected.
>
> Any ideas?

-- 
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