From f31c0650e40cb3e77797af9ac843b6f5548bb291 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Fri, 20 Mar 2015 13:43:30 +0100 Subject: [PATCH] history: fetch graph.json too --- history.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/history.js b/history.js index 18d57dd..6bc0fc8 100644 --- a/history.js +++ b/history.js @@ -45,7 +45,13 @@ function main() { map.invalidateSize() } - getJSON('nodes.json').then(handle_data(map)) + + var urls = [ 'https://map.luebeck.freifunk.net/data/nodes.json', + 'https://map.luebeck.freifunk.net/data/graph.json' + ] + + var p = Promise.all(urls.map(getJSON)) + p.then(handle_data(map)) } function sort(key, d) { @@ -86,7 +92,8 @@ function subtract(a, b) { function handle_data(map) { return function (data) { - var nodes = Object.keys(data.nodes).map(function (key) { return data.nodes[key] }) + var nodedict = data[0] + var nodes = Object.keys(nodedict.nodes).map(function (key) { return nodedict.nodes[key] }) nodes = nodes.filter( function (d) { return "firstseen" in d && "lastseen" in d