]> git.openstreetmap.org Git - rails.git/blobdiff - public/openlayers/OpenStreetMap.js
move data into a layer in the layerswitcher
[rails.git] / public / openlayers / OpenStreetMap.js
index d6bc397d132ae517433ae494ad5956a0cc18cef1..244930866ab07a46c834304eb3b3c40b2050ec30 100644 (file)
@@ -182,3 +182,18 @@ OpenLayers.Layer.OSM.Maplint = OpenLayers.Class(OpenLayers.Layer.OSM, {
 
     CLASS_NAME: "OpenLayers.Layer.OSM.Maplint"
 });
+
+OpenLayers.Layer.Data = OpenLayers.Class(OpenLayers.Layer, { 
+    setVisibility: function(vis) {
+        OpenLayers.Layer.prototype.setVisibility.apply(this, arguments);
+        if (!this.map) { return; }
+        if (vis) {
+            new Ajax.Request('/browse/start', {asynchronous:true, evalScripts:true}); 
+        } else {
+            if (this.stopBrowse) {
+                this.stopBrowse();
+                closeSidebar(); 
+            }    
+        }    
+    }
+});