router pics hopglass changes

- don't use display block on the table, instead make the close button
  position absolute
- show the old style heading when no source is defined
- clean up the indention and some small things
This commit is contained in:
Milan Pssler 2016-11-06 00:11:49 +01:00
commit 1641bc2437
5 changed files with 68 additions and 87 deletions

View file

@ -378,15 +378,12 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
return a & a
}, 0)
if (o.thumbnail) {
content = document.createElement("img")
content.id = "routerpicture"
content.classList.add("nodeImg")
content.src = o.thumbnail.replace("{MODELHASH}", modelhash)
content.onerror = function() {
console.log("Router-Bild nicht vorhanden !!! create an issue @ https://github.com/Moorviper/Freifunk-Router-Anleitungen/issues")
document.getElementById("routerpicdiv").outerHTML = "Knotenname"
}
content = document.createElement("img")
content.id = "routerpicture"
content.classList.add("nodeImg")
content.src = o.thumbnail.replace("{MODELHASH}", modelhash)
content.onerror = function() {
document.getElementById("routerpicdiv").outerHTML = "Knotenname"
}
if (o.caption) {
@ -400,7 +397,7 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
p.appendChild(content)
return content
}
}
function showStatImg(o, d) {
var subst = {}
@ -410,44 +407,30 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
}
return function(config, el, router, d) {
var top = document.createElement("div")
top.id = "routerpicdiv"
try {
if (config.hwImg)
config.hwImg.forEach(function(hwImg) {
try {
top.appendChild(showNodeImg(hwImg, d.nodeinfo.hardware.model))
}
catch (err) {
console.log(err.message)
}
})
else
{
var localpic = [] // create fallback-config-data
localpic.push({
thumbnail: "./nodes/{MODELHASH}.svg",
caption: "Knoten {MODELHASH}"
})
localpic.forEach(function(localpic) {
try {
top.appendChild(showNodeImg(localpic, d.nodeinfo.hardware.model))
}
catch (err) {
console.log(err.message)
}
})
}
}
catch (err) {
console.log(err.message)
}
var attributes = document.createElement("table")
attributes.classList.add("attributes")
attributeEntry(attributes, top, d.nodeinfo.hostname)
if (config.hwImg) {
var top = document.createElement("div")
top.id = "routerpicdiv"
try {
config.hwImg.forEach(function(hwImg) {
try {
top.appendChild(showNodeImg(hwImg, d.nodeinfo.hardware.model))
} catch (err) {
console.log(err.message)
}
})
} catch (err) {
console.log(err.message)
}
attributeEntry(attributes, top, d.nodeinfo.hostname)
} else {
var h2 = document.createElement("h2")
h2.textContent = d.nodeinfo.hostname
el.appendChild(h2)
}
attributeEntry(attributes, "Status", showStatus(d))
attributeEntry(attributes, "Gateway", d.flags.gateway ? "ja" : null)
attributeEntry(attributes, "Koordinaten", showGeoURI(d))