Merge pull request #63 from elemoine/hosted-examples
A step toward hosted examples on gh-pages
This commit is contained in:
@@ -109,6 +109,14 @@ build/jsdoc-$(BRANCH)-timestamp: $(SRC) $(shell find doc/template -type f)
|
|||||||
$(JSDOC) -t doc/template -r src -d build/gh-pages/$(BRANCH)/apidoc
|
$(JSDOC) -t doc/template -r src -d build/gh-pages/$(BRANCH)/apidoc
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
|
.PHONY: hostexamples
|
||||||
|
hostexamples: build examples
|
||||||
|
mkdir -p build/gh-pages/$(BRANCH)/examples
|
||||||
|
mkdir -p build/gh-pages/$(BRANCH)/build
|
||||||
|
cp $(EXAMPLES) $(subst .html,.js,$(EXAMPLES)) examples/style.css build/gh-pages/$(BRANCH)/examples/
|
||||||
|
cp build/loader_hosted_examples.js build/gh-pages/$(BRANCH)/examples/loader.js
|
||||||
|
cp build/ol.js build/ol.css build/gh-pages/$(BRANCH)/build/
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: $(INTERNAL_SRC)
|
test: $(INTERNAL_SRC)
|
||||||
$(PHANTOMJS) test/phantom-jasmine/run_jasmine_test.coffee test/ol.html
|
$(PHANTOMJS) test/phantom-jasmine/run_jasmine_test.coffee test/ol.html
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Loader to add ol.css, ol.js and the example-specific js file to the
|
||||||
|
* documents.
|
||||||
|
*
|
||||||
|
* This loader is used for the hosted examples. It is used in place of the
|
||||||
|
* development loader (examples/loader.js).
|
||||||
|
*
|
||||||
|
* ol.css and ol.js are built with Plovr/Closure, based build/ol.json.
|
||||||
|
* (`make build` should build them). They are located in the ../build/
|
||||||
|
* directory, relatively to this script.
|
||||||
|
*
|
||||||
|
* The script should be named loader.js. So it needs to be renamed to
|
||||||
|
* loader.js from loader_hosted_examples.js.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* <script src="../loader.js?id=my-demo"></script>
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var scripts = document.getElementsByTagName('script');
|
||||||
|
|
||||||
|
var i, src, index, search, chunks, pair, params = {};
|
||||||
|
for (i = scripts.length - 1; i >= 0; --i) {
|
||||||
|
src = scripts[i].getAttribute('src');
|
||||||
|
if (~(index = src.indexOf('loader.js?'))) {
|
||||||
|
search = src.substr(index + 10);
|
||||||
|
chunks = search ? search.split('&') : [];
|
||||||
|
for (i = chunks.length - 1; i >= 0; --i) {
|
||||||
|
pair = chunks[i].split('=');
|
||||||
|
params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.write('<link rel="stylesheet" href="../build/ol.css" '+
|
||||||
|
'type="text/css">');
|
||||||
|
document.write('<scr' + 'ipt type="text/javascript" ' +
|
||||||
|
'src="../build/ol.js">' +
|
||||||
|
'</scr' + 'ipt>');
|
||||||
|
document.write('<scr' + 'ipt type="text/javascript" ' +
|
||||||
|
'src="' + encodeURIComponent(params.id) + '.js">' +
|
||||||
|
'</scr' + 'ipt>');
|
||||||
|
}());
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
|
||||||
<title>ol3 full-screen demo</title>
|
<title>ol3 full-screen demo</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
+7
-3
@@ -1,10 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loader to add the plovr generated script to the document. The following
|
* Loader to add the plovr generated script and ol.css to the document.
|
||||||
* default values may be overridden with query string parameters:
|
|
||||||
*
|
*
|
||||||
* * hostname - the current hostname
|
* The following default values may be overridden with query string
|
||||||
|
* parameters:
|
||||||
|
*
|
||||||
|
* * hostname - the current hostname (window.location.hostname)
|
||||||
* * port - 9810
|
* * port - 9810
|
||||||
* * mode - ADVANCED
|
* * mode - ADVANCED
|
||||||
* * id - id param in loader.js query string; defaults to 'ol' if not set
|
* * id - id param in loader.js query string; defaults to 'ol' if not set
|
||||||
@@ -54,6 +56,8 @@
|
|||||||
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
|
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.write('<link rel="stylesheet" href="../css/ol.css" ' +
|
||||||
|
'type="text/css">');
|
||||||
var url = 'http://' + host + '/compile?' + pairs.join('&');
|
var url = 'http://' + host + '/compile?' + pairs.join('&');
|
||||||
document.write('<script type="text/javascript" src="' + url + '"></script>');
|
document.write('<script type="text/javascript" src="' + url + '"></script>');
|
||||||
}());
|
}());
|
||||||
|
|||||||
@@ -66,7 +66,6 @@
|
|||||||
margin-left: -13px;
|
margin-left: -13px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
|
||||||
<title>ol3 overlay-and-popup demo</title>
|
<title>ol3 overlay-and-popup demo</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="style.css" type="text/css">
|
<link rel="stylesheet" href="style.css" type="text/css">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.map {
|
.map {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
|
||||||
<link rel="stylesheet" href="style.css" type="text/css">
|
<link rel="stylesheet" href="style.css" type="text/css">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.map {
|
.map {
|
||||||
|
|||||||
Reference in New Issue
Block a user