From f354a6fbc73e3356c1a1de4a309a0aa44a286aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20P=C3=A4ssler?= Date: Thu, 18 Feb 2016 16:38:36 +0000 Subject: [PATCH] infobox: handle directional links --- lib/infobox/link.js | 4 ++-- lib/infobox/node.js | 3 +++ lib/main.js | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/infobox/link.js b/lib/infobox/link.js index 109240b..15bff1f 100644 --- a/lib/infobox/link.js +++ b/lib/infobox/link.js @@ -6,7 +6,7 @@ define(function () { a1.onclick = router.node(d.source.node) a1.textContent = d.source.node.nodeinfo.hostname h2.appendChild(a1) - h2.appendChild(document.createTextNode(" – ")) + h2.appendChild(document.createTextNode(" → ")) var a2 = document.createElement("a") a2.href = "#" a2.onclick = router.node(d.target.node) @@ -19,7 +19,7 @@ define(function () { attributeEntry(attributes, "TQ", showTq(d)) attributeEntry(attributes, "Entfernung", showDistance(d)) - attributeEntry(attributes, "VPN", d.vpn ? "ja" : "nein") + attributeEntry(attributes, "VPN", d.vpn ? "ja" : null) var hw1 = dictGet(d.source.node.nodeinfo, ["hardware", "model"]) var hw2 = dictGet(d.target.node.nodeinfo, ["hardware", "model"]) attributeEntry(attributes, "Hardware", (hw1 != null ? hw1 : "unbekannt") + " – " + (hw2 != null ? hw2 : "unbekannt")) diff --git a/lib/infobox/node.js b/lib/infobox/node.js index 2e5b2d6..31415c7 100644 --- a/lib/infobox/node.js +++ b/lib/infobox/node.js @@ -259,10 +259,13 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"], a1.textContent = d.node.nodeinfo.hostname a1.href = "#" a1.onclick = router.node(d.node) + td1.appendChild(document.createTextNode(d.incoming ? " ← " : " → ")) td1.appendChild(a1) if (d.link.vpn) td1.appendChild(document.createTextNode(" (VPN)")) + if (d.link.cable) + td1.appendChild(document.createTextNode(" (Kabel)")) if (has_location(d.node)) { var span = document.createElement("span") diff --git a/lib/main.js b/lib/main.js index e06f000..53953a9 100644 --- a/lib/main.js +++ b/lib/main.js @@ -100,8 +100,8 @@ function (moment, Router, L, GUI, numeral) { }) links.forEach( function (d) { - d.source.node.neighbours.push({ node: d.target.node, link: d }) - d.target.node.neighbours.push({ node: d.source.node, link: d }) + d.source.node.neighbours.push({ node: d.target.node, link: d, incoming: false }) + d.target.node.neighbours.push({ node: d.source.node, link: d, incoming: true }) if (!d.vpn) { d.source.node.meshlinks = d.source.node.meshlinks ? d.source.node.meshlinks + 1 : 1 d.target.node.meshlinks = d.target.node.meshlinks ? d.target.node.meshlinks + 1 : 1