diff --git a/index.html b/index.html index 625749f..d22a8f3 100644 --- a/index.html +++ b/index.html @@ -4,26 +4,9 @@ RUB SeisObs - Station and Seismicity Map - + + + - - - + @@ -77,9 +77,9 @@ }); OpenLayers.Lang.setCode(document.documentElement.lang); - +
diff --git a/station_map_www.js b/station_map_www.js index 7d50bac..2f65a42 100644 --- a/station_map_www.js +++ b/station_map_www.js @@ -127,6 +127,7 @@ function init(showGoogle, showStations, showQuakes, noFrils) { // Show quakes quakes_layer = loadKML(OpenLayers.i18n("Events"), 'quakes.kml', false, true); + quakes_layer.events.on({'visibilitychanged': toggleQuakesMapkey}); map.addLayer(quakes_layer); quakes_layer.setVisibility(showQuakes); @@ -295,7 +296,7 @@ function onPopupClose(evt) { select.unselectAll(); } -/* Function called when clicking on a markger */ +/* Function called when clicking on a marker */ function onFeatureSelect(event) { var feature = event.feature; // Since KML is user-generated, do naive protection against @@ -337,3 +338,14 @@ function onFeatureUnselect(event) { delete feature.popup; } } + +/* Function to activate map legend */ +function toggleQuakesMapkey() { + var mapkey_div = document.getElementById('mapkey'); + var quakes_visibility = quakes_layer.getVisibility(); + if (quakes_visibility) { + mapkey_div.style.display = "block"; + } else { + mapkey_div.style.display = "none"; + } +}