[Greasemonkey] Greasemonkey Imports

Aaron Boodman zboogs at gmail.com
Thu Sep 8 14:01:45 EDT 2005


I also really like how it sorta combines design-time importing and
run-time importing. Great work! Much better than what I was going to
do.

But I still think that the best things should be added to GM itself.
Both from a performance perspective, and just to make it easier to
write scripts.

-- 
Aaron

On 9/8/05, Aaron Boodman <zboogs at gmail.com> wrote:
> wooooo nice :-) love the multipurposeness of it. very slick. Thanks
> for the feature!
> 
> On 9/8/05, Gareth Andrew <freega at freegarethandrew.org> wrote:
> > Hi.
> >
> > I have added the ability to attach files to a greasemonkey script, so
> > that when it is installed the files get downloaded and saved with the
> > script.
> > I have added a new metadata annotation @import. This annotation has two
> > parameters, a symbolic name for the import, and a url from which the
> > import can be downloaded eg.
> >
> > // ==UserScript==
> > // @name          MyUserScript
> > // ...
> > // @import  importName  http://example.com/path/to/import
> >
> > The user script can access the import by calling GM_getImport(<import
> > name>). This function returns a GM_Import object with three accessor
> > functions.
> >
> >       * getFileURL() - this method returns a file:/// url (as a string)
> >         pointing at the imported resource.
> >       * getContents() - this method returns the file contents (as a
> >         string).
> >       * getDataURL() - this method returns the file contents encoded as
> >         a data URL (as a string). Not yet implemented.
> >
> > Imports can be any filetype (although there are obvious security
> > considerations here), so they can be used for embedding
> > images/multimedia, externalising css and html, or as a means to import
> > javascript libraries.
> > Javascript libraries can be injected withe by using eval() which makes
> > the code immediately available as if it were written inline, or by
> > inserting the script into the document via the DOM, which is useful for
> > scripts that are not aware of greasemonkey.
> >
> > Most of the API's listed on
> > http://dunck.us/collab/GreaseMonkeyUserScripts#preview do not require
> > chrome privileges, and could easily be implemented as libraries.  This
> > combats the potential feature bloat problem that happens when
> > everybody's favourite function is added to greasemonkey.  It also means
> > that it is much easier to take advantge of JS libraries not written for
> > greasemonkey such as. MochaKit, TrimPath, Prototype etc.
> >
> > Please post your feedback, and if you're very brave try out the code
> > (based on 0.6.x - so I don't know if it works on 1.0.x).  More
> > information available at
> > http://www.freegarethandrew.org/mediawiki/index.php?title=GreasemonkeyImports
> >
> > Gareth.
> >
> >
> > _______________________________________________
> > Greasemonkey mailing list
> > Greasemonkey at mozdev.org
> > http://mozdev.org/mailman/listinfo/greasemonkey
> >
> >
> >
> >
>


More information about the Greasemonkey mailing list