[Greasemonkey] Automatic Aadvark Scripts

Mark Pilgrim pilgrim at gmail.com
Wed Apr 27 23:57:55 EDT 2005


On 4/27/05, Scott R. Turner <srt at aero.org> wrote:
> For example, if I bring up Google's home page and Remove the Google
> logo, I get this script:
>     results = document.evaluate('/HTML[1]/BODY[1]/CENTER[1]/IMG[1]',
>         document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
>     o = results.snapshotItem(0);

This is more elegant:

o = document.evaluate('some xpath query', document, null,
XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

>     // Aadvark command: Remove
>     o.style.display = 'none';

Why not "o.parentNode.removeChild(o)" to remove the element entirely?

>    (3) You've got to cut & paste the script out of the popup window
>        into a .user.js file, etc., to load it as a user script.

If your popped up window had a URL that ended in ".user.js" (say, with
bogus query parameters), Greasemonkey might let you install it
directly.

This is extremely cool.

-- 
Cheers,
-Mark


More information about the Greasemonkey mailing list