From e385ac73ad7eb08e2f976d819b84041f36f75cb9 Mon Sep 17 00:00:00 2001 From: Moorviper Date: Thu, 25 Feb 2016 14:50:40 +0100 Subject: [PATCH] INFOBOX - add maybe annouced weblink to sitebar Add annouced Weblinks to Webpages/Services As example alias.json "pages": [ "https://kuechenfunk.fffd" ] How it looks like : http://picpaste.com/pics/Bildschirmfoto_2016-02-25_um_14.49.33-GV9DnX33.1456408206.png --- lib/infobox/node.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/infobox/node.js b/lib/infobox/node.js index fa34b0f..b1af9a9 100644 --- a/lib/infobox/node.js +++ b/lib/infobox/node.js @@ -177,6 +177,37 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"], } } + function showPages(d) { + var webpages = dictGet(d.nodeinfo, ["pages"]) + if (webpages === null) + return undefined + + webpages.sort() + + return function (el) { + webpages.forEach( function (webpage, i) { + if (i > 0) + el.appendChild(document.createElement("br")) + + var a = document.createElement("span") + var link = document.createElement("a") + link.href = webpage + if (webpage.search(/^https:\/\//i) !== -1) { + 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, "") + } + else + link.textContent = webpage.replace(/^http:\/\//i, "") + a.appendChild(link) + el.appendChild(a) + }) + } + } + function showAutoupdate(d) { var au = dictGet(d.nodeinfo, ["software", "autoupdater"]) if (!au) @@ -243,6 +274,7 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"], attributeEntry(attributes, "Load - avg", 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))