How to use Exhibit offline
From SIMILE Widgets
Contents |
Preliminaries
Exhibit's code is stored in our Subversion code repository, just like all of our other projects. You need a Subversion client and here is a list of Subversion clients we know of.
Downloading Exhibit
After having installed one of the Subversion client, go to the command prompt and change to the directory where you want to download Exhibit's code and type
svn checkout http://simile-widgets.googlecode.com/svn/exhibit/trunk simile-widgets-read-only
If you're checking out Exhibit's code from within Eclipse, then you probably know what to do with that URL above.
Fixing Dependencies
Exhibit relies on the SimileAjax library, which is included in the SVN checkout. However, by default, Exhibit still tries to load the SimileAjax library at http://static.simile.mit.edu/ajax/api-2.0/simile-ajax-api.js. So, you need to change this dependency.
If you intend to use Exhibit locally on your own machine only, then go to the file exhibit/src/webapp/api/exhibit-api.js, find
var useLocalResources = false;
and change it to
var useLocalResources = true;
If you also intend to serve Exhibit so that other people on other machines can use it, then still do that change, and then in the same file, find all instances of
http://127.0.0.1:8888
and change it to match your machine's address.
But be careful not to commit these changes back into SVN
Running Exhibit using Jetty
In the directory where you checked out exhibit, type (on Windows)
run
or on Mac,
./run
This will launch a small web server (Jetty). You can then browse to http://127.0.0.1:8888/exhibit/. And the API is at http://127.0.0.1:8888/exhibit/api/exhibit-api.js.
Conditionally loading Exhibit from file:* or http:*
Here is a method to load Exhibit from your local file system, when the exhibit you browse was loaded from a file: URL, or from Simile, when it was fetched from elsewhere (an http: URL, most likely). This is convenient when you do edits locally, but don't want to rewrite the page before uploading it to your web hosting somewhere when you publish it. It requires you to first check out the Exhibit repository and any of the other required resources (Timeline, in this example) to local disk, and then link to the API using code like this. Be sure to update your local copy once in a while, if you use a non-stable / unreleased version (as 2.0 presently is). Substitute /home/svn for the path where your checked out copy resides:
<script type="text/javascript">
function load( url ) {
var script = '<script type="text/javascript" src="'+ url +'"></scr'+'ipt>\n';
document.write( script );
}
if( location.protocol != "file:" ) {
load( "http://simile.mit.edu/repository/exhibit/branches/2.0/src/webapp/api/exhibit-api.js?views=timeline" );
} else {
load( "/home/svn/exhibit/branches/2.0/src/ajax/api/simile-ajax-api.js?bundle=false" );
load( "/home/svn/timeline/trunk/src/webapp/api/timeline-api.js?bundle=false" );
load( "/home/svn/exhibit/branches/2.0/src/webapp/api/exhibit-api.js?bundle=false" );
}
</script>
Notes
Note that by default, Exhibit loads its bundled code generated by concatenating its original code and stripping out whitespace (for better performance). If you make changes to any of the .js or .css file, you need to do one of the following:
- In an HTML file that references the Exhibit API on your computer, you need to add the
bundleparameter to that reference, as follows:
<script href="http://127.0.0.1:8888/exhibit/api/exhibit-api.js?bundle=false" type="text/javascript"></script>
- You can re-bundle Exhibit's .js and .css files by running
antin the exhibit directory, given that you have installed Apache Ant.
One more caveat: map markers and exhibit logos are hardwired to our site. They are not included in the download because they take too much space. And obviously, Google Maps and Timeline ain't included.

