I'm using FF 52.0.1 (64Bit) on MacOS 10.13.3
2. It doesn't seem to work cross-domains, which I thought was one of the purposes of GM_setValue, Was this dropped for GM.setValue?
I'm trying https://www.greasespot.net/2017/09/greasemonkey-4-for-script-authors.html
The issues I face are:
It only seems to works inside the async function. Is this intended?
// ==UserScript==
// @name …
// @grant GM.getValue
// @grant GM.setValue
// ==/UserScript==
// Maybe some initialization code here
(async function() {
let value = await GM.getValue('myvariable' /*, a default value */);
// do the stuff the script needs to do
})();
// usually nothing more here
It doesn't seem to work cross-domains, which I thought was one of the purposes of GM_setValue, Was this dropped for GM.setValue?
// ==UserScript==
// @name …
// @grant GM.getValue
// @grant GM.setValue
// @include https://site1
// @include https://site2
// @include https://site3
// ==/UserScript==
// Maybe some initialization code here
var SITE= document.location.host;
(async function() {
let value = await GM.getValue('myvariable' /*, a default value */);
switch(SITE) {
case "site1":
// call function for site1
break;
case "site2":
// call function for site2
break;
case "site1":
// call function for site1
break;
case "site3":
// call function for site3
break;
default:
// …
break
}
})();
function for_site1() {
}
function for_site2() {
}
function for_site3() {
}
// usually nothing more here