Open aspiers opened 1 year ago
I made a gist that fixes these problems:
chroma.js
was a dependency of this script, so I added it
https://gist.github.com/andrewmacheret/e7833752a842c4657a997e04c09a037eShould be pretty easy to just automatically replace instances of chrome.storage.local.get
with GM.getValue
and so on. And you don't need to include the text of chroma.js, as you can just add @require https://github.com/gka/chroma.js/blob/main/chroma-light.min.js
I made the @require
change, updated the gist. That's a lot better, thank you for the suggestion!
For the other suggestion, I get the error GM.getValue is not a function
when I tried using that function. However this is for remembering the user's style choice, but there's no UI in the greasemonkey script for changing the style, so I don't think it really matters.
You have to first get permission to use the function
@name ...
@require ...
@grant GM.getValue
GM.getValue("blahblah")
As for the UI, that's usually handled by the userscript manager. For example, violentmonkey has a Values tab for each script. But if you want, there's a settings UI library - GM_config.
I made the
@require
change, updated the gist. That's a lot better, thank you for the suggestion!
I think that @require
directive doesn't actually work. You need the raw URL, not the viewer URL. But actually it's even better to use a CDN URL:
@require https://cdn.jsdelivr.net/gh/gka/chroma.js/chroma-light.min.js
The Greasemonkey link is still in the README, but installing this way results in an error due to
chrome.storage
not being defined:I suspect that this may have been caused by 17ebadbcfb734be3a1af2f45863a2a58af570327, but I could easily be wrong.
It seems that devs have wanted userscripts to have access to chrome.storage for a very long time, but it never happened:
147233 - Give user scripts converted from extensions access to chrome.storage - chromium