url entry in changeSignature (this isn't an easy user process, because I just hacked this script together for me) to point at a fortune file. Fortune files have each signature separated by a % on a blank line.
This is
url entry in changeSignature (this isn't an easy user process, because I just hacked this script together for me) to point at a fortune file. Fortune files have each signature separated by a % on a blank line.
Roberto: then I'd have to fill it in on all my machines. I see the theory, though; that wouldn't be too onerous :)
User script configurability is easy, especially when you use GM_setValue; cookies are less convenient.
function configure()
{
var u=GM_getValue('url');
u=prompt( 'Fortune URL?', u||'' );
GM_setValue('url',u);
return u;
}
GM_registerMenuCommand('Set fortune URL', configure);
function get_fortune_url()
{
return GM_getValue('url') || configure();
}
Yes, if I want it to be configurable, which I don't; I have one fortune URL, which is in my copy of the script. Having to configure it on all the machines I use is daft. Nonetheless, anyone who uses this script should definitely feel free to add Johan's customisation to it if you'd like fortune URL configurability.
Fucking hell, that's weird. When I had a play with greasemonkey after lugradio live last year the one and only thing I did with it was this same thing.
I'm not suggesting that it's a way of adding value to the script for yourself, only to your readership, who'd get a tool ready to just install and use right away without chasing down an editor and doing the roundabout manouver involved in installing user scripts from your local file system.
Replacing the '' bit above with your own preference would give you a default choice to just okay on first use with every new computer, though that would of course also not be an improvement on your script when used by yourself.
Just a compromise to improve sharability, reader worth, diggability or what have you -- a useful cheap technique for flirting with readers.
This website belongs to Stuart Langridge. Contact details are available. Don't eat yellow snow. Valid HTML5, at least in theory, except for the bits that aren't because I'm that futuristic that I'm ahead of the spec, oh yes. HTML5 help from Bruce Lawson, among others. Fonts from the superb FontSquirrel. End.
It would be nice if the script stored the URL in a cookie. The first time you ran it, it would look for the cookie and ask the user if none was found.