Since you're already using GM_config, you can also implement GM_SuperValue like this:
It has the advantage of working in user script environments that don't have GM_setValue/GM_getValue. GM_config uses localStorage as a fallback and will run in pretty much any modern browser (in fact, here is a web page that it runs on without any modification). The only downside of using the above code is that you can't store functions, but that only works in Firefox (last time I checked) and I don't know why the hell you'd want to do that anyway.
PHP Code
<?php
var GM_SuperValue = new function () {
this.set = function(name, val) {
GM_config.setValue(name, GM_config.stringify({'val': val}));
};
this.get = function(name, def) {
var rval = GM_config.getValue(name, def);
return rval === def ? rval : GM_config.parser(rval).val;
};
};
It has the advantage of working in user script environments that don't have GM_setValue/GM_getValue. GM_config uses localStorage as a fallback and will run in pretty much any modern browser (in fact, here is a web page that it runs on without any modification). The only downside of using the above code is that you can't store functions, but that only works in Firefox (last time I checked) and I don't know why the hell you'd want to do that anyway.



