archives.gandrew.com
All old news here. Move along.

Greasemonkey Imports Service

Greasemonkey Imports Service is a php script which mimics the functionality of my Greasemonkey Imports patch.  It converts a multi-file greasemonkey script into a single-file script which will work on unpatched/older versions of Greasmonkey.

Usage

There are two versions of the script

V1 corresponds to the old version of the patch.  V2 is what you should be using.

The script has one parameter "url" which should be the URL of a greasemonkey script with import declarations. e.g.

greasemonkeyimports.php?url=http://.../ImportsTest.user.js

For the syntax of imports declarations see: Greasemonkey Imports

Operation

The script parses the user-script for import and require declarations and retrieves them from the web.

Required files are prepended to the userscript, imported files are also prepended to the userscript as url encoded string literals in an array called '_imports' (do not use this name in your userscript or the service won't work). e.g.

 

The script then inserts the following code which mimics the GM_getImport() api.