show all links

This commit is contained in:
Nils Schneider 2015-03-22 19:43:28 +01:00
parent 7ba16bb1c4
commit 7290e6c3e7
3 changed files with 11 additions and 13 deletions

View file

@ -1,5 +1,4 @@
{
"dataPath": "https://map.luebeck.freifunk.net/data/",
"longLinkPercentile": 0.1,
"showContact": true
}
}

View file

@ -259,9 +259,9 @@
</tbody>
</table>
<h2>Längste Verbindungen</h2>
<h2>Verbindungen</h2>
<table>
<tbody id="longlinks">
<tbody id="links">
</tbody>
</table>
</div>

View file

@ -149,13 +149,9 @@ function handle_data(config, map) {
d.distance = d.latlngs[0].distanceTo(d.latlngs[1])
})
longlinks = graph.slice().filter( function (d) {
return "distance" in d
}).sort( function (a, b) {
return a.distance - b.distance
}).reverse().slice(0, Math.ceil(config.longLinkPercentile * graph.filter( function (d) {
return "distance" in d
}).length))
var links = graph.slice().sort( function (a, b) {
return (a.distance !== undefined ? a.distance : -1) - (b.distance !== undefined ? b.distance : -1)
}).reverse()
nodes.forEach( function (d) {
d.neighbours = []
@ -174,7 +170,7 @@ function handle_data(config, map) {
addToList(document.getElementById("newnodes"), config.showContact, "firstseen", gotoAnything.node, newnodes)
addToList(document.getElementById("lostnodes"), config.showContact, "lastseen", gotoAnything.node, lostnodes)
addToLongLinksList(document.getElementById("longlinks"), gotoAnything.link, longlinks)
addToLinksList(document.getElementById("links"), gotoAnything.link, links)
showMeshstats(document.getElementById("meshstats"), nodes)
@ -333,7 +329,7 @@ function addLinksToMap(map, graph, gotoAnything) {
return markersDict
}
function addToLongLinksList(el, gotoProxy, links) {
function addToLinksList(el, gotoProxy, links) {
links.forEach( function (d) {
var row = document.createElement("tr")
var td1 = document.createElement("td")
@ -344,6 +340,9 @@ function addToLongLinksList(el, gotoProxy, links) {
td1.appendChild(a)
row.appendChild(td1)
if (d.vpn)
td1.appendChild(document.createTextNode(" (VPN)"))
var td2 = document.createElement("td")
td2.textContent = showTq(d)
row.appendChild(td2)