2015-04-11 13:48:16 +02:00
|
|
|
|
define(["moment", "numeral", "tablesort", "tablesort.numeric"],
|
|
|
|
|
function (moment, numeral, Tablesort) {
|
|
|
|
|
function showGeoURI(d) {
|
|
|
|
|
function showLatitude(d) {
|
|
|
|
|
var suffix = Math.sign(d) > -1 ? "' N" : "' S"
|
|
|
|
|
d = Math.abs(d)
|
|
|
|
|
var a = Math.floor(d)
|
|
|
|
|
var min = (d * 60) % 60
|
|
|
|
|
a = (a < 10 ? "0" : "") + a
|
|
|
|
|
|
|
|
|
|
return a + "° " + numeral(min).format("0.000") + suffix
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showLongitude(d) {
|
|
|
|
|
var suffix = Math.sign(d) > -1 ? "' E" : "' W"
|
|
|
|
|
d = Math.abs(d)
|
|
|
|
|
var a = Math.floor(d)
|
|
|
|
|
var min = (d * 60) % 60
|
|
|
|
|
a = (a < 100 ? "0" + (a < 10 ? "0" : "") : "") + a
|
|
|
|
|
|
|
|
|
|
return a + "° " + numeral(min).format("0.000") + suffix
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_location(d))
|
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
|
|
return function (el) {
|
|
|
|
|
var latitude = d.nodeinfo.location.latitude
|
|
|
|
|
var longitude = d.nodeinfo.location.longitude
|
|
|
|
|
var a = document.createElement("a")
|
|
|
|
|
a.textContent = showLatitude(latitude) + " " +
|
|
|
|
|
showLongitude(longitude)
|
|
|
|
|
|
|
|
|
|
a.href = "geo:" + latitude + "," + longitude
|
|
|
|
|
el.appendChild(a)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-07 01:00:30 +02:00
|
|
|
|
function showStatus(d) {
|
|
|
|
|
return function (el) {
|
2016-03-05 12:45:14 +01:00
|
|
|
|
el.classList.add(d.flags.unseen ? "unseen" : (d.flags.online ? "online" : "offline"))
|
2016-03-02 22:34:35 +01:00
|
|
|
|
if (d.flags.online)
|
2016-03-05 14:21:33 +01:00
|
|
|
|
el.textContent = "online, letzte Nachricht " + d.lastseen.fromNow() + " (" + d.lastseen.format("DD.MM.YYYY, H:mm:ss") + ")"
|
2016-03-02 22:34:35 +01:00
|
|
|
|
else
|
2016-03-05 14:21:33 +01:00
|
|
|
|
el.textContent = "offline, letzte Nachricht " + d.lastseen.fromNow() + " (" + d.lastseen.format("DD.MM.YYYY, H:mm:ss") + ")"
|
2015-07-07 01:00:30 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-30 03:20:43 +02: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 undefined
|
|
|
|
|
|
|
|
|
|
return release + " / " + base
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 16:28:07 +02:00
|
|
|
|
function showSite(d, config) {
|
|
|
|
|
var site = dictGet(d.nodeinfo, ["system", "site_code"])
|
|
|
|
|
var rt = site
|
|
|
|
|
if (config.siteNames)
|
|
|
|
|
config.siteNames.forEach( function (t) {
|
|
|
|
|
if(site === t.site)
|
|
|
|
|
rt = t.name
|
|
|
|
|
})
|
|
|
|
|
return rt
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-30 03:20:43 +02:00
|
|
|
|
function showUptime(d) {
|
|
|
|
|
if (!("uptime" in d.statistics))
|
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
|
|
return moment.duration(d.statistics.uptime, "seconds").humanize()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showFirstseen(d) {
|
|
|
|
|
if (!("firstseen" in d))
|
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
|
|
return d.firstseen.fromNow(true)
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-08 23:23:56 +02:00
|
|
|
|
function wifiChannelAlias(ch) {
|
|
|
|
|
var chlist = {
|
|
|
|
|
"1": "2412 MHz",
|
|
|
|
|
"2": "2417 MHz",
|
|
|
|
|
"3": "2422 MHz",
|
|
|
|
|
"4": "2427 MHz",
|
|
|
|
|
"5": "2432 MHz",
|
|
|
|
|
"6": "2437 MHz",
|
|
|
|
|
"7": "2442 MHz",
|
|
|
|
|
"8": "2447 MHz",
|
|
|
|
|
"9": "2452 MHz",
|
|
|
|
|
"10": "2457 MHz",
|
|
|
|
|
"11": "2462 MHz",
|
|
|
|
|
"12": "2467 MHz",
|
|
|
|
|
"13": "2472 MHz",
|
|
|
|
|
"36": "5180 MHz (Indoors)",
|
|
|
|
|
"40": "5200 MHz (Indoors)",
|
|
|
|
|
"44": "5220 MHz (Indoors)",
|
|
|
|
|
"48": "5240 MHz (Indoors)",
|
|
|
|
|
"52": "5260 MHz (Indoors/DFS/TPC)",
|
|
|
|
|
"56": "5280 MHz (Indoors/DFS/TPC)",
|
|
|
|
|
"60": "5300 MHz (Indoors/DFS/TPC)",
|
|
|
|
|
"64": "5320 MHz (Indoors/DFS/TPC)",
|
|
|
|
|
"100": "5500 MHz (DFS) !!",
|
|
|
|
|
"104": "5520 MHz (DFS) !!",
|
|
|
|
|
"108": "5540 MHz (DFS) !!",
|
|
|
|
|
"112": "5560 MHz (DFS) !!",
|
|
|
|
|
"116": "5580 MHz (DFS) !!",
|
|
|
|
|
"120": "5600 MHz (DFS) !!",
|
|
|
|
|
"124": "5620 MHz (DFS) !!",
|
|
|
|
|
"128": "5640 MHz (DFS) !!",
|
|
|
|
|
"132": "5660 MHz (DFS) !!",
|
|
|
|
|
"136": "5680 MHz (DFS) !!",
|
|
|
|
|
"140": "5700 MHz (DFS) !!"
|
|
|
|
|
}
|
|
|
|
|
if (!(ch in chlist))
|
|
|
|
|
return ""
|
|
|
|
|
else
|
|
|
|
|
return chlist[ch]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showWifiChannel(ch) {
|
|
|
|
|
if (!ch)
|
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
|
|
return ch + " (" + wifiChannelAlias(ch) + ")"
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-30 03:20:43 +02:00
|
|
|
|
function showClients(d) {
|
|
|
|
|
if (!d.flags.online)
|
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
|
|
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 undefined
|
|
|
|
|
|
|
|
|
|
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")
|
2016-07-23 16:52:49 +02:00
|
|
|
|
if (ip.includes("."))
|
|
|
|
|
a.href = "http://" + ip + "/"
|
|
|
|
|
else
|
|
|
|
|
a.href = "http://[" + ip + "]/"
|
2015-03-30 03:20:43 +02:00
|
|
|
|
a.textContent = ip
|
|
|
|
|
el.appendChild(a)
|
|
|
|
|
} else
|
|
|
|
|
el.appendChild(document.createTextNode(ip))
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-25 14:44:11 +01:00
|
|
|
|
function showLoadBar(className, v) {
|
|
|
|
|
var span = document.createElement("span")
|
|
|
|
|
span.classList.add("bar")
|
|
|
|
|
span.classList.add(className)
|
|
|
|
|
|
|
|
|
|
var bar = document.createElement("span")
|
|
|
|
|
if (v >= 1) {
|
|
|
|
|
bar.style.width = ((v * 100) % 100) + "%"
|
|
|
|
|
bar.style.background = "rgba(255, 50, 50, 0.9)"
|
|
|
|
|
span.style.background = "rgba(255, 50, 50, 0.6)"
|
|
|
|
|
span.appendChild(bar)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bar.style.width = (v * 100) + "%"
|
|
|
|
|
span.appendChild(bar)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var label = document.createElement("label")
|
2016-07-23 16:49:35 +02:00
|
|
|
|
label.textContent = +(Math.round(v + "e+2") + "e-2")
|
2016-02-25 14:44:11 +01:00
|
|
|
|
span.appendChild(label)
|
|
|
|
|
|
|
|
|
|
return span
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-25 21:00:05 +01:00
|
|
|
|
function showLoad(d) {
|
2016-02-25 14:44:11 +01:00
|
|
|
|
if (!("loadavg" in d.statistics))
|
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
|
|
return function (el) {
|
|
|
|
|
el.appendChild(showLoadBar("load-avg", d.statistics.loadavg))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-30 03:20:43 +02:00
|
|
|
|
function showRAM(d) {
|
|
|
|
|
if (!("memory_usage" in d.statistics))
|
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
|
|
return function (el) {
|
|
|
|
|
el.appendChild(showBar("memory-usage", d.statistics.memory_usage))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-08 23:23:56 +02:00
|
|
|
|
function showAirtime(band, val) {
|
|
|
|
|
if (!val)
|
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
|
|
return function (el) {
|
|
|
|
|
el.appendChild(showBar("airtime" + band.toString(), val))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-05 19:47:25 +02:00
|
|
|
|
function createLink(target, router) {
|
|
|
|
|
var link = document.createElement("a")
|
|
|
|
|
if (!target) return link
|
|
|
|
|
var unknown = !(target.node)
|
|
|
|
|
link.classList.add("hostname")
|
|
|
|
|
link.textContent = unknown ? (target.id ? target.id : target) : target.node.nodeinfo.hostname
|
|
|
|
|
if (!unknown) {
|
|
|
|
|
link.href = "#"
|
|
|
|
|
link.onclick = router.node(target.node)
|
|
|
|
|
}
|
|
|
|
|
return link
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showGateway(d, router) {
|
2016-06-08 23:23:56 +02:00
|
|
|
|
var nh
|
|
|
|
|
if (dictGet(d.statistics, ["nexthop"]))
|
|
|
|
|
nh = dictGet(d.statistics, ["nexthop"])
|
|
|
|
|
if (dictGet(d.statistics, ["gateway_nexthop"]))
|
|
|
|
|
nh = dictGet(d.statistics, ["gateway_nexthop"])
|
|
|
|
|
var gw = dictGet(d.statistics, ["gateway"])
|
|
|
|
|
|
2016-08-05 19:47:25 +02:00
|
|
|
|
if (!gw) return null
|
|
|
|
|
return function (el) {
|
|
|
|
|
if (nh) {
|
|
|
|
|
el.appendChild(createLink(nh, router))
|
|
|
|
|
if (gw !== nh)
|
|
|
|
|
el.appendChild(document.createTextNode(" -> ... -> "))
|
|
|
|
|
}
|
|
|
|
|
if (gw !== nh)
|
|
|
|
|
el.appendChild(createLink(gw, router))
|
|
|
|
|
}
|
2016-06-08 23:23:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-25 14:50:40 +01:00
|
|
|
|
function showPages(d) {
|
|
|
|
|
var webpages = dictGet(d.nodeinfo, ["pages"])
|
|
|
|
|
if (webpages === null)
|
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
|
|
webpages.sort()
|
|
|
|
|
|
|
|
|
|
return function (el) {
|
|
|
|
|
webpages.forEach( function (webpage, i) {
|
|
|
|
|
if (i > 0)
|
|
|
|
|
el.appendChild(document.createElement("br"))
|
|
|
|
|
|
|
|
|
|
var a = document.createElement("span")
|
|
|
|
|
var link = document.createElement("a")
|
|
|
|
|
link.href = webpage
|
|
|
|
|
if (webpage.search(/^https:\/\//i) !== -1) {
|
|
|
|
|
var lock = document.createElement("span")
|
|
|
|
|
lock.className = "ion-android-lock"
|
|
|
|
|
a.appendChild(lock)
|
|
|
|
|
var t1 = document.createTextNode(" ")
|
|
|
|
|
a.appendChild(t1)
|
|
|
|
|
link.textContent = webpage.replace(/^https:\/\//i, "")
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
link.textContent = webpage.replace(/^http:\/\//i, "")
|
|
|
|
|
a.appendChild(link)
|
|
|
|
|
el.appendChild(a)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-30 03:20:43 +02:00
|
|
|
|
function showAutoupdate(d) {
|
|
|
|
|
var au = dictGet(d.nodeinfo, ["software", "autoupdater"])
|
|
|
|
|
if (!au)
|
|
|
|
|
return undefined
|
|
|
|
|
|
|
|
|
|
return au.enabled ? "aktiviert (" + au.branch + ")" : "deaktiviert"
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-28 22:58:45 +02:00
|
|
|
|
function showStatImg(o, d) {
|
2016-03-16 20:40:08 +01:00
|
|
|
|
var subst = {}
|
2016-03-28 22:58:45 +02:00
|
|
|
|
subst["{NODE_ID}"] = d.nodeinfo.node_id ? d.nodeinfo.node_id : "unknown"
|
|
|
|
|
subst["{NODE_NAME}"] = d.nodeinfo.hostname ? d.nodeinfo.hostname : "unknown"
|
2016-03-16 20:40:08 +01:00
|
|
|
|
return showStat(o, subst)
|
2015-05-11 22:43:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-25 19:45:21 +01:00
|
|
|
|
return function(config, el, router, d) {
|
2016-07-04 12:45:19 +02:00
|
|
|
|
var h2 = document.createElement("h2")
|
|
|
|
|
h2.textContent = d.nodeinfo.hostname
|
|
|
|
|
el.appendChild(h2)
|
2015-03-25 11:21:09 +01:00
|
|
|
|
|
|
|
|
|
var attributes = document.createElement("table")
|
|
|
|
|
attributes.classList.add("attributes")
|
|
|
|
|
|
2015-07-07 01:00:30 +02:00
|
|
|
|
attributeEntry(attributes, "Status", showStatus(d))
|
2015-11-06 21:10:43 +01:00
|
|
|
|
attributeEntry(attributes, "Gateway", d.flags.gateway ? "ja" : null)
|
2015-04-11 13:48:16 +02:00
|
|
|
|
attributeEntry(attributes, "Koordinaten", showGeoURI(d))
|
2015-03-25 11:21:09 +01:00
|
|
|
|
|
|
|
|
|
if (config.showContact)
|
|
|
|
|
attributeEntry(attributes, "Kontakt", dictGet(d.nodeinfo, ["owner", "contact"]))
|
|
|
|
|
|
|
|
|
|
attributeEntry(attributes, "Hardware", dictGet(d.nodeinfo, ["hardware", "model"]))
|
|
|
|
|
attributeEntry(attributes, "Primäre MAC", dictGet(d.nodeinfo, ["network", "mac"]))
|
2015-04-14 23:52:35 +02:00
|
|
|
|
attributeEntry(attributes, "Node ID", dictGet(d.nodeinfo, ["node_id"]))
|
2015-03-25 11:21:09 +01:00
|
|
|
|
attributeEntry(attributes, "Firmware", showFirmware(d))
|
2015-07-18 16:28:07 +02:00
|
|
|
|
attributeEntry(attributes, "Site", showSite(d, config))
|
2015-03-25 11:21:09 +01:00
|
|
|
|
attributeEntry(attributes, "Uptime", showUptime(d))
|
|
|
|
|
attributeEntry(attributes, "Teil des Netzes", showFirstseen(d))
|
2016-06-08 23:23:56 +02:00
|
|
|
|
attributeEntry(attributes, "Kanal 2.4 GHz", showWifiChannel(dictGet(d.nodeinfo, ["wireless", "chan2"])))
|
|
|
|
|
attributeEntry(attributes, "Kanal 5 GHz", showWifiChannel(dictGet(d.nodeinfo, ["wireless", "chan5"])))
|
|
|
|
|
attributeEntry(attributes, "Airtime 2.4 GHz", showAirtime(2, dictGet(d.statistics, ["wireless", "airtime2"])))
|
|
|
|
|
attributeEntry(attributes, "Airtime 5 GHz", showAirtime(5, dictGet(d.statistics, ["wireless", "airtime5"])))
|
2016-02-25 21:00:05 +01:00
|
|
|
|
attributeEntry(attributes, "Systemlast", showLoad(d))
|
2015-03-25 11:21:09 +01:00
|
|
|
|
attributeEntry(attributes, "Arbeitsspeicher", showRAM(d))
|
|
|
|
|
attributeEntry(attributes, "IP Adressen", showIPs(d))
|
2016-02-25 14:50:40 +01:00
|
|
|
|
attributeEntry(attributes, "Webseite", showPages(d))
|
2016-08-05 19:47:25 +02:00
|
|
|
|
attributeEntry(attributes, "Gewähltes Gateway", showGateway(d, router))
|
2015-03-26 00:44:44 +01:00
|
|
|
|
attributeEntry(attributes, "Autom. Updates", showAutoupdate(d))
|
2015-03-25 11:21:09 +01:00
|
|
|
|
attributeEntry(attributes, "Clients", showClients(d))
|
2015-05-11 22:43:11 +02:00
|
|
|
|
|
2015-05-21 17:57:02 +02:00
|
|
|
|
el.appendChild(attributes)
|
|
|
|
|
|
|
|
|
|
|
2015-05-11 22:43:11 +02:00
|
|
|
|
if (config.nodeInfos)
|
|
|
|
|
config.nodeInfos.forEach( function (nodeInfo) {
|
2015-05-21 17:57:02 +02:00
|
|
|
|
var h4 = document.createElement("h4")
|
|
|
|
|
h4.textContent = nodeInfo.name
|
|
|
|
|
el.appendChild(h4)
|
2016-03-28 22:58:45 +02:00
|
|
|
|
el.appendChild(showStatImg(nodeInfo, d))
|
2015-05-11 22:43:11 +02:00
|
|
|
|
})
|
|
|
|
|
|
2015-03-25 11:21:09 +01:00
|
|
|
|
if (d.neighbours.length > 0) {
|
|
|
|
|
var h3 = document.createElement("h3")
|
2016-02-06 03:39:46 +01:00
|
|
|
|
h3.textContent = "Links (" + d.neighbours.length + ")"
|
2015-03-25 11:21:09 +01:00
|
|
|
|
el.appendChild(h3)
|
|
|
|
|
|
|
|
|
|
var table = document.createElement("table")
|
|
|
|
|
var thead = document.createElement("thead")
|
|
|
|
|
|
|
|
|
|
var tr = document.createElement("tr")
|
|
|
|
|
var th1 = document.createElement("th")
|
2016-02-18 18:42:42 +01:00
|
|
|
|
th1.textContent = " "
|
2015-03-25 11:21:09 +01:00
|
|
|
|
tr.appendChild(th1)
|
|
|
|
|
|
|
|
|
|
var th2 = document.createElement("th")
|
2016-02-18 18:42:42 +01:00
|
|
|
|
th2.textContent = "Knoten"
|
|
|
|
|
th2.classList.add("sort-default")
|
2015-03-25 11:21:09 +01:00
|
|
|
|
tr.appendChild(th2)
|
|
|
|
|
|
|
|
|
|
var th3 = document.createElement("th")
|
2016-02-18 18:42:42 +01:00
|
|
|
|
th3.textContent = "TQ"
|
2015-03-25 11:21:09 +01:00
|
|
|
|
tr.appendChild(th3)
|
|
|
|
|
|
2016-02-18 18:42:42 +01:00
|
|
|
|
var th4 = document.createElement("th")
|
2016-02-18 20:26:05 +01:00
|
|
|
|
th4.textContent = "Typ"
|
2016-02-18 18:42:42 +01:00
|
|
|
|
tr.appendChild(th4)
|
|
|
|
|
|
2016-02-18 20:26:05 +01:00
|
|
|
|
var th5 = document.createElement("th")
|
|
|
|
|
th5.textContent = "Entfernung"
|
|
|
|
|
tr.appendChild(th5)
|
|
|
|
|
|
2015-03-25 11:21:09 +01:00
|
|
|
|
thead.appendChild(tr)
|
|
|
|
|
table.appendChild(thead)
|
|
|
|
|
|
|
|
|
|
var tbody = document.createElement("tbody")
|
|
|
|
|
|
|
|
|
|
d.neighbours.forEach( function (d) {
|
2016-02-27 14:43:27 +01:00
|
|
|
|
var unknown = !(d.node)
|
2015-03-25 11:21:09 +01:00
|
|
|
|
var tr = document.createElement("tr")
|
|
|
|
|
|
|
|
|
|
var td1 = document.createElement("td")
|
2016-02-18 18:42:42 +01:00
|
|
|
|
td1.appendChild(document.createTextNode(d.incoming ? " ← " : " → "))
|
|
|
|
|
tr.appendChild(td1)
|
|
|
|
|
|
|
|
|
|
var td2 = document.createElement("td")
|
2016-08-05 19:47:25 +02:00
|
|
|
|
td2.appendChild(createLink(d, router))
|
2015-03-25 11:21:09 +01:00
|
|
|
|
|
2016-02-27 14:43:27 +01:00
|
|
|
|
if (!unknown && has_location(d.node)) {
|
2015-03-25 11:21:09 +01:00
|
|
|
|
var span = document.createElement("span")
|
|
|
|
|
span.classList.add("icon")
|
|
|
|
|
span.classList.add("ion-location")
|
2016-02-18 18:42:42 +01:00
|
|
|
|
td2.appendChild(span)
|
2015-03-25 11:21:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-18 18:42:42 +01:00
|
|
|
|
tr.appendChild(td2)
|
2015-03-25 11:21:09 +01:00
|
|
|
|
|
2016-02-18 18:42:42 +01:00
|
|
|
|
var td3 = document.createElement("td")
|
2015-03-25 11:21:09 +01:00
|
|
|
|
var a2 = document.createElement("a")
|
|
|
|
|
a2.href = "#"
|
|
|
|
|
a2.textContent = showTq(d.link)
|
2015-03-25 19:45:21 +01:00
|
|
|
|
a2.onclick = router.link(d.link)
|
2016-02-18 18:42:42 +01:00
|
|
|
|
td3.appendChild(a2)
|
|
|
|
|
tr.appendChild(td3)
|
2015-03-25 11:21:09 +01:00
|
|
|
|
|
2016-02-18 18:42:42 +01:00
|
|
|
|
var td4 = document.createElement("td")
|
2015-03-25 11:21:09 +01:00
|
|
|
|
var a3 = document.createElement("a")
|
|
|
|
|
a3.href = "#"
|
2016-02-18 20:26:05 +01:00
|
|
|
|
a3.textContent = d.link.type
|
2015-03-25 19:45:21 +01:00
|
|
|
|
a3.onclick = router.link(d.link)
|
2016-02-18 18:42:42 +01:00
|
|
|
|
td4.appendChild(a3)
|
|
|
|
|
tr.appendChild(td4)
|
2015-03-25 11:21:09 +01:00
|
|
|
|
|
2016-02-18 20:26:05 +01:00
|
|
|
|
var td5 = document.createElement("td")
|
|
|
|
|
var a4 = document.createElement("a")
|
|
|
|
|
a4.href = "#"
|
|
|
|
|
a4.textContent = showDistance(d.link)
|
|
|
|
|
a4.onclick = router.link(d.link)
|
|
|
|
|
td5.appendChild(a4)
|
|
|
|
|
td5.setAttribute("data-sort", d.link.distance !== undefined ? -d.link.distance : 1)
|
|
|
|
|
tr.appendChild(td5)
|
|
|
|
|
|
2015-03-25 11:21:09 +01:00
|
|
|
|
tbody.appendChild(tr)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
table.appendChild(tbody)
|
2016-02-18 20:26:05 +01:00
|
|
|
|
table.className = "node-links"
|
2015-03-25 11:21:09 +01:00
|
|
|
|
|
|
|
|
|
new Tablesort(table)
|
|
|
|
|
|
|
|
|
|
el.appendChild(table)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|