link.js 1.1 KB

1234567891011121314151617181920212223242526272829
  1. define(function () {
  2. return function (config, el, router, d) {
  3. var h2 = document.createElement("h2")
  4. var a1 = document.createElement("a")
  5. a1.href = "#"
  6. a1.onclick = router.node(d.source.node)
  7. a1.textContent = d.source.node.nodeinfo.hostname
  8. h2.appendChild(a1)
  9. h2.appendChild(document.createTextNode(" – "))
  10. var a2 = document.createElement("a")
  11. a2.href = "#"
  12. a2.onclick = router.node(d.target.node)
  13. a2.textContent = d.target.node.nodeinfo.hostname
  14. h2.appendChild(a2)
  15. el.appendChild(h2)
  16. var attributes = document.createElement("table")
  17. attributes.classList.add("attributes")
  18. attributeEntry(attributes, "TQ", showTq(d))
  19. attributeEntry(attributes, "Entfernung", showDistance(d))
  20. attributeEntry(attributes, "VPN", d.vpn ? "ja" : "nein")
  21. var hw1 = dictGet(d.source.node.nodeinfo, ["hardware", "model"])
  22. var hw2 = dictGet(d.target.node.nodeinfo, ["hardware", "model"])
  23. attributeEntry(attributes, "Hardware", (hw1 != null ? hw1 : "unbekannt") + " – " + (hw2 != null ? hw2 : "unbekannt"))
  24. el.appendChild(attributes)
  25. }
  26. })