Greasemonkey: Add a GM.addStyle API, for styling CSP-restrictive pages

Created on 22 Nov 2017  ·  14Comments  ·  Source: greasemonkey/greasemonkey

the current lack of scripting style is actually a complete disaster :-(

Most helpful comment

Thanks !

However that makes the current lack even more incomprehensible...

All 14 comments

addStyle is just 12 trivial lines of code, which you can easily copypaste into your script. Or even 11, because this line is not needed:
style.setAttribute('type', 'text/css');

Thanks !

However that makes the current lack even more incomprehensible...

@arantius I've got an issue with trying to load user styles on pages which have CSP and don't allow "self" as an origin -- so I can't just add a <style> element. GM could solve this by exposing an API that calls tabs.insertCSS() (ref). Thoughts?

I've got an issue with trying to load user styles on pages which have CSP and don't allow "self" as an origin -- so I can't just add a