[Greasemonkey] CSS style element alteration

Ben livingood at gmail.com
Wed Jun 15 19:37:08 EDT 2005


Yeah looking over my code (below) it does look a little bit fragile
[they change the stylesheet and *pow*, the user is up a creek
instantly]. I'm guessing the someNode you speak of is something I'd
get out of an XPath query?

First version:

// ==UserScript==
// @name          WOWForumChanger
// @namespace     http://cns.montana.edu/~bgood/greasemonkey
// @description	  Replace some items in the WOW Forums.
// @include       http://forums.worldofwarcraft.com/thread.aspx*
// ==/UserScript==
// 
( function() {

document.styleSheets[0].cssRules[1].style.backgroundColor = "rgb(1,1,1)";

document.styleSheets[1].cssRules[14].style.fontSize="12pt";
document.styleSheets[1].cssRules[14].style.color="#10D0F0";

document.styleSheets[0].cssRules[0].style.width ="800px";
document.styleSheets[4].cssRules[1].style.fontSize = "8pt";
document.styleSheets[4].cssRules[0].style.fontSize = "14pt";
		   })();


Thanks to everyone for the help so far. I really appreciate it. And I
*still* highly recommend the bookmarklets mentioned earlier. One
caveat, don't have the "Edit Styles" Bookmarklet active and attempt to
use GM on the same page. Seems that said bookmarklet overrides
anything and everything that GM does. I'll go give the diveinto stuff
another shot and see if that makes it any more robust.

Ben

On 6/15/05, Lenny Domnitser <ldrhcp at gmail.com> wrote:
> On 6/15/05, Lenny Domnitser <ldrhcp at gmail.com> wrote:
> > On 6/15/05, Lenny Domnitser <ldrhcp at gmail.com> wrote:
> > > ... or use
> > or use
> 
> or *using.*
> 
> Today was my last day of classes, so please pardon my brain slips.
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
> 


-- 
Ben Livingood    || livingood at gmail.com
Do not tell fish stories where the people know you;
but particularly, don't tell them where they know the fish.
 --Mark Twain


More information about the Greasemonkey mailing list