Browse Source

Disable clients and labels in map via configoption

Michael Schwarz 9 years ago
parent
commit
e9ed4526f0
2 changed files with 16 additions and 8 deletions
  1. 2 0
      config.js.example
  2. 14 8
      lib/map.js

+ 2 - 0
config.js.example

@@ -2,5 +2,7 @@ define({
   "dataPath": "http://map.paderborn.freifunk.net/data/",
   "siteName": "Freifunk Paderborn",
   "mapSigmaScale": 0.5,
+  "mapShowClients": false,
+  "mapShowLabels": false,
   "showContact": false
 })

+ 14 - 8
lib/map.js

@@ -224,13 +224,17 @@ define(["map/clientlayer", "map/labelslayer",
           layers.forEach(addLayer)
       }
 
-      var clientLayer = new ClientLayer()
-      clientLayer.addTo(map)
-      clientLayer.setZIndex(5)
+      if (config.mapShowClients) {
+        var clientLayer = new ClientLayer()
+        clientLayer.addTo(map)
+        clientLayer.setZIndex(5)
+      }
 
-      var labelsLayer = new LabelsLayer()
-      labelsLayer.addTo(map)
-      labelsLayer.setZIndex(6)
+      if (config.mapShowLabels) {
+        var labelsLayer = new LabelsLayer()
+        labelsLayer.addTo(map)
+        labelsLayer.setZIndex(6)
+      }
 
       var nodeDict = {}
       var linkDict = {}
@@ -370,9 +374,11 @@ define(["map/clientlayer", "map/labelslayer",
         var rtreeOnlineAll = rbush(9)
 
         rtreeOnlineAll.load(data.nodes.all.filter(online).filter(has_location).map(mapRTree))
+        if (config.mapShowClients)
+          clientLayer.setData(rtreeOnlineAll)
 
-        clientLayer.setData(rtreeOnlineAll)
-        labelsLayer.setData({online: nodesOnline.filter(has_location),
+        if (config.mapShowLabels)
+          labelsLayer.setData({online: nodesOnline.filter(has_location),
                              offline: nodesOffline.filter(has_location),
                              new: data.nodes.new.filter(has_location),
                              lost: data.nodes.lost.filter(has_location)