[Greasemonkey] Suggestion: GM_injectCSS

Mihai Parparita mihai.parparita at gmail.com
Thu Apr 14 11:18:35 EDT 2005

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

> To the original point, no, I don't think this should be a GM function.
>  I think it should be documented in a developer's FAQ, along with all
> the other patterns I listed the other day.

I agree, no need to add too much cruft to GM. Things like
GM_xmlhttpRequest, since there's no way for a script author to get the
equivalent functionality.


More information about the Greasemonkey mailing list