[Greasemonkey] Newbie Simple (Should Be) Question about Replacing CSS

Eris Siva erissiva at gmail.com
Sun Sep 4 03:20:20 EDT 2005


Ok, I've been working with GM for around 3 weeks now. I'm a complete
newbie to coding anything like this (I'm a graphics/XHTML/CSS kind of
guy).

Anyways, what I want to do is to be able to define a custom CSS file
for a website.
However, I would like to GM script to replace the CSS calls on the
page so that the browser doesn't spend time loading 2 CSS files.

This is what the site code looks like:

"<link rel="stylesheet" type="text/css" media="screen"
href="http://83.142.226.211/css/1/Main.css" />
<link rel="stylesheet" type="text/css" media="screen"
href="http://83.142.226.211/css/1/Widgets.css" />
<link rel="alternate stylesheet" type="text/css" media="screen"
title="Small screen" href="http://83.142.226.211/css/1/800x600.css"
/>"

I just want to replace 'Main.css' with a CSS file on a remote server
(for color-scheme reasons) so that I can change the remote CSS file
and the browsers will all update the same.
Is this possible?
It would also be fantastic if the browser could cache this CSS file so
that it doesn't have to reload every time - only the first time the
page is visited per browser-session.

I feel like an idiot asking.
I originally had all the CSS in the GM script replacing every instance
of the 'main.css' file, but it was slow, and it didn't make any sense
in the updating sense. It worked, however.

But, as soon as I try to make the other script (that uses a remote
file), I screw up royally. I cannot seem to get it to work. I just do
not think I understand the whole process.


Can someone please help me?
-- 
Eris Siva

Get Firefox: http://getfirefox.com


More information about the Greasemonkey mailing list