Some helper functions for userscripts, including:
applyCss()
- Applies a string of CSS to the document- More to come...
Applies a string of CSS to the document
This function is intended to be a more robust alternative to GM_addStyle.
To use it in your userscript, add this line to the metadata block:
// @require https://rawgit.com/HatScripts/UserscriptHelpers/master/applyCss.min.js
And then call it like so:
applyCss('body { color: white; background-color: black; } img { border: 0; }');
Or with a multi-line string (ES6+):
applyCss(`
body {
color: white;
background-color: black;
}
img {
border: 0;
}
`);