Minimal demo.
This commit is contained in:
31
demo/loader.js
Normal file
31
demo/loader.js
Normal file
@@ -0,0 +1,31 @@
|
||||
// the following code includes the sourc-files of OpenLayers as they are
|
||||
// defined in ol.js.
|
||||
//
|
||||
// You can control in which form the source will be loaded by passing
|
||||
// URL-parameters:
|
||||
//
|
||||
// - host
|
||||
// where the plovr compiler is running, if not passed this defaults to the
|
||||
// current host on port 9810
|
||||
//
|
||||
// - mode
|
||||
// which mode of compilation should be applied. Common values for this are
|
||||
// RAW, SIMPLE or ADVANCED. If not provided, SIMPLE is used.
|
||||
(function(doc, l){
|
||||
var hostRegex = /[\\?&]host=([^&#]*)/,
|
||||
modeRegex = /[\\?&]mode=([^&#]*)/,
|
||||
hostResult = hostRegex.exec(l.href),
|
||||
modeResult = modeRegex.exec(l.href),
|
||||
host = (hostResult && hostResult[1])
|
||||
? hostResult[1]
|
||||
: (l.host)
|
||||
? l.host + ':9810'
|
||||
: 'localhost:9810',
|
||||
mode = (modeResult && modeResult[1])
|
||||
? modeResult[1]
|
||||
: 'SIMPLE',
|
||||
script = '<sc' + 'ript type="text/javascript" '
|
||||
+ 'src="http://' + host + '/compile?id=ol&mode=' + mode + '">'
|
||||
+ '</scr' + 'ipt>';
|
||||
doc.write(script);
|
||||
})(document, location);
|
||||
23
demo/map.html
Normal file
23
demo/map.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>OL3 Map</title>
|
||||
<script type="text/javascript" src="loader.js"></script>
|
||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
||||
<style type="text/css">
|
||||
#map {width: 512px; height: 512px;}
|
||||
.ol-viewport {border: 1px solid gray;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
<div id="map"></div>
|
||||
<script type="text/javascript">
|
||||
ol.map({
|
||||
el: 'map',
|
||||
layers: [ol.layer.osm()],
|
||||
center: [45, 5],
|
||||
zoom: 10
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user