Greasemonkey

From Helpful

These are primarily notes
This is probably not going to be complete in any real sense, but may be useful information nonetheless.


Using jQuery

Makes writing certain scripts easier, though it adds some load time to the already noticeable delay. You probably want to use one of the common sources of the script so that it is likelier to be cached. For example, a non-packed version for development (for example http://code.jquery.com/jquery-latest.js), or a minified version hosted by google (e.g. http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js, see [1]).

A basic template could be something like:

// add script tag to document
var jqelem = document.createElement('script');
jqelem.src = 'http://jquery.com/src/jquery-latest.js';
document.getElementsByTagName('head')[0].appendChild(jqelem);
 
function _wait_for_jquery_load() {
  //wait until jquery is interpreted and usable
  if(!unsafeWindow.jQuery) //execute this every 75ms until we see it.
    window.setTimeout(_wait_for_jquery_load,75);
  else {
    $=unsafeWindow.jQuery;
 
    //your code goes here, say, 
    $("img[@src*='something']").parent().empty();
  }
};
_wait_for_jquery_load();