Login Register





Tutorial How To Edit CSS within TamperMonkey (Edit Sites CSS) filter_list
Author
Message
How To Edit CSS within TamperMonkey (Edit Sites CSS) #1
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


PHP, CSS & HTML Web Developer!
Skype: FluxCoder

Reply

RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) #2
Not gonna lie, I have no use for this. But its nice to see people contributing code.

[+] 1 user Likes superMAUS's post
Reply

RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) #3
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
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

Reply

RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) #4
never heard of tampermonkey, will be sure to check it out

Reply

RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) #5
looks very useful will try it out definitely

Reply

RE: How To Edit CSS within TamperMonkey (Edit Sites CSS) #6
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.
(This post was last modified: 02-07-2021, 09:21 PM by berluskaiser.)

Reply







Users browsing this thread: 1 Guest(s)