Two ways to run the hosted examples: compiled and raw

When viewing the hosted examples, people can load the compiled version of the library or load each script individually.
This commit is contained in:
Tim Schaub
2014-07-17 21:42:55 -06:00
parent 4dc601f30d
commit 737e063937
2 changed files with 4 additions and 16 deletions

View File

@@ -122,10 +122,7 @@ executing the `host-examples` build target:
After running `host-examples` you can now open the examples index page in the browser, for example: <http://localhost/~elemoine/ol3/build/hosted/master/examples/>. (This assumes that the `hosted` directory is a web directory, served by Apache for example.)
Append `?mode=debug` or `?mode=raw` to make the example work in full debug mode. In
full debug mode the OpenLayers and Closure Library scripts are loaded individually by
the Closure Library's `base.js` script (which the example page loads and
executes before any other script).
Append `?mode=raw` to make the example work in full debug mode. In raw mode the OpenLayers and Closure Library scripts are loaded individually by the Closure Library's `base.js` script (which the example page loads and executes before any other script).
## Running tests

View File

@@ -54,20 +54,11 @@
}
}
var oljs = 'ol.js', mode;
if ('mode' in pageParams) {
mode = pageParams.mode.toLowerCase();
if (mode == 'debug') {
mode = 'raw';
}
if (mode != 'advanced' && mode != 'raw') {
oljs = 'ol-' + mode + '.js';
}
}
var raw = pageParams.mode && pageParams.mode.toLowerCase() === 'raw';
var scriptId = encodeURIComponent(scriptParams.id);
if (mode != 'raw') {
document.write('<scr' + 'ipt type="text/javascript" src="../build/' + oljs + '"></scr' + 'ipt>');
if (!raw) {
document.write('<scr' + 'ipt type="text/javascript" src="../build/ol.js"></scr' + 'ipt>');
} else {
window.CLOSURE_NO_DEPS = true; // we've got our own deps file
document.write('<scr' + 'ipt type="text/javascript" src="../closure-library/closure/goog/base.js"></scr' + 'ipt>');