[Greasemonkey] CSS style element alteration

Ben livingood at gmail.com
Wed Jun 15 00:40:20 EDT 2005


Wow, very cool. I especially like the edit styles bookmarklet. Very
enlighting and useful to see what changes would be made to the css on
the fly.

However the following code doesn't seem to render correctly:

// ==UserScript==
// @name          WOWForumChanger
// @namespace     http://cns.montana.edu/~bgood/greasemonkey
// @description	  Replace some items in the WOW Forums.
// @include       http://forums.worldofwarcraft.com*
// ==/UserScript==
// Working the magic:
( function() {
document.styleSheets[0].cssRules[0].style.BODY = "BACKGROUND-COLOR: #000000;";
document.styleSheets[1].cssRules[5].style[2] = "90pt;";
		   })();

Both the background image and the header text remain. Does anyone see
if is this a rendering issue of GM or a programming issue on my end?

The shell bookrmarklet applied it without complaint. . .  So I thought
this was the right syntax.

Ben

On 6/14/05, Bill Donnelly <donnelly at snowcrest.net> wrote:
> use:
> 
>   document.styleSheets.length
>   document.styleSheets[xxx]
> 
>   document.styleSheets[xxx].cssRules.length
>   document.styleSheets[xxx].cssRules[yyy].cssText
> 
> These are great tools:
> 
> http://www.squarefree.com/bookmarklets/webdevel.html
> 
> Use the Shell bookmarklet and the props() function
> to discover available properties/fields (and methods)
> and their values for offending web pages.
> 
> --
> Jack the Ripper may have been quite insane,
> but he had beautiful penmanship.
> btw -- Don't look back!
> The lemmings are gaining on you.
> _______________________________________________
> 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