Sinisterly
Tutorial How To Edit CSS within TamperMonkey (Edit Sites CSS) - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Design (https://sinister.li/Forum-Design)
+--- Forum: Tutorials (https://sinister.li/Forum-Tutorials--78)
+--- Thread: Tutorial How To Edit CSS within TamperMonkey (Edit Sites CSS) (/Thread-Tutorial-How-To-Edit-CSS-within-TamperMonkey-Edit-Sites-CSS)



How To Edit CSS within TamperMonkey (Edit Sites CSS) - FluxCoder - 06-05-2016

Hi guys,
I released a tiny script that makes the text easier to read on here, I did this using TampMonkey and a little script that really does work!

Add this Function to your Script:
Code:
function addGlobalStyle(css) {    var head, style;    head = document.getElementsByTagName('head')[0];    if (!head) { return; }    style = document.createElement('style');    style.type = 'text/css';    style.innerHTML = css;    head.appendChild(style); }
This will make it easier to add CSS in the future, then when you'd like to add CSS, add this code:

Code:
addGlobalStyle('body { color: white; }');

This is the code I used to make the text easier to read, hope you guys learned something Smile

-- Peace


RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) - superMAUS - 06-05-2016

Not gonna lie, I have no use for this. But its nice to see people contributing code.


RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) - Inori - 06-05-2016

Using most modern browsers, you can just do this in the console directly.
Code:
document.body.style.color='#ffffff';

Even better, with Chrome you can unminify CSS, then add what you need:
[Image: 14fa49ae1bf34759b63527e2dd92a520.png]

TamperMonkey scripts are always cool, though


RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) - DrCustUmz - 06-03-2020

never heard of tampermonkey, will be sure to check it out


RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) - ttv18 - 06-18-2020

looks very useful will try it out definitely


RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) - berluskaiser - 02-07-2021

Thanks for the function provided, it's been useful to me.

(06-05-2016, 06:07 PM)Inori Wrote: Using most modern browsers, you can just do this in the console directly.
Code:
document.body.style.color='#ffffff';

Adding styles directly to the objects is not the same as adding global css rules as per the OP's function. Also, doing it manually defeat the tampermonkey's automation pourpose.


RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) - noname7519 - 10-20-2022

I haven't thinking it was possible ! TamperMonker is a really powerful tool, a very good share for the curious, I try this now, thanks.


RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) - 0e365s10w5 - 02-12-2023

thanks for sharing this my friend <3 2


RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) - eariel - 11-29-2023

very cool! ty! id love to try this someday saving for later!