[Greasemonkey] All GM user script variables

Jeremy Dunck jdunck at gmail.com
Mon Apr 10 17:10:49 EDT 2006


On 4/10/06, Chris McKeever <techjedi at gmail.com> wrote:
> Is there any mechanism to determine all the variables for your particular
> script (as in the case that you are dynamically generating some user stored
> values u_1....u_n ??

No.  If you need that, you should probably keep a single value which
you can use as your entry point.

For your suggested scheme, you could do something like:

GM_setValue('numValues', 10);

and then later:

var num = GM_getValue('numValues', 0);
var vals = [];
for (var i=0;i<num;i++){
  vals.push(GM_getValue('u_' + i));
}

//other stuff with all vals...


More information about the Greasemonkey mailing list