I followed the advice here by LouCypher:

http://groups.google.com/group/greasemonkey-users/browse_thread/thread/f897578a5013b065?pli=1

Which worked perfectly but now the bbc has changed it's website and
the script stopped working.  I logged and error saying that "div" was
invalid that I attributed to this line:

 var div = document.getElementById("Forecast_main");

The problem being that there was no longer an element called
"Forecast_main".  I dissected the webpage and found that it had been
changed to "forecast-data-table" so updated the script accordingly but
it still does not work (the script runs without error but the changes
are not made). I'm completely stuck could anyone offer a suggestion as
to why it isn't working?

// ==UserScript==
// @name           nobble
// @namespace      http://news.bbc.co.uk/weather
// @include        http://*.bbc.co.uk/weather/*
// ==/UserScript==

var div = document.getElementById("forecast-data-table");
div.addEventListener("DOMNodeInserted", function() {
  var 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);
  }

}, false);


Could anyone tell me how to write messages to a console for debugging?

Ta SA

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