This took a while to figure out and then I forgot it all again. I have some Greasemonkey scripts that fiddle around with menus and automatically log me in to a difficult-to-navigate HellishSite. They use jquery and I thought I'd record what to do and pass on the tip.
When I used jquery the old way in my scripts, it broke HellishSite's layout probably because they use jquery in some way themselves. Something about the insane way they use frames might also be the culprit. I didn't look too deep into that. Here's what works. Use a @require line as described in the Metadata block docs for Greasemonkey:
// @name Hello jQuery
// @namespace http://wiki.greasepot.net/examples
// @description jQuery test script
// @include *
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
In the script itself I am doing just a few things.
Testing what page I'm looking at, just by seeing if a particular field name is on that page:
(do some stuff)
Filling out fields:
(the non-jquery way to do this is something like,
document.getElementsByName('password').value = "blowme";Ugh, shudder...)
Selecting from dropdown menus:
Pre-selecting a bajillion clicky things from horrible little fields full of options:
Making horrible little fields bigger, that show 4 options at a time out of possible 25:
All this will become unnecessary once I dive into the HellishSite API but right now I don't have time to go that route.