2015-04-11 11:48:16 +00:00
|
|
|
|
define(["moment", "numeral", "tablesort", "tablesort.numeric"],
|
|
|
|
|
function (moment, numeral, Tablesort) {
|
|
|
|
|
function showGeoURI(d) {
|
|
|
|
|
function showLatitude(d) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
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;
|
2015-04-11 11:48:16 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return a + "° " + numeral(min).format("0.000") + suffix;
|
2015-04-11 11:48:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showLongitude(d) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
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;
|
2015-04-11 11:48:16 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return a + "° " + numeral(min).format("0.000") + suffix;
|
2015-04-11 11:48:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!has_location(d))
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return undefined;
|
2015-04-11 11:48:16 +00:00
|
|
|
|
|
|
|
|
|
return function (el) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var latitude = d.nodeinfo.location.latitude;
|
|
|
|
|
var longitude = d.nodeinfo.location.longitude;
|
|
|
|
|
var a = document.createElement("a");
|
2015-04-11 11:48:16 +00:00
|
|
|
|
a.textContent = showLatitude(latitude) + " " +
|
2016-05-22 11:23:43 +00:00
|
|
|
|
showLongitude(longitude);
|
2015-04-11 11:48:16 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
a.href = "geo:" + latitude + "," + longitude;
|
|
|
|
|
el.appendChild(a);
|
|
|
|
|
};
|
2015-04-11 11:48:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-06 23:00:30 +00:00
|
|
|
|
function showStatus(d) {
|
|
|
|
|
return function (el) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
el.classList.add(d.flags.unseen ? "unseen" : (d.flags.online ? "online" : "offline"));
|
2016-03-02 21:34:35 +00:00
|
|
|
|
if (d.flags.online)
|
2016-05-22 11:23:43 +00:00
|
|
|
|
el.textContent = "online, letzte Nachricht " + d.lastseen.fromNow() + " (" + d.lastseen.format("DD.MM.YYYY, H:mm:ss") + ")";
|
2016-03-02 21:34:35 +00:00
|
|
|
|
else
|
2016-05-22 11:23:43 +00:00
|
|
|
|
el.textContent = "offline, letzte Nachricht " + d.lastseen.fromNow() + " (" + d.lastseen.format("DD.MM.YYYY, H:mm:ss") + ")";
|
|
|
|
|
};
|
2015-07-06 23:00:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-30 01:20:43 +00:00
|
|
|
|
function showFirmware(d) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var release = dictGet(d.nodeinfo, ["software", "firmware", "release"]);
|
|
|
|
|
var base = dictGet(d.nodeinfo, ["software", "firmware", "base"]);
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
|
|
|
|
if (release === null || base === null)
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return undefined;
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return release + " / " + base;
|
2015-03-30 01:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 14:28:07 +00:00
|
|
|
|
function showSite(d, config) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var site = dictGet(d.nodeinfo, ["system", "site_code"]);
|
|
|
|
|
var rt = site;
|
2015-07-18 14:28:07 +00:00
|
|
|
|
if (config.siteNames)
|
|
|
|
|
config.siteNames.forEach( function (t) {
|
|
|
|
|
if(site === t.site)
|
2016-05-22 11:23:43 +00:00
|
|
|
|
rt = t.name;
|
|
|
|
|
});
|
|
|
|
|
return rt;
|
2015-07-18 14:28:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-30 01:20:43 +00:00
|
|
|
|
function showUptime(d) {
|
|
|
|
|
if (!("uptime" in d.statistics))
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return undefined;
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return moment.duration(d.statistics.uptime, "seconds").humanize();
|
2015-03-30 01:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showFirstseen(d) {
|
|
|
|
|
if (!("firstseen" in d))
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return undefined;
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return d.firstseen.fromNow(true);
|
2015-03-30 01:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showClients(d) {
|
|
|
|
|
if (!d.flags.online)
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return undefined;
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
|
|
|
|
return function (el) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
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);
|
|
|
|
|
};
|
2015-03-30 01:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showIPs(d) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var ips = dictGet(d.nodeinfo, ["network", "addresses"]);
|
2015-03-30 01:20:43 +00:00
|
|
|
|
if (ips === null)
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return undefined;
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
ips.sort();
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
|
|
|
|
return function (el) {
|
|
|
|
|
ips.forEach( function (ip, i) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var link = !ip.startsWith("fe80:");
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
|
|
|
|
if (i > 0)
|
2016-05-22 11:23:43 +00:00
|
|
|
|
el.appendChild(document.createElement("br"));
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
|
|
|
|
if (link) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var a = document.createElement("a");
|
|
|
|
|
a.href = "http://[" + ip + "]/";
|
|
|
|
|
a.textContent = ip;
|
|
|
|
|
el.appendChild(a);
|
2015-03-30 01:20:43 +00:00
|
|
|
|
} else
|
2016-05-22 11:23:43 +00:00
|
|
|
|
el.appendChild(document.createTextNode(ip));
|
|
|
|
|
});
|
|
|
|
|
};
|
2015-03-30 01:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showBar(className, v) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var span = document.createElement("span");
|
|
|
|
|
span.classList.add("bar");
|
|
|
|
|
span.classList.add(className);
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var bar = document.createElement("span");
|
|
|
|
|
bar.style.width = (v * 100) + "%";
|
|
|
|
|
span.appendChild(bar);
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var label = document.createElement("label");
|
|
|
|
|
label.textContent = (Math.round(v * 100)) + " %";
|
|
|
|
|
span.appendChild(label);
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return span;
|
2015-03-30 01:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-25 13:44:11 +00:00
|
|
|
|
function showLoadBar(className, v) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var span = document.createElement("span");
|
|
|
|
|
span.classList.add("bar");
|
|
|
|
|
span.classList.add(className);
|
2016-02-25 13:44:11 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var bar = document.createElement("span");
|
2016-02-25 13:44:11 +00:00
|
|
|
|
if (v >= 1) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
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);
|
2016-02-25 13:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2016-05-22 11:23:43 +00:00
|
|
|
|
bar.style.width = (v * 100) + "%";
|
|
|
|
|
span.appendChild(bar);
|
2016-02-25 13:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var label = document.createElement("label");
|
|
|
|
|
label.textContent = (v);
|
|
|
|
|
span.appendChild(label);
|
2016-02-25 13:44:11 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return span;
|
2016-02-25 13:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-25 20:00:05 +00:00
|
|
|
|
function showLoad(d) {
|
2016-02-25 13:44:11 +00:00
|
|
|
|
if (!("loadavg" in d.statistics))
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return undefined;
|
2016-02-25 13:44:11 +00:00
|
|
|
|
|
|
|
|
|
return function (el) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
el.appendChild(showLoadBar("load-avg", d.statistics.loadavg));
|
|
|
|
|
};
|
2016-02-25 13:44:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-30 01:20:43 +00:00
|
|
|
|
function showRAM(d) {
|
|
|
|
|
if (!("memory_usage" in d.statistics))
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return undefined;
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
|
|
|
|
return function (el) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
el.appendChild(showBar("memory-usage", d.statistics.memory_usage));
|
|
|
|
|
};
|
2015-03-30 01:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-25 13:50:40 +00:00
|
|
|
|
function showPages(d) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var webpages = dictGet(d.nodeinfo, ["pages"]);
|
2016-02-25 13:50:40 +00:00
|
|
|
|
if (webpages === null)
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return undefined;
|
2016-02-25 13:50:40 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
webpages.sort();
|
2016-02-25 13:50:40 +00:00
|
|
|
|
|
|
|
|
|
return function (el) {
|
|
|
|
|
webpages.forEach( function (webpage, i) {
|
|
|
|
|
if (i > 0)
|
2016-05-22 11:23:43 +00:00
|
|
|
|
el.appendChild(document.createElement("br"));
|
2016-02-25 13:50:40 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var a = document.createElement("span");
|
|
|
|
|
var link = document.createElement("a");
|
|
|
|
|
link.href = webpage;
|
2016-02-25 13:50:40 +00:00
|
|
|
|
if (webpage.search(/^https:\/\//i) !== -1) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
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, "");
|
2016-02-25 13:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2016-05-22 11:23:43 +00:00
|
|
|
|
link.textContent = webpage.replace(/^http:\/\//i, "");
|
|
|
|
|
a.appendChild(link);
|
|
|
|
|
el.appendChild(a);
|
|
|
|
|
});
|
|
|
|
|
};
|
2016-02-25 13:50:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-30 01:20:43 +00:00
|
|
|
|
function showAutoupdate(d) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var au = dictGet(d.nodeinfo, ["software", "autoupdater"]);
|
2015-03-30 01:20:43 +00:00
|
|
|
|
if (!au)
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return undefined;
|
2015-03-30 01:20:43 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
return au.enabled ? "aktiviert (" + au.branch + ")" : "deaktiviert";
|
2015-03-30 01:20:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-28 20:58:45 +00:00
|
|
|
|
function showStatImg(o, d) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var subst = {};
|
|
|
|
|
subst["{NODE_ID}"] = d.nodeinfo.node_id ? d.nodeinfo.node_id : "unknown";
|
|
|
|
|
subst["{NODE_NAME}"] = d.nodeinfo.hostname ? d.nodeinfo.hostname : "unknown";
|
|
|
|
|
return showStat(o, subst);
|
2015-05-11 20:43:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-25 18:45:21 +00:00
|
|
|
|
return function(config, el, router, d) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var h2 = document.createElement("h2");
|
|
|
|
|
h2.textContent = d.nodeinfo.hostname;
|
|
|
|
|
el.appendChild(h2);
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var attributes = document.createElement("table");
|
|
|
|
|
attributes.classList.add("attributes");
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
attributeEntry(attributes, "Status", showStatus(d));
|
|
|
|
|
attributeEntry(attributes, "Gateway", d.flags.gateway ? "ja" : null);
|
|
|
|
|
attributeEntry(attributes, "Koordinaten", showGeoURI(d));
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
|
|
|
|
if (config.showContact)
|
2016-05-22 11:23:43 +00:00
|
|
|
|
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"]));
|
|
|
|
|
attributeEntry(attributes, "Node ID", dictGet(d.nodeinfo, ["node_id"]));
|
|
|
|
|
attributeEntry(attributes, "Firmware", showFirmware(d));
|
|
|
|
|
attributeEntry(attributes, "Site", showSite(d, config));
|
|
|
|
|
attributeEntry(attributes, "Uptime", showUptime(d));
|
|
|
|
|
attributeEntry(attributes, "Teil des Netzes", showFirstseen(d));
|
|
|
|
|
attributeEntry(attributes, "Systemlast", showLoad(d));
|
|
|
|
|
attributeEntry(attributes, "Arbeitsspeicher", showRAM(d));
|
|
|
|
|
attributeEntry(attributes, "IP Adressen", showIPs(d));
|
|
|
|
|
attributeEntry(attributes, "Webseite", showPages(d));
|
|
|
|
|
attributeEntry(attributes, "Gewähltes Gateway", dictGet(d.statistics, ["gateway"]));
|
|
|
|
|
attributeEntry(attributes, "Autom. Updates", showAutoupdate(d));
|
|
|
|
|
attributeEntry(attributes, "Clients", showClients(d));
|
|
|
|
|
|
|
|
|
|
el.appendChild(attributes);
|
2015-05-21 15:57:02 +00:00
|
|
|
|
|
|
|
|
|
|
2015-05-11 20:43:11 +00:00
|
|
|
|
if (config.nodeInfos)
|
|
|
|
|
config.nodeInfos.forEach( function (nodeInfo) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var h4 = document.createElement("h4");
|
|
|
|
|
h4.textContent = nodeInfo.name;
|
|
|
|
|
el.appendChild(h4);
|
|
|
|
|
el.appendChild(showStatImg(nodeInfo, d));
|
|
|
|
|
});
|
2015-05-11 20:43:11 +00:00
|
|
|
|
|
2015-03-25 10:21:09 +00:00
|
|
|
|
if (d.neighbours.length > 0) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var h3 = document.createElement("h3");
|
|
|
|
|
h3.textContent = "Links (" + d.neighbours.length + ")";
|
|
|
|
|
el.appendChild(h3);
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var table = document.createElement("table");
|
|
|
|
|
var thead = document.createElement("thead");
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var tr = document.createElement("tr");
|
|
|
|
|
var th1 = document.createElement("th");
|
|
|
|
|
th1.textContent = " ";
|
|
|
|
|
tr.appendChild(th1);
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var th2 = document.createElement("th");
|
|
|
|
|
th2.textContent = "Knoten";
|
|
|
|
|
th2.classList.add("sort-default");
|
|
|
|
|
tr.appendChild(th2);
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var th3 = document.createElement("th");
|
|
|
|
|
th3.textContent = "TQ";
|
|
|
|
|
tr.appendChild(th3);
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var th4 = document.createElement("th");
|
|
|
|
|
th4.textContent = "Typ";
|
|
|
|
|
tr.appendChild(th4);
|
2016-02-18 17:42:42 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var th5 = document.createElement("th");
|
|
|
|
|
th5.textContent = "Entfernung";
|
|
|
|
|
tr.appendChild(th5);
|
2016-02-18 19:26:05 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
thead.appendChild(tr);
|
|
|
|
|
table.appendChild(thead);
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var tbody = document.createElement("tbody");
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
|
|
|
|
d.neighbours.forEach( function (d) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var unknown = !(d.node);
|
|
|
|
|
var tr = document.createElement("tr");
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var td1 = document.createElement("td");
|
|
|
|
|
td1.appendChild(document.createTextNode(d.incoming ? " ← " : " → "));
|
|
|
|
|
tr.appendChild(td1);
|
2016-02-18 17:42:42 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var td2 = document.createElement("td");
|
|
|
|
|
var a1 = document.createElement("a");
|
|
|
|
|
a1.classList.add("hostname");
|
|
|
|
|
a1.textContent = unknown ? d.id : d.node.nodeinfo.hostname;
|
2016-02-27 13:43:27 +00:00
|
|
|
|
if (!unknown)
|
2016-05-22 11:23:43 +00:00
|
|
|
|
a1.href = "#";
|
|
|
|
|
a1.onclick = router.node(d.node);
|
|
|
|
|
td2.appendChild(a1);
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-02-27 13:43:27 +00:00
|
|
|
|
if (!unknown && has_location(d.node)) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var span = document.createElement("span");
|
|
|
|
|
span.classList.add("icon");
|
|
|
|
|
span.classList.add("ion-location");
|
|
|
|
|
td2.appendChild(span);
|
2015-03-25 10:21:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
tr.appendChild(td2);
|
|
|
|
|
|
|
|
|
|
var td3 = document.createElement("td");
|
|
|
|
|
var a2 = document.createElement("a");
|
|
|
|
|
a2.href = "#";
|
|
|
|
|
a2.textContent = showTq(d.link);
|
|
|
|
|
a2.onclick = router.link(d.link);
|
|
|
|
|
td3.appendChild(a2);
|
|
|
|
|
tr.appendChild(td3);
|
|
|
|
|
|
|
|
|
|
var td4 = document.createElement("td");
|
|
|
|
|
var a3 = document.createElement("a");
|
|
|
|
|
a3.href = "#";
|
|
|
|
|
a3.textContent = d.link.type;
|
|
|
|
|
a3.onclick = router.link(d.link);
|
|
|
|
|
td4.appendChild(a3);
|
|
|
|
|
tr.appendChild(td4);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
tbody.appendChild(tr);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
table.appendChild(tbody);
|
|
|
|
|
table.className = "node-links";
|
|
|
|
|
|
|
|
|
|
new Tablesort(table);
|
|
|
|
|
|
|
|
|
|
el.appendChild(table);
|
2015-03-25 10:21:09 +00:00
|
|
|
|
}
|
2016-05-22 11:23:43 +00:00
|
|
|
|
};
|
|
|
|
|
});
|