[Greasemonkey] Suggestion: GM_injectCSS

Mark Pilgrim pilgrim at gmail.com
Thu Apr 14 13:52:31 EDT 2005


On 4/14/05, Mihai Parparita <mihai.parparita at gmail.com> wrote:
> On 4/14/05, Mark Pilgrim <pilgrim at gmail.com> wrote:
> > Argh!  That's a terrible example!  Please don't copy that!  It uses
> > global variables!  Plus it will break in Firefox 1.0.3 (no more
> > window._content)!
> >
> > Use this instead:
> >
> > function addGlobalStyle(css) {
> >   style = document.createElement("style");
> >   style.type = "text/css";
> >   style.innerHTML = css;
> >   document.getElementsByTagName('head')[0].appendChild(style);
> > },
> 
> This still uses global variables :p

Doh!  That's what I get for blindly copying and pasting code.  I'll
fix my scripts immediately.

-- 
Cheers,
-Mark


More information about the Greasemonkey mailing list