link.js 1.2 KB

123456789101112131415161718192021222324252627282930
  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. attributeEntry(attributes, "Wireless Backbone", d.backbone ? "ja" : "nein")
  22. var hw1 = dictGet(d.source.node.nodeinfo, ["hardware", "model"])
  23. var hw2 = dictGet(d.target.node.nodeinfo, ["hardware", "model"])
  24. attributeEntry(attributes, "Hardware", (hw1 != null ? hw1 : "unbekannt") + " – " + (hw2 != null ? hw2 : "unbekannt"))
  25. el.appendChild(attributes)
  26. }
  27. })