GM API says that GM_setValue can't save objects.
This is how to solve:
You need to extend functionality of the GM_setValue and GM_getValue
like this:
// extend GM_setValue to be able to save Object
(function() {
var oldFunc = GM_setValue;
GM_setValue = function(name, value) {
var wrapper = {
value: value,
};
oldFunc(name, uneval(wrapper));
};
})();
// extend GM_getValue to be able to load Object
(function() {
var oldFunc = GM_getValue;
GM_getValue = function(name, def) {
var wrapped = eval(oldFunc(name));
if (wrapped == undefined) {
return def;
}
return wrapped.value;
};
})();
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/greasemonkey-users?hl=en.