X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/cdf12b7a33334fefe58ed140c2874217591ac69e..abb66fa808f09469306e6b03b21539eb57b74d38:/app/views/site/index.rhtml diff --git a/app/views/site/index.rhtml b/app/views/site/index.rhtml index a79ea10c3..2cca4d529 100644 --- a/app/views/site/index.rhtml +++ b/app/views/site/index.rhtml @@ -94,6 +94,12 @@ by the OpenStreetMap project and its contributors. function mapInit(){ map = createMap("map"); + <% unless OSM_STATUS == :api_offline or OSM_STATUS == :database_offline %> + map.dataLayer = new OpenLayers.Layer("Data", { "visibility": false }); + map.dataLayer.events.register("visibilitychanged", map.dataLayer, toggleData); + map.addLayer(map.dataLayer); + <% end %> + <% if bbox %> var bbox = new OpenLayers.Bounds(<%= minlon %>, <%= minlat %>, <%= maxlon %>, <%= maxlat %>); @@ -126,6 +132,14 @@ by the OpenStreetMap project and its contributors. handleResize(); } + function toggleData() { + if (map.dataLayer.visibility) { + <%= remote_function :url => { :controller => 'browse', :action => 'start' } %> + } else { + closeSidebar(); + } + } + function getPosition() { return getMapCenter(); }