[Greasemonkey] How about script library and caching support?

wyns nnnnn wyns_sh at hotmail.com
Sat Jul 16 14:33:10 EDT 2005

Library support:
Add a function like GM_include(path)
the function works like GM_log function and can be called from any user.js
path is relative path to a library sub folder in greasemonkey which works 
like the script (so script can't load other local files with some security 
checking in path name)

when the GM_include function is called, it will execute the script in 
user.js context so library functions in those included files are visible to 
the user.js.

With this feature, you can move those common used functions in user.js into 
a set of library files and manage/use them easily. this can also make 
scripting in greasemonkey even easier with some library files provided by 
default package or other users. 

There are already extension like platypus which provide a set of library 
functions to greasemonkey plus a UI for auto script creating. but the 
library functions in those extension is fixed (without editing the 
extension jar) and sometimes still not enough,
So custom library files will be helpful i think

Script caching:
This mainly concerns for the performance when greasemonkey have lots of 
scripts installed especially lots global scripts (like * as include sites).

Every script loaded (user.js or library scripts) first time can have a copy 
in memory cache,  when next time the same file is requested, first the file 
modification time is checked, reload the file is there is a newer copy, 
otherwise, load the data from the memory cache directly.

There can be option to enable/disable cache so u can still disable it when 
you don't have much extra memeory.

Some other comments:
the UI of greasemonkey seems a bit lacking atm, some features like rename 
script name and install multiple scripts from local folder will be nice to 
see too.

Thanks for the great tool:)

Ãâ·ÑÏÂÔØ MSN Explorer:   http://explorer.msn.com/lccn/  

More information about the Greasemonkey mailing list