more refactoring
This commit is contained in:
parent
a935c765c4
commit
a2669373a0
@ -15,7 +15,7 @@ function (Map, Sidebar, Meshstats, Linklist, SimpleNodelist, Infobox) {
|
||||
var infobox = new Infobox(config, sidebar, gotoAnything)
|
||||
gotoAnything.addTarget(infobox)
|
||||
|
||||
var map = new Map(sidebar, gotoAnything)
|
||||
var map = new Map(linkScale, sidebar, gotoAnything)
|
||||
document.body.insertBefore(map.div, document.body.firstChild)
|
||||
gotoAnything.addTarget(map)
|
||||
|
||||
@ -36,11 +36,11 @@ function (Map, Sidebar, Meshstats, Linklist, SimpleNodelist, Infobox) {
|
||||
]
|
||||
|
||||
var p = Promise.all(urls.map(getJSON))
|
||||
p.then(handle_data(config, linkScale, sidebar, meshstats, linklist, newnodeslist, lostnodeslist, infobox, map, gotoAnything))
|
||||
p.then(handle_data(sidebar, meshstats, linklist, newnodeslist, lostnodeslist, infobox, map, gotoAnything))
|
||||
})
|
||||
}
|
||||
|
||||
function handle_data(config, linkScale, sidebar, meshstats, linklist, newnodeslist, lostnodeslist, infobox, map, gotoAnything) {
|
||||
function handle_data(sidebar, meshstats, linklist, newnodeslist, lostnodeslist, infobox, map, gotoAnything) {
|
||||
return function (data) {
|
||||
var nodedict = data[0]
|
||||
var nodes = Object.keys(nodedict.nodes).map(function (key) { return nodedict.nodes[key] })
|
||||
@ -106,7 +106,7 @@ function (Map, Sidebar, Meshstats, Linklist, SimpleNodelist, Infobox) {
|
||||
d.target.node.neighbours.push({ node: d.source.node, link: d })
|
||||
})
|
||||
|
||||
map.setData(linkScale, now, newnodes, lostnodes, onlinenodes, links)
|
||||
map.setData(now, newnodes, lostnodes, onlinenodes, links)
|
||||
meshstats.setData(nodes)
|
||||
linklist.setData(links)
|
||||
newnodeslist.setData(newnodes)
|
||||
|
@ -55,7 +55,7 @@ define(function () {
|
||||
|
||||
var groupOnline, group
|
||||
|
||||
return function (sidebar, gotoAnything) {
|
||||
return function (linkScale, sidebar, gotoAnything) {
|
||||
var self = this
|
||||
|
||||
var el = document.createElement("div")
|
||||
@ -76,7 +76,7 @@ define(function () {
|
||||
var nodeDict = {}
|
||||
var linkDict = {}
|
||||
|
||||
self.setData = function (linkScale, now, newnodes, lostnodes, onlinenodes, links) {
|
||||
self.setData = function (now, newnodes, lostnodes, onlinenodes, links) {
|
||||
nodeDict = {}
|
||||
linkDict = {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user