JS2 Overview

Primary Motivation:
We need a script server to package language text into javascript. When a user invokes a interface component say the add media wizard we don't want to pull the entire interface code base and all the messages at once. Instead we just want to grab enough to display the current interface interaction. Once the user click on some tab say the 'archive.org search' we then want to import the code to run the archive.org search and the localized messages specific to that interface component. In other words we don't want to package all the message text in the html output of the initial page.

Secondary Benefits
If we are ruining all the javascript though a php script might as well group requests, minify; gzip; use the local file cache system; send headers to cache forever on the squids, and we make each javascript request unique based on svn version and avoid re-validate requests. All these combined do speed things up a good deal on the first time a user loads page.

Show me the Code!
the script loader code is not yet production quality. Its just a proof of concept. It should be transitioning into production quality shortly ;) ... you can see the code here:

In the JS
then at the top of mv_embed.js you would put something like: note the json variable that you pass to loadGM has to be valid JSON (not javascript) or php will complain.

Then in your message file you put the normal msg key pairs: "msg_key":"My localized text",

Right now we only support basic $1 replace ... obviously things get tricky with contextual wiki-text type replacements. (don't use that in js messages)

In your skin or extension
Then any time you include javascript via the addFile:

Note the use of a few config vars...here are the config vars: