diff options
Diffstat (limited to 'static/main_map.js')
-rw-r--r-- | static/main_map.js | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/static/main_map.js b/static/main_map.js index 0bcf972..7de9904 100644 --- a/static/main_map.js +++ b/static/main_map.js @@ -1,5 +1,15 @@ /* main map */ +/* show a block panel */ +function show(id){ + document.getElementById(id).style.display = 'block'; +} + +/* hide a panel */ +function hide(id){ + document.getElementById(id).style.display = 'None'; +} + /* availaible map layers */ var layerMapnik = new OpenLayers.Layer.OSM.Mapnik('Classic'); var cyclemap = new OpenLayers.Layer.OSM.CycleMap("Cycle map", { @@ -59,7 +69,7 @@ function setMarkers(response){ /* clean the marker layer */ if (currentPopup) { currentPopup.hide(); - hideDetail(); + hide('detail'); } layerMarkers = new OpenLayers.Layer.Markers('POIs'); map.addLayer(layerMarkers); @@ -99,10 +109,7 @@ function putMarker(mark) { feature.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud); feature.data.popupContentHTML = "<div class='cloud'>"; feature.data.popupContentHTML += mark.properties.name; - feature.data.popupContentHTML += "<br/><div id='popup_link'>\ -<a href='javascript:showDetail()'>"; - feature.data.popupContentHTML += gettext("Show details"); - feature.data.popupContentHTML += "</a></div></div>"; + feature.data.popupContentHTML += "<br/> </div>"; feature.data.overflow = 'hidden'; var marker = feature.createMarker(); /* manage markers events */ @@ -112,7 +119,7 @@ function putMarker(mark) { if (currentPopup == this.popup) { this.popup.hide(); clicked = false; - hideDetail(); + hide('detail'); } else { currentPopup.hide(); showPop(this); @@ -150,19 +157,11 @@ function updateDetail(pk){ function setDetail(response){ if (response.responseText.indexOf('no results') == -1) { document.getElementById('detail').innerHTML = response.responseText; + show('detail'); } } -/* show the detail windows */ -function showDetail(){ - document.getElementById('detail').style.display = 'block'; -} - -/* hide content of detail panel */ -function hideDetail(){ - document.getElementById('detail').style.display = 'None'; -} /* main initialisation function */ function init(){ |