hopglass/lib/infobox/link.js

27 lines
849 B
JavaScript
Raw Normal View History

2015-03-25 11:21:09 +01:00
define(function () {
2015-03-25 19:45:21 +01:00
return function (config, el, router, d) {
2015-03-25 11:21:09 +01:00
var h2 = document.createElement("h2")
2015-03-30 03:20:43 +02:00
var a1 = document.createElement("a")
2015-03-25 11:21:09 +01:00
a1.href = "#"
2015-03-25 19:45:21 +01:00
a1.onclick = router.node(d.source.node)
2015-03-25 11:21:09 +01:00
a1.textContent = d.source.node.nodeinfo.hostname
h2.appendChild(a1)
h2.appendChild(document.createTextNode(" "))
2015-03-30 03:20:43 +02:00
var a2 = document.createElement("a")
2015-03-25 11:21:09 +01:00
a2.href = "#"
2015-03-25 19:45:21 +01:00
a2.onclick = router.node(d.target.node)
2015-03-25 11:21:09 +01:00
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))
attributeEntry(attributes, "VPN", d.vpn ? "ja" : "nein")
el.appendChild(attributes)
}
})