By ScriptKeeper Last update Jul 25, 2011 — Installed 166,704 times.

Script Summary: Extends the GM_setValue and GM_getValue functions for any javascript variable type.

This library extends the Greasemonkey GM_setValue() and GM_getValue() functions to handle any javascript variable type.

A library is necessary because GM_setValue only stores: strings, booleans, and 32-bit integers. (A limitation of using Firefox preferences for storage).

Important! This is a library, not a standard Greasemonkey script.
It is meant to be included via the @require directive.

Add it to your script with this line in the metadata block:

// @require

In your user script, use the functions like so:

GM_SuperValue.set (varName, varValue);
var x = GM_SuperValue.get (varName, defaultValue);

That is, just like you would use GM_setValue and GM_getValue, but without the worries of the script breaking on invalid values.