[Greasemonkey] A function to ask for passwords
Nic Ferrier
nferrier at tapsellferrier.co.uk
Tue Jul 5 21:24:30 EDT 2005
Edward Lee <edilee at gmail.com> writes:
> Just some quick comments.. You don't need to set the id's of the div
> or buttons because you can just store them as variables. That'll
> prevent the script from adding extra id's to the document. There'll
> have to be a wrapper of some sort around the function to provide
> storage for the div variable if you don't want to pollute the global
> variable space (cont_function goes to the window right now..) But if
> you have the buttons as variables instead of innerHTML stuff, you can
> do buttonOK.addEventListener('onclick', function() { ...
>
> And continuations do seem to be working.. at least in this example I tested.
>
> function fact(n, k) {
> if (n < 2) {
> return k(1);
> } else {
> return fact(n - 1, function(r) {
> return k(n * r);
> });
> }
> }
>
> fact(1, function(x) { return x;});
> 1
> fact(3, function(x) { return x;});
> 6
> fact(5, function(x) { return x;});
> 120
>
> Fun with javascript :)
Yes. I haven't had time to test this assertion fully. I wrote a simple
version of this function but found that when I came to put it into the
GM that hacked the bank login page it failed in all sorts of
interesting ways.
The script I posted is the result of hours of tinkering to get it
working in just that environment.
But you're right - I now need to experiment with the problems and
simplify it. I'd also like to make the box themeable.
Still - just this code *might* be useful to someone.
Nic
More information about the Greasemonkey
mailing list