source: subversion/applications/editors/potlatch2/resources/halcyon.html @ 18915

Last change on this file since 18915 was 18047, checked in by richard, 11 years ago

add more ways to control the viewer from JavaScript?

File size: 1.7 KB
RevLine 
[16541]1<html>
2
3<!-- Halcyon example embed script -->
4
5<head>
6<title>Halcyon</title>
7<script type="text/javascript" src="swfobject.js"></script>
8</head>
9
10<body>
11
[18047]12<div id="map" style="width:800px; height: 600px; border: 1px solid black; float:left; margin-right: 10px">
[16541]13</div>
14
15<script>
16
17        function respond(event,object,id,attr) {
18                alert (event+": "+object+" "+id+", highway="+attr['highway']);
19        }
20
[18047]21        var fo = new SWFObject("halcyon_viewer.swf?d="+Math.round(Math.random()*1000), "mapswf", "100%", "100%", "9", "#FFFFFF");
[16541]22        fo.addVariable("lat",51.875);
23        fo.addVariable("lon",-1.482);
[18047]24        fo.addVariable("zoom",14);
[16541]25        fo.addVariable("api","http://www.openstreetmap.org/api/0.6/");
26        fo.addVariable("policy","http://www.openstreetmap.org/api/crossdomain.xml");
27        fo.addVariable("connection","AMF");
28        fo.addVariable("responder","respond");
[18047]29        fo.addVariable("tileurl","http://npe.openstreetmap.org/$z/$x/$y.png");
30        fo.addVariable("style","test.css?d="+Math.round(Math.random()*1000));
[17454]31        fo.addVariable("show_debug","false");
[16541]32        fo.write("map");
33
[18047]34        function refreshCSS() {
35                if (document.getElementById("mapswf")) { 
36                        document.getElementById("mapswf").refreshCSS(document.getElementById("mapcss").value);
37                }
38        }
39
40        function jumpTo() {
41                if (document.getElementById("mapswf")) { 
42                        document.getElementById("mapswf").jumpTo(document.getElementById("lat").value,document.getElementById("lon").value);
43                }
44        }
45       
[16541]46</script>
47
[18047]48<div id="ui">
49<p>Lat: <input id='lat' value='51.875' size='6'> Lon: <input id='lon' value='-1.482' size='6'>
50<input type='button' onClick='javascript:jumpTo();' value=" Go ">
51<p>
52<input type='button' onClick='javascript:refreshCSS();' value=" Refresh CSS ">
53<textarea cols=40 rows=40 id='mapcss'>
54/* Type MapCSS here */
55</textarea>
56</p>
57</div>
58
[16541]59</body>
60</html>
Note: See TracBrowser for help on using the repository browser.