2015-03-20 08:46:24 +00:00
|
|
|
|
document.addEventListener('DOMContentLoaded', main)
|
|
|
|
|
|
|
|
|
|
function main() {
|
2015-03-20 20:03:20 +00:00
|
|
|
|
getJSON("config.json").then( function (config) {
|
2015-03-21 19:10:46 +00:00
|
|
|
|
moment.locale("de")
|
|
|
|
|
|
2015-03-20 20:03:20 +00:00
|
|
|
|
var options = { worldCopyJump: true,
|
|
|
|
|
zoomControl: false
|
|
|
|
|
}
|
2015-03-20 12:30:28 +00:00
|
|
|
|
|
2015-03-23 15:41:05 +00:00
|
|
|
|
var linkScale = chroma.scale(chroma.interpolate.bezier(['green', 'yellow', 'red'])).domain([1, 5])
|
|
|
|
|
|
2015-03-23 12:25:52 +00:00
|
|
|
|
var mapDiv = document.createElement("div")
|
|
|
|
|
mapDiv.classList.add("map")
|
|
|
|
|
document.body.insertBefore(mapDiv, document.body.firstChild)
|
|
|
|
|
|
|
|
|
|
var map = L.map(mapDiv, options)
|
2015-03-23 13:58:09 +00:00
|
|
|
|
var sidebar = mkSidebar(document.body)
|
|
|
|
|
var infobox = new Infobox(sidebar)
|
|
|
|
|
var gotoAnything = new gotoBuilder(config, infobox, showNodeinfo, showLinkinfo)
|
2015-03-20 12:30:28 +00:00
|
|
|
|
|
2015-03-20 20:03:20 +00:00
|
|
|
|
var urls = [ config.dataPath + 'nodes.json',
|
|
|
|
|
config.dataPath + 'graph.json'
|
|
|
|
|
]
|
2015-03-20 12:43:30 +00:00
|
|
|
|
|
2015-03-20 20:03:20 +00:00
|
|
|
|
var p = Promise.all(urls.map(getJSON))
|
2015-03-23 15:41:05 +00:00
|
|
|
|
p.then(handle_data(config, linkScale, sidebar, infobox, map, gotoAnything))
|
2015-03-20 20:03:20 +00:00
|
|
|
|
})
|
2015-03-20 08:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 15:41:05 +00:00
|
|
|
|
function handle_data(config, linkScale, sidebar, infobox, map, gotoAnything) {
|
2015-03-20 12:30:28 +00:00
|
|
|
|
return function (data) {
|
2015-03-20 12:43:30 +00:00
|
|
|
|
var nodedict = data[0]
|
|
|
|
|
var nodes = Object.keys(nodedict.nodes).map(function (key) { return nodedict.nodes[key] })
|
2015-03-20 08:46:24 +00:00
|
|
|
|
|
2015-03-20 12:30:28 +00:00
|
|
|
|
nodes = nodes.filter( function (d) {
|
|
|
|
|
return "firstseen" in d && "lastseen" in d
|
|
|
|
|
})
|
2015-03-20 08:46:24 +00:00
|
|
|
|
|
2015-03-20 12:30:28 +00:00
|
|
|
|
nodes.forEach( function(node) {
|
2015-03-21 19:10:46 +00:00
|
|
|
|
node.firstseen = moment.utc(node.firstseen)
|
|
|
|
|
node.lastseen = moment.utc(node.lastseen)
|
2015-03-20 12:30:28 +00:00
|
|
|
|
})
|
2015-03-20 08:46:24 +00:00
|
|
|
|
|
2015-03-23 10:25:54 +00:00
|
|
|
|
var now = moment()
|
|
|
|
|
var age = moment(now).subtract(14, 'days')
|
2015-03-20 08:46:24 +00:00
|
|
|
|
|
2015-03-23 14:46:19 +00:00
|
|
|
|
var newnodes = limit("firstseen", age, sortByKey("firstseen", nodes).filter(online))
|
|
|
|
|
var lostnodes = limit("lastseen", age, sortByKey("lastseen", nodes).filter(offline))
|
2015-03-20 08:46:24 +00:00
|
|
|
|
|
2015-03-22 23:58:31 +00:00
|
|
|
|
var onlinenodes = nodes.filter(online)
|
2015-03-20 08:46:24 +00:00
|
|
|
|
|
2015-03-20 14:03:39 +00:00
|
|
|
|
var graph = data[1].batadv
|
2015-03-21 09:39:55 +00:00
|
|
|
|
var graphnodes = data[0].nodes
|
2015-03-20 14:03:39 +00:00
|
|
|
|
|
|
|
|
|
graph.nodes.forEach( function (d) {
|
2015-03-22 14:08:04 +00:00
|
|
|
|
if (d.node_id in graphnodes)
|
2015-03-21 09:39:55 +00:00
|
|
|
|
d.node = graphnodes[d.node_id]
|
2015-03-20 14:03:39 +00:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
graph.links.forEach( function (d) {
|
|
|
|
|
if (graph.nodes[d.source].node)
|
|
|
|
|
d.source = graph.nodes[d.source]
|
|
|
|
|
else
|
|
|
|
|
d.source = undefined
|
|
|
|
|
|
|
|
|
|
if (graph.nodes[d.target].node)
|
|
|
|
|
d.target = graph.nodes[d.target]
|
|
|
|
|
else
|
|
|
|
|
d.target = undefined
|
|
|
|
|
})
|
|
|
|
|
|
2015-03-22 19:38:07 +00:00
|
|
|
|
var links = graph.links.filter( function (d) {
|
2015-03-22 13:47:33 +00:00
|
|
|
|
return d.source !== undefined && d.target !== undefined
|
2015-03-20 14:03:39 +00:00
|
|
|
|
})
|
|
|
|
|
|
2015-03-22 19:38:07 +00:00
|
|
|
|
links.forEach( function (d) {
|
2015-03-22 14:08:04 +00:00
|
|
|
|
if (!("location" in d.source.node.nodeinfo && "location" in d.target.node.nodeinfo))
|
|
|
|
|
return
|
|
|
|
|
|
2015-03-20 19:08:28 +00:00
|
|
|
|
d.latlngs = []
|
|
|
|
|
d.latlngs.push(L.latLng(d.source.node.nodeinfo.location.latitude, d.source.node.nodeinfo.location.longitude))
|
|
|
|
|
d.latlngs.push(L.latLng(d.target.node.nodeinfo.location.latitude, d.target.node.nodeinfo.location.longitude))
|
|
|
|
|
|
|
|
|
|
d.distance = d.latlngs[0].distanceTo(d.latlngs[1])
|
|
|
|
|
})
|
|
|
|
|
|
2015-03-22 14:08:04 +00:00
|
|
|
|
nodes.forEach( function (d) {
|
|
|
|
|
d.neighbours = []
|
|
|
|
|
})
|
|
|
|
|
|
2015-03-22 19:38:07 +00:00
|
|
|
|
links.forEach( function (d) {
|
2015-03-22 14:08:04 +00:00
|
|
|
|
d.source.node.neighbours.push({ node: d.target.node, link: d })
|
|
|
|
|
d.target.node.neighbours.push({ node: d.source.node, link: d })
|
|
|
|
|
})
|
2015-03-20 19:08:28 +00:00
|
|
|
|
|
2015-03-23 15:41:05 +00:00
|
|
|
|
var markers = mkmap(map, linkScale, sidebar, now, newnodes, lostnodes, onlinenodes, links, gotoAnything)
|
2015-03-22 11:30:52 +00:00
|
|
|
|
|
|
|
|
|
gotoAnything.addMarkers(markers)
|
2015-03-21 14:59:25 +00:00
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
showMeshstats(sidebar, nodes)
|
|
|
|
|
mkNodesList(sidebar, config.showContact, "firstseen", gotoAnything.node, "Neue Knoten", newnodes)
|
|
|
|
|
mkNodesList(sidebar, config.showContact, "lastseen", gotoAnything.node, "Verschwundene Knoten", lostnodes)
|
2015-03-23 15:41:05 +00:00
|
|
|
|
mkLinkList(sidebar, linkScale, gotoAnything.link, links)
|
2015-03-21 09:40:58 +00:00
|
|
|
|
|
2015-03-22 12:24:15 +00:00
|
|
|
|
var historyDict = { nodes: {}, links: {} }
|
|
|
|
|
|
|
|
|
|
nodes.forEach( function (d) {
|
|
|
|
|
historyDict.nodes[d.nodeinfo.node_id] = d
|
|
|
|
|
})
|
|
|
|
|
|
2015-03-22 19:38:07 +00:00
|
|
|
|
links.forEach( function (d) {
|
2015-03-22 12:24:15 +00:00
|
|
|
|
historyDict.links[linkId(d)] = d
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
gotoHistory(gotoAnything, historyDict, window.location.hash)
|
|
|
|
|
|
|
|
|
|
window.onpopstate = function (d) {
|
|
|
|
|
gotoHistory(gotoAnything, historyDict, d.state)
|
|
|
|
|
}
|
2015-03-20 12:30:28 +00:00
|
|
|
|
}
|
2015-03-20 08:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 12:36:35 +00:00
|
|
|
|
function mkSidebar(el) {
|
|
|
|
|
var sidebar = document.createElement("div")
|
|
|
|
|
sidebar.classList.add("sidebar")
|
|
|
|
|
el.appendChild(sidebar)
|
|
|
|
|
|
|
|
|
|
var button = document.createElement("button")
|
|
|
|
|
sidebar.appendChild(button)
|
|
|
|
|
|
|
|
|
|
button.classList.add("sidebarhandle")
|
|
|
|
|
button.onclick = function () {
|
|
|
|
|
sidebar.classList.toggle("hidden")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var container = document.createElement("div")
|
|
|
|
|
container.classList.add("container")
|
|
|
|
|
sidebar.appendChild(container)
|
|
|
|
|
|
|
|
|
|
container.getWidth = function () {
|
|
|
|
|
var small = window.matchMedia("(max-width: 60em)");
|
|
|
|
|
return small.matches ? 0 : sidebar.offsetWidth
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return container
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 15:41:05 +00:00
|
|
|
|
function mkmap(map, linkScale, sidebar, now, newnodes, lostnodes, onlinenodes, graph, gotoAnything) {
|
2015-03-23 10:07:06 +00:00
|
|
|
|
function mkMarker(dict, iconFunc) {
|
|
|
|
|
return function (d) {
|
|
|
|
|
var opt = { icon: iconFunc(d),
|
|
|
|
|
title: d.nodeinfo.hostname
|
2015-03-22 23:58:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 10:07:06 +00:00
|
|
|
|
var m = L.marker([d.nodeinfo.location.latitude, d.nodeinfo.location.longitude], opt)
|
2015-03-22 23:58:31 +00:00
|
|
|
|
|
2015-03-23 10:07:06 +00:00
|
|
|
|
m.on('click', gotoAnything.node(d, false))
|
|
|
|
|
m.bindPopup(d.nodeinfo.hostname)
|
2015-03-22 23:58:31 +00:00
|
|
|
|
|
2015-03-23 10:07:06 +00:00
|
|
|
|
dict[d.nodeinfo.node_id] = m
|
2015-03-22 23:58:31 +00:00
|
|
|
|
|
2015-03-23 10:07:06 +00:00
|
|
|
|
return m
|
|
|
|
|
}
|
2015-03-22 23:58:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 10:07:06 +00:00
|
|
|
|
var iconBase = { iconUrl: 'img/circlemarker.png',
|
|
|
|
|
iconRetinaUrl: 'img/circlemarker@2x.png',
|
|
|
|
|
iconSize: [17, 17],
|
|
|
|
|
iconAnchor: [8, 8],
|
|
|
|
|
popupAnchor: [0, -3]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var iconOnline = Object.assign({}, iconBase)
|
|
|
|
|
iconOnline.className = "node-online"
|
|
|
|
|
iconOnline = L.icon(iconOnline)
|
|
|
|
|
|
|
|
|
|
var iconOffline = Object.assign({}, iconBase)
|
|
|
|
|
iconOffline.className = "node-offline"
|
|
|
|
|
iconOffline = L.icon(iconOffline)
|
|
|
|
|
|
|
|
|
|
var iconNew = Object.assign({}, iconBase)
|
|
|
|
|
iconNew.className = "node-new"
|
|
|
|
|
iconNew = L.icon(iconNew)
|
|
|
|
|
|
2015-03-23 10:25:54 +00:00
|
|
|
|
var iconOfflineAlert = Object.assign({}, iconBase)
|
|
|
|
|
iconOfflineAlert.className = "node-offline node-alert"
|
|
|
|
|
iconOfflineAlert = L.icon(iconOfflineAlert)
|
|
|
|
|
|
2015-03-20 08:57:53 +00:00
|
|
|
|
L.control.zoom({ position: "topright" }).addTo(map)
|
2015-03-20 08:46:24 +00:00
|
|
|
|
|
2015-03-22 19:51:45 +00:00
|
|
|
|
L.tileLayer("https://otile{s}-s.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg", {
|
2015-03-20 08:46:24 +00:00
|
|
|
|
subdomains: "1234",
|
|
|
|
|
type: "osm",
|
2015-03-22 19:50:13 +00:00
|
|
|
|
attribution: "Map data Tiles © <a href=\"https://www.mapquest.com/\" target=\"_blank\">MapQuest</a> <img src=\"https://developer.mapquest.com/content/osm/mq_logo.png\" />, Map data © OpenStreetMap contributors, CC-BY-SA",
|
2015-03-21 18:17:26 +00:00
|
|
|
|
maxZoom: 18
|
2015-03-20 08:46:24 +00:00
|
|
|
|
}).addTo(map)
|
|
|
|
|
|
2015-03-23 15:41:05 +00:00
|
|
|
|
var markersDict = addLinksToMap(linkScale, map, graph, gotoAnything)
|
2015-03-20 14:03:39 +00:00
|
|
|
|
|
2015-03-22 14:27:16 +00:00
|
|
|
|
var nodes = newnodes.concat(lostnodes).filter(has_location)
|
2015-03-20 08:46:24 +00:00
|
|
|
|
|
2015-03-23 10:07:06 +00:00
|
|
|
|
var markers = nodes.map(mkMarker(markersDict, function (d) {
|
2015-03-23 10:25:54 +00:00
|
|
|
|
if (d.flags.online)
|
|
|
|
|
return iconNew
|
|
|
|
|
|
|
|
|
|
if (d.lastseen.isAfter(moment(now).subtract(1, 'days')))
|
|
|
|
|
return iconOfflineAlert
|
|
|
|
|
else
|
|
|
|
|
return iconOffline
|
2015-03-23 10:07:06 +00:00
|
|
|
|
}))
|
2015-03-20 08:46:24 +00:00
|
|
|
|
|
2015-03-23 10:07:06 +00:00
|
|
|
|
var onlinemarkers = subtract(onlinenodes.filter(has_location), newnodes)
|
|
|
|
|
.map(mkMarker(markersDict, function (d) { return iconOnline } ))
|
2015-03-20 08:46:24 +00:00
|
|
|
|
|
2015-03-23 10:06:12 +00:00
|
|
|
|
var groupOnline = L.featureGroup(onlinemarkers).addTo(map)
|
2015-03-20 08:46:24 +00:00
|
|
|
|
var group = L.featureGroup(markers).addTo(map)
|
|
|
|
|
|
2015-03-21 23:20:06 +00:00
|
|
|
|
var bounds = group.getBounds()
|
|
|
|
|
|
|
|
|
|
if (!bounds.isValid())
|
2015-03-23 10:06:12 +00:00
|
|
|
|
bounds = groupOnline.getBounds()
|
2015-03-21 23:20:06 +00:00
|
|
|
|
|
|
|
|
|
if (bounds.isValid())
|
2015-03-23 12:36:35 +00:00
|
|
|
|
map.fitBounds(bounds, {paddingTopLeft: [sidebar.getWidth(), 0]})
|
2015-03-20 21:55:23 +00:00
|
|
|
|
|
|
|
|
|
var funcDict = {}
|
|
|
|
|
|
|
|
|
|
Object.keys(markersDict).map( function(k) {
|
|
|
|
|
funcDict[k] = function (d) {
|
|
|
|
|
var m = markersDict[k]
|
2015-03-21 18:08:51 +00:00
|
|
|
|
var bounds
|
2015-03-23 10:07:13 +00:00
|
|
|
|
|
|
|
|
|
if ("getBounds" in m)
|
2015-03-21 18:08:51 +00:00
|
|
|
|
bounds = m.getBounds()
|
2015-03-23 10:07:13 +00:00
|
|
|
|
else
|
2015-03-21 18:08:51 +00:00
|
|
|
|
bounds = L.latLngBounds([m.getLatLng()])
|
2015-03-20 21:56:31 +00:00
|
|
|
|
|
2015-03-23 12:36:35 +00:00
|
|
|
|
map.fitBounds(bounds, {paddingTopLeft: [sidebar.getWidth(), 0]})
|
2015-03-21 18:08:51 +00:00
|
|
|
|
m.openPopup(bounds.getCenter())
|
2015-03-20 21:55:23 +00:00
|
|
|
|
}
|
2015-03-23 10:06:12 +00:00
|
|
|
|
})
|
2015-03-20 21:55:23 +00:00
|
|
|
|
|
|
|
|
|
return funcDict
|
2015-03-20 08:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 15:41:05 +00:00
|
|
|
|
function addLinksToMap(linkScale, map, graph, gotoAnything) {
|
2015-03-20 21:55:23 +00:00
|
|
|
|
var markersDict = {}
|
|
|
|
|
|
2015-03-22 14:08:04 +00:00
|
|
|
|
graph = graph.filter( function (d) {
|
|
|
|
|
return "distance" in d
|
|
|
|
|
})
|
|
|
|
|
|
2015-03-20 14:03:39 +00:00
|
|
|
|
var lines = graph.map( function (d) {
|
2015-03-23 15:41:05 +00:00
|
|
|
|
var opts = { color: linkScale(d.tq).hex(),
|
2015-03-20 19:48:52 +00:00
|
|
|
|
weight: 4
|
2015-03-20 14:03:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-20 19:08:28 +00:00
|
|
|
|
var line = L.polyline(d.latlngs, opts)
|
2015-03-20 14:03:39 +00:00
|
|
|
|
|
2015-03-21 12:32:07 +00:00
|
|
|
|
line.bindPopup(d.source.node.nodeinfo.hostname + " – " + d.target.node.nodeinfo.hostname + "<br><strong>" + showDistance(d) + " / " + showTq(d) + "</strong>")
|
2015-03-22 11:30:52 +00:00
|
|
|
|
line.on('click', gotoAnything.link(d, false))
|
2015-03-20 16:58:20 +00:00
|
|
|
|
|
2015-03-20 21:55:23 +00:00
|
|
|
|
markersDict[linkId(d)] = line
|
|
|
|
|
|
2015-03-20 14:03:39 +00:00
|
|
|
|
return line
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
var group = L.featureGroup(lines).addTo(map)
|
2015-03-20 21:55:23 +00:00
|
|
|
|
|
|
|
|
|
return markersDict
|
2015-03-20 14:03:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 15:41:05 +00:00
|
|
|
|
function mkLinkList(el, linkScale, gotoProxy, links) {
|
2015-03-22 22:55:02 +00:00
|
|
|
|
if (links.length == 0)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
var h2 = document.createElement("h2")
|
|
|
|
|
h2.textContent = "Verbindungen"
|
|
|
|
|
el.appendChild(h2)
|
|
|
|
|
|
|
|
|
|
var table = document.createElement("table")
|
2015-03-22 19:38:07 +00:00
|
|
|
|
var thead = document.createElement("thead")
|
|
|
|
|
|
|
|
|
|
var tr = document.createElement("tr")
|
|
|
|
|
var th1 = document.createElement("th")
|
|
|
|
|
th1.textContent = "Knoten"
|
|
|
|
|
tr.appendChild(th1)
|
|
|
|
|
|
|
|
|
|
var th2 = document.createElement("th")
|
|
|
|
|
th2.textContent = "TQ"
|
|
|
|
|
tr.appendChild(th2)
|
|
|
|
|
|
|
|
|
|
var th3 = document.createElement("th")
|
|
|
|
|
th3.textContent = "Entfernung"
|
|
|
|
|
th3.classList.add("sort-default")
|
|
|
|
|
tr.appendChild(th3)
|
|
|
|
|
|
|
|
|
|
thead.appendChild(tr)
|
|
|
|
|
|
2015-03-22 22:55:02 +00:00
|
|
|
|
table.appendChild(thead)
|
2015-03-22 19:38:07 +00:00
|
|
|
|
|
|
|
|
|
var tbody = document.createElement("tbody")
|
|
|
|
|
|
2015-03-20 19:08:28 +00:00
|
|
|
|
links.forEach( function (d) {
|
|
|
|
|
var row = document.createElement("tr")
|
|
|
|
|
var td1 = document.createElement("td")
|
2015-03-20 21:55:23 +00:00
|
|
|
|
var a = document.createElement("a")
|
|
|
|
|
a.textContent = d.source.node.nodeinfo.hostname + " – " + d.target.node.nodeinfo.hostname
|
|
|
|
|
a.href = "#"
|
2015-03-21 14:59:25 +00:00
|
|
|
|
a.onclick = gotoProxy(d)
|
2015-03-20 21:55:23 +00:00
|
|
|
|
td1.appendChild(a)
|
2015-03-20 19:08:28 +00:00
|
|
|
|
row.appendChild(td1)
|
|
|
|
|
|
2015-03-22 18:43:28 +00:00
|
|
|
|
if (d.vpn)
|
|
|
|
|
td1.appendChild(document.createTextNode(" (VPN)"))
|
|
|
|
|
|
2015-03-20 19:08:28 +00:00
|
|
|
|
var td2 = document.createElement("td")
|
2015-03-21 19:49:39 +00:00
|
|
|
|
td2.textContent = showTq(d)
|
2015-03-23 15:41:05 +00:00
|
|
|
|
td2.style.color = linkScale(d.tq)
|
2015-03-20 19:08:28 +00:00
|
|
|
|
row.appendChild(td2)
|
|
|
|
|
|
2015-03-20 19:28:21 +00:00
|
|
|
|
var td3 = document.createElement("td")
|
2015-03-21 19:49:39 +00:00
|
|
|
|
td3.textContent = showDistance(d)
|
2015-03-22 19:38:07 +00:00
|
|
|
|
td3.setAttribute("data-sort", d.distance !== undefined ? -d.distance : 1)
|
2015-03-20 19:28:21 +00:00
|
|
|
|
row.appendChild(td3)
|
|
|
|
|
|
2015-03-22 19:38:07 +00:00
|
|
|
|
tbody.appendChild(row)
|
2015-03-20 19:08:28 +00:00
|
|
|
|
})
|
2015-03-22 19:38:07 +00:00
|
|
|
|
|
2015-03-22 22:55:02 +00:00
|
|
|
|
table.appendChild(tbody)
|
|
|
|
|
|
|
|
|
|
new Tablesort(table)
|
2015-03-22 19:38:07 +00:00
|
|
|
|
|
2015-03-22 22:55:02 +00:00
|
|
|
|
el.appendChild(table)
|
2015-03-20 19:08:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-22 23:10:09 +00:00
|
|
|
|
function mkNodesList(el, showContact, tf, gotoProxy, title, list) {
|
|
|
|
|
if (list.length == 0)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
var h2 = document.createElement("h2")
|
|
|
|
|
h2.textContent = title
|
|
|
|
|
el.appendChild(h2)
|
|
|
|
|
var table = document.createElement("table")
|
|
|
|
|
el.appendChild(table)
|
|
|
|
|
|
|
|
|
|
var tbody = document.createElement("tbody")
|
|
|
|
|
|
2015-03-20 08:46:24 +00:00
|
|
|
|
list.forEach( function (d) {
|
|
|
|
|
var time = moment(d[tf]).fromNow()
|
|
|
|
|
|
|
|
|
|
var row = document.createElement("tr")
|
|
|
|
|
var td1 = document.createElement("td")
|
2015-03-20 21:55:23 +00:00
|
|
|
|
var a = document.createElement("a")
|
|
|
|
|
a.classList.add("hostname")
|
|
|
|
|
a.classList.add(d.flags.online ? "online" : "offline")
|
|
|
|
|
a.textContent = d.nodeinfo.hostname
|
2015-03-21 14:59:25 +00:00
|
|
|
|
a.href = "#"
|
|
|
|
|
a.onclick = gotoProxy(d)
|
2015-03-20 21:55:23 +00:00
|
|
|
|
td1.appendChild(a)
|
2015-03-20 08:46:24 +00:00
|
|
|
|
|
2015-03-22 14:27:16 +00:00
|
|
|
|
if (has_location(d)) {
|
2015-03-20 19:36:49 +00:00
|
|
|
|
var span = document.createElement("span")
|
|
|
|
|
span.classList.add("icon")
|
|
|
|
|
span.classList.add("ion-location")
|
|
|
|
|
td1.appendChild(span)
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-20 20:03:20 +00:00
|
|
|
|
if ("owner" in d.nodeinfo && showContact) {
|
2015-03-20 08:46:24 +00:00
|
|
|
|
var contact = d.nodeinfo.owner.contact
|
|
|
|
|
td1.appendChild(document.createTextNode(" – " + contact + ""))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var td2 = document.createElement("td")
|
|
|
|
|
td2.textContent = time
|
|
|
|
|
|
|
|
|
|
row.appendChild(td1)
|
|
|
|
|
row.appendChild(td2)
|
2015-03-22 23:10:09 +00:00
|
|
|
|
tbody.appendChild(row)
|
2015-03-20 08:46:24 +00:00
|
|
|
|
})
|
2015-03-22 23:10:09 +00:00
|
|
|
|
|
|
|
|
|
table.appendChild(tbody)
|
|
|
|
|
el.appendChild(table)
|
2015-03-20 08:46:24 +00:00
|
|
|
|
}
|
2015-03-21 09:40:58 +00:00
|
|
|
|
|
|
|
|
|
function showMeshstats(el, nodes) {
|
2015-03-23 11:58:16 +00:00
|
|
|
|
var h2 = document.createElement("h2")
|
|
|
|
|
h2.textContent = "Übersicht"
|
|
|
|
|
el.appendChild(h2)
|
2015-03-21 09:40:58 +00:00
|
|
|
|
|
2015-03-23 11:58:16 +00:00
|
|
|
|
var p = document.createElement("p")
|
|
|
|
|
|
|
|
|
|
var totalNodes = sum(nodes.filter(online).map(one))
|
2015-03-21 09:40:58 +00:00
|
|
|
|
var totalClients = sum(nodes.filter(online).map( function (d) {
|
|
|
|
|
return d.statistics.clients
|
|
|
|
|
}))
|
|
|
|
|
var totalGateways = sum(nodes.filter(online).filter( function (d) {
|
|
|
|
|
return d.flags.gateway
|
|
|
|
|
}).map(one))
|
|
|
|
|
|
2015-03-23 11:58:16 +00:00
|
|
|
|
p.textContent = totalNodes + " Knoten (online), " +
|
|
|
|
|
totalClients + " Clients, " +
|
|
|
|
|
totalGateways + " Gateways"
|
|
|
|
|
|
|
|
|
|
p.appendChild(document.createElement("br"))
|
|
|
|
|
p.appendChild(document.createTextNode("Diese Daten sind " + moment.utc(nodes.timestamp).fromNow(true) + " alt."))
|
|
|
|
|
el.appendChild(p)
|
2015-03-21 09:40:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
function Infobox(sidebar) {
|
|
|
|
|
var self = this
|
|
|
|
|
el = undefined
|
|
|
|
|
|
2015-03-22 15:19:16 +00:00
|
|
|
|
function close() {
|
|
|
|
|
destroy()
|
|
|
|
|
pushHistory()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function destroy() {
|
2015-03-23 12:23:12 +00:00
|
|
|
|
if (el && el.parentNode) {
|
|
|
|
|
el.parentNode.removeChild(el)
|
|
|
|
|
el = undefined
|
|
|
|
|
}
|
2015-03-22 15:19:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
self.create = function () {
|
|
|
|
|
destroy()
|
|
|
|
|
|
|
|
|
|
el = document.createElement("div")
|
|
|
|
|
sidebar.insertBefore(el, sidebar.firstChild)
|
2015-03-21 15:32:17 +00:00
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
el.scrollIntoView(false)
|
|
|
|
|
el.classList.add("infobox")
|
|
|
|
|
el.close = close
|
|
|
|
|
el.destroy = destroy
|
2015-03-21 15:32:17 +00:00
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
var closeButton = document.createElement("button")
|
|
|
|
|
closeButton.classList.add("close")
|
|
|
|
|
closeButton.onclick = close
|
|
|
|
|
el.appendChild(closeButton)
|
2015-03-22 15:19:16 +00:00
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
return el
|
|
|
|
|
}
|
2015-03-21 15:32:17 +00:00
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
return self
|
2015-03-22 15:19:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
function showNodeinfo(config, infobox, gotoAnything, d) {
|
|
|
|
|
var el = infobox.create()
|
|
|
|
|
|
2015-03-21 15:32:17 +00:00
|
|
|
|
var h2 = document.createElement("h2")
|
|
|
|
|
h2.textContent = d.nodeinfo.hostname
|
2015-03-22 10:19:30 +00:00
|
|
|
|
var span = document.createElement("span")
|
|
|
|
|
span.classList.add(d.flags.online ? "online" : "offline")
|
|
|
|
|
span.textContent = " (" + (d.flags.online ? "online" : "offline, " + d.lastseen.fromNow(true)) + ")"
|
|
|
|
|
h2.appendChild(span)
|
2015-03-21 15:32:17 +00:00
|
|
|
|
el.appendChild(h2)
|
|
|
|
|
|
2015-03-22 10:19:30 +00:00
|
|
|
|
var attributes = document.createElement("table")
|
|
|
|
|
attributes.classList.add("attributes")
|
|
|
|
|
|
|
|
|
|
attributeEntry(attributes, "Gateway", d.flags.gateway ? "ja" : null)
|
2015-03-22 14:27:16 +00:00
|
|
|
|
attributeEntry(attributes, "In der Karte", has_location(d) ? "ja" : "nein")
|
2015-03-22 11:38:07 +00:00
|
|
|
|
|
|
|
|
|
if (config.showContact)
|
|
|
|
|
attributeEntry(attributes, "Kontakt", dictGet(d.nodeinfo, ["owner", "contact"]))
|
|
|
|
|
|
2015-03-22 10:19:30 +00:00
|
|
|
|
attributeEntry(attributes, "Hardware", dictGet(d.nodeinfo, ["hardware", "model"]))
|
|
|
|
|
attributeEntry(attributes, "Primäre MAC", dictGet(d.nodeinfo, ["network", "mac"]))
|
|
|
|
|
attributeEntry(attributes, "Firmware", showFirmware(d))
|
|
|
|
|
attributeEntry(attributes, "Uptime", showUptime(d))
|
|
|
|
|
attributeEntry(attributes, "Teil des Netzes", showFirstseen(d))
|
|
|
|
|
attributeEntry(attributes, "Arbeitsspeicher", showRAM(d))
|
|
|
|
|
attributeEntry(attributes, "IP Adressen", showIPs(d))
|
|
|
|
|
attributeEntry(attributes, "Clients", showClients(d))
|
|
|
|
|
el.appendChild(attributes)
|
|
|
|
|
|
2015-03-22 14:08:04 +00:00
|
|
|
|
if (d.neighbours.length > 0) {
|
|
|
|
|
var h3 = document.createElement("h3")
|
2015-03-22 15:00:34 +00:00
|
|
|
|
h3.textContent = "Nachbarknoten (" + d.neighbours.length + ")"
|
2015-03-22 14:08:04 +00:00
|
|
|
|
el.appendChild(h3)
|
|
|
|
|
|
|
|
|
|
var table = document.createElement("table")
|
2015-03-22 19:23:57 +00:00
|
|
|
|
var thead = document.createElement("thead")
|
2015-03-22 14:08:04 +00:00
|
|
|
|
|
2015-03-22 19:23:57 +00:00
|
|
|
|
var tr = document.createElement("tr")
|
|
|
|
|
var th1 = document.createElement("th")
|
|
|
|
|
th1.textContent = "Knoten"
|
|
|
|
|
th1.classList.add("sort-default")
|
|
|
|
|
tr.appendChild(th1)
|
|
|
|
|
|
|
|
|
|
var th2 = document.createElement("th")
|
|
|
|
|
th2.textContent = "TQ"
|
|
|
|
|
tr.appendChild(th2)
|
|
|
|
|
|
|
|
|
|
var th3 = document.createElement("th")
|
|
|
|
|
th3.textContent = "Entfernung"
|
|
|
|
|
tr.appendChild(th3)
|
|
|
|
|
|
|
|
|
|
thead.appendChild(tr)
|
|
|
|
|
table.appendChild(thead)
|
2015-03-22 14:20:18 +00:00
|
|
|
|
|
2015-03-22 19:23:57 +00:00
|
|
|
|
var tbody = document.createElement("tbody")
|
|
|
|
|
|
|
|
|
|
d.neighbours.forEach( function (d) {
|
2015-03-22 14:08:04 +00:00
|
|
|
|
var tr = document.createElement("tr")
|
|
|
|
|
|
|
|
|
|
var td1 = document.createElement("td")
|
2015-03-22 14:20:18 +00:00
|
|
|
|
var a1 = document.createElement("a")
|
2015-03-22 14:27:33 +00:00
|
|
|
|
a1.classList.add("hostname")
|
2015-03-22 14:20:18 +00:00
|
|
|
|
a1.textContent = d.node.nodeinfo.hostname
|
2015-03-22 14:27:33 +00:00
|
|
|
|
a1.href = "#"
|
2015-03-22 14:20:18 +00:00
|
|
|
|
a1.onclick = gotoAnything.node(d.node)
|
|
|
|
|
td1.appendChild(a1)
|
2015-03-22 14:27:33 +00:00
|
|
|
|
|
2015-03-22 15:25:53 +00:00
|
|
|
|
if (d.link.vpn)
|
|
|
|
|
td1.appendChild(document.createTextNode(" (VPN)"))
|
|
|
|
|
|
2015-03-22 14:27:33 +00:00
|
|
|
|
if (has_location(d.node)) {
|
|
|
|
|
var span = document.createElement("span")
|
|
|
|
|
span.classList.add("icon")
|
|
|
|
|
span.classList.add("ion-location")
|
|
|
|
|
td1.appendChild(span)
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-22 14:08:04 +00:00
|
|
|
|
tr.appendChild(td1)
|
|
|
|
|
|
|
|
|
|
var td2 = document.createElement("td")
|
2015-03-22 14:20:18 +00:00
|
|
|
|
var a2 = document.createElement("a")
|
|
|
|
|
a2.href = "#"
|
|
|
|
|
a2.textContent = showTq(d.link)
|
|
|
|
|
a2.onclick = gotoAnything.link(d.link)
|
|
|
|
|
td2.appendChild(a2)
|
2015-03-22 14:08:04 +00:00
|
|
|
|
tr.appendChild(td2)
|
|
|
|
|
|
|
|
|
|
var td3 = document.createElement("td")
|
2015-03-22 14:20:18 +00:00
|
|
|
|
var a3 = document.createElement("a")
|
|
|
|
|
a3.href = "#"
|
|
|
|
|
a3.textContent = showDistance(d.link)
|
|
|
|
|
a3.onclick = gotoAnything.link(d.link)
|
|
|
|
|
td3.appendChild(a3)
|
2015-03-22 19:38:07 +00:00
|
|
|
|
td3.setAttribute("data-sort", d.link.distance !== undefined ? -d.link.distance : 1)
|
2015-03-22 14:08:04 +00:00
|
|
|
|
tr.appendChild(td3)
|
|
|
|
|
|
2015-03-22 19:23:57 +00:00
|
|
|
|
tbody.appendChild(tr)
|
2015-03-22 14:08:04 +00:00
|
|
|
|
})
|
|
|
|
|
|
2015-03-22 19:23:57 +00:00
|
|
|
|
table.appendChild(tbody)
|
|
|
|
|
|
|
|
|
|
new Tablesort(table)
|
|
|
|
|
|
2015-03-22 14:08:04 +00:00
|
|
|
|
el.appendChild(table)
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-22 10:19:30 +00:00
|
|
|
|
function showFirmware(d) {
|
|
|
|
|
var release = dictGet(d.nodeinfo, ["software", "firmware", "release"])
|
|
|
|
|
var base = dictGet(d.nodeinfo, ["software", "firmware", "base"])
|
|
|
|
|
|
|
|
|
|
if (release === null || base === null)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
return release + " / " + base
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showUptime(d) {
|
|
|
|
|
if (!("uptime" in d.statistics))
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
return moment.duration(d.statistics.uptime, "seconds").humanize()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showFirstseen(d) {
|
|
|
|
|
if (!("firstseen" in d))
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
return d.firstseen.fromNow(true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showClients(d) {
|
|
|
|
|
if (!d.flags.online)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
return function (el) {
|
|
|
|
|
el.appendChild(document.createTextNode(d.statistics.clients > 0 ? d.statistics.clients : "keine"))
|
|
|
|
|
el.appendChild(document.createElement("br"))
|
|
|
|
|
|
|
|
|
|
var span = document.createElement("span")
|
|
|
|
|
span.classList.add("clients")
|
|
|
|
|
span.textContent = " ".repeat(d.statistics.clients)
|
|
|
|
|
el.appendChild(span)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showIPs(d) {
|
|
|
|
|
var ips = dictGet(d.nodeinfo, ["network", "addresses"])
|
|
|
|
|
if (ips === null)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
ips.sort()
|
|
|
|
|
|
|
|
|
|
return function (el) {
|
|
|
|
|
ips.forEach( function (ip, i) {
|
|
|
|
|
var link = !ip.startsWith("fe80:")
|
|
|
|
|
|
|
|
|
|
if (i > 0)
|
|
|
|
|
el.appendChild(document.createElement("br"))
|
|
|
|
|
|
|
|
|
|
if (link) {
|
|
|
|
|
var a = document.createElement("a")
|
|
|
|
|
a.href = "http://[" + ip + "]/"
|
|
|
|
|
a.textContent = ip
|
|
|
|
|
el.appendChild(a)
|
|
|
|
|
} else
|
|
|
|
|
el.appendChild(document.createTextNode(ip))
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showRAM(d) {
|
|
|
|
|
if (!("memory_usage" in d.statistics))
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
return function (el) {
|
|
|
|
|
el.appendChild(showBar("memory-usage", d.statistics.memory_usage))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-22 15:19:16 +00:00
|
|
|
|
function attributeEntry(el, label, value) {
|
|
|
|
|
if (value === null || value == undefined)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
var tr = document.createElement("tr")
|
|
|
|
|
var th = document.createElement("th")
|
|
|
|
|
th.textContent = label
|
|
|
|
|
tr.appendChild(th)
|
|
|
|
|
|
|
|
|
|
var td = document.createElement("td")
|
|
|
|
|
|
|
|
|
|
if (typeof value == "function")
|
|
|
|
|
value(td)
|
|
|
|
|
else
|
|
|
|
|
td.appendChild(document.createTextNode(value))
|
|
|
|
|
|
|
|
|
|
tr.appendChild(td)
|
|
|
|
|
|
|
|
|
|
el.appendChild(tr)
|
|
|
|
|
|
|
|
|
|
return td
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-22 10:19:30 +00:00
|
|
|
|
function showBar(className, v) {
|
|
|
|
|
var span = document.createElement("span")
|
|
|
|
|
span.classList.add("bar")
|
|
|
|
|
span.classList.add(className)
|
|
|
|
|
|
|
|
|
|
var bar = document.createElement("span")
|
|
|
|
|
bar.style.width = (v * 100) + "%"
|
|
|
|
|
span.appendChild(bar)
|
|
|
|
|
|
|
|
|
|
var label = document.createElement("label")
|
|
|
|
|
label.textContent = (Math.round(v * 100)) + " %"
|
|
|
|
|
span.appendChild(label)
|
|
|
|
|
|
|
|
|
|
return span
|
2015-03-21 09:40:58 +00:00
|
|
|
|
}
|
2015-03-21 14:59:25 +00:00
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
function showLinkinfo(config, infobox, gotoAnything, d) {
|
|
|
|
|
var el = infobox.create()
|
2015-03-22 15:19:16 +00:00
|
|
|
|
|
|
|
|
|
var h2 = document.createElement("h2")
|
|
|
|
|
a1 = document.createElement("a")
|
|
|
|
|
a1.href = "#"
|
|
|
|
|
a1.onclick = gotoAnything.node(d.source.node)
|
|
|
|
|
a1.textContent = d.source.node.nodeinfo.hostname
|
|
|
|
|
h2.appendChild(a1)
|
|
|
|
|
h2.appendChild(document.createTextNode(" – "))
|
|
|
|
|
a2 = document.createElement("a")
|
|
|
|
|
a2.href = "#"
|
|
|
|
|
a2.onclick = gotoAnything.node(d.target.node)
|
|
|
|
|
a2.textContent = d.target.node.nodeinfo.hostname
|
|
|
|
|
h2.appendChild(a2)
|
|
|
|
|
el.appendChild(h2)
|
|
|
|
|
|
|
|
|
|
var attributes = document.createElement("table")
|
|
|
|
|
attributes.classList.add("attributes")
|
|
|
|
|
|
|
|
|
|
attributeEntry(attributes, "TQ", showTq(d))
|
|
|
|
|
attributeEntry(attributes, "Entfernung", showDistance(d))
|
2015-03-22 15:25:53 +00:00
|
|
|
|
attributeEntry(attributes, "VPN", d.vpn ? "ja" : "nein")
|
2015-03-22 15:19:16 +00:00
|
|
|
|
|
|
|
|
|
el.appendChild(attributes)
|
2015-03-21 15:51:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-22 12:24:15 +00:00
|
|
|
|
function pushHistory(d) {
|
|
|
|
|
var s = "#!"
|
|
|
|
|
|
|
|
|
|
if (d) {
|
|
|
|
|
if ("node" in d)
|
|
|
|
|
s += "n:" + d.node.nodeinfo.node_id
|
|
|
|
|
|
|
|
|
|
if ("link" in d)
|
|
|
|
|
s += "l:" + linkId(d.link)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.history.pushState(s, undefined, s)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function gotoHistory(gotoAnything, dict, s) {
|
|
|
|
|
if (!s.startsWith("#!"))
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
s = s.slice(2)
|
|
|
|
|
|
|
|
|
|
var args = s.split(":")
|
|
|
|
|
|
|
|
|
|
if (args[0] === "n") {
|
|
|
|
|
var id = args[1]
|
|
|
|
|
|
|
|
|
|
if (id in dict.nodes)
|
|
|
|
|
gotoAnything.node(dict.nodes[id], true, false)()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (args[0] === "l") {
|
|
|
|
|
var id = args[1]
|
|
|
|
|
|
|
|
|
|
if (id in dict.links)
|
|
|
|
|
gotoAnything.link(dict.links[id], true, false)()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
function gotoBuilder(config, infobox, nodes, links) {
|
2015-03-22 11:30:52 +00:00
|
|
|
|
var markers = {}
|
2015-03-22 14:20:18 +00:00
|
|
|
|
var self = this
|
2015-03-22 11:30:52 +00:00
|
|
|
|
|
2015-03-22 12:24:15 +00:00
|
|
|
|
function gotoNode(d, showMap, push) {
|
|
|
|
|
showMap = trueDefault(showMap)
|
|
|
|
|
push = trueDefault(push)
|
2015-03-22 11:30:52 +00:00
|
|
|
|
|
|
|
|
|
if (showMap && d.nodeinfo.node_id in markers)
|
2015-03-21 14:59:25 +00:00
|
|
|
|
markers[d.nodeinfo.node_id]()
|
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
nodes(config, infobox, self, d)
|
2015-03-21 15:32:17 +00:00
|
|
|
|
|
2015-03-22 12:24:15 +00:00
|
|
|
|
if (push)
|
|
|
|
|
pushHistory( { node: d })
|
|
|
|
|
|
2015-03-21 14:59:25 +00:00
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-22 12:24:15 +00:00
|
|
|
|
function gotoLink(d, showMap, push) {
|
|
|
|
|
showMap = trueDefault(showMap)
|
|
|
|
|
push = trueDefault(push)
|
|
|
|
|
|
2015-03-22 11:30:52 +00:00
|
|
|
|
if (showMap && linkId(d) in markers)
|
2015-03-21 14:59:25 +00:00
|
|
|
|
markers[linkId(d)]()
|
|
|
|
|
|
2015-03-23 12:23:12 +00:00
|
|
|
|
links(config, infobox, self, d)
|
2015-03-21 15:51:07 +00:00
|
|
|
|
|
2015-03-22 12:24:15 +00:00
|
|
|
|
if (push)
|
|
|
|
|
pushHistory( { link: d })
|
|
|
|
|
|
2015-03-21 14:59:25 +00:00
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-22 11:30:52 +00:00
|
|
|
|
function addMarkers(d) {
|
|
|
|
|
markers = d
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-22 14:20:18 +00:00
|
|
|
|
this.node = function (d, m, p) { return function () { return gotoNode(d, m, p) }}
|
|
|
|
|
this.link = function (d, m, p) { return function () { return gotoLink(d, m, p) }}
|
|
|
|
|
this.addMarkers = function (d) {
|
|
|
|
|
markers = d
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return this
|
2015-03-21 14:59:25 +00:00
|
|
|
|
}
|