Viewing last 25 versions of post by Ecstatis in topic Userscripts / Customization

Ecstatis

"[@Sollace":](/forums/meta/topics/userscripts-customization?post_id=4668872#post_4668872
[bq="Sollace"]
) " 

> [
@Ecstatis":](/forums/meta/topics/userscripts-customization?post_id=4668743#post_4668743
)
>
For ViolentMonkey you have to use:

[==

>
>
// @inject-into content
// @grant none==]


>
>
And create your stylesheet like this:

[==

>
>
const element = document.createElement\('STYLE'\);
element.setAttribute\('type', 'text/css'\);
element.innerHTML = \`
.comment\_box\_flex {
display: flex;
}\`;
document.body.insertAdjacentElement\('afterend', element\);==] [/bq]



 
Yeah I've seen that in your post above already, my only gripe with that though is that it would make dynamically adding and removing rules (as I already mentioned that I need) quite cumbersome. Well I guess I could just store the rules and update the style HTML on every change instead, although I'm not quite confident that this will work properly.
 
EDIT: Oh well nevermind, it works just fine now. Thank you :)
No reason given
Edited by Ecstatis
Ecstatis

"@Sollace":/forums/meta/topics/userscripts-customization?post_id=4668872#post_4668872
[bq="Sollace"] "@Ecstatis":/forums/meta/topics/userscripts-customization?post_id=4668743#post_4668743
For ViolentMonkey you have to use:

[==// @inject-into content
// @grant none==]

And create your stylesheet like this:

[==const element = document.createElement('STYLE');
element.setAttribute('type', 'text/css');
element.innerHTML = `
.comment_box_flex {
display: flex;
}`;
document.body.insertAdjacentElement('afterend', element);==] [/bq]

Yeah I've seen that in your post above already, my only gripe with that though is that it would make dynamically adding and removing rules (as I already mentioned that I need) quite cumbersome. Well I guess I' coulld have justo store the rules and update the style HTML on every change instead, although I'm not quite confident that this will work properly.
No reason given
Edited by Ecstatis