[!!!][TASK] Refactor Scss, add Sass-lint and adjust styling
Add variables to allow easy modifications to color, font and also extending Style
This commit is contained in:
parent
6175d6bb7a
commit
ed06ff6b09
50 changed files with 762 additions and 888 deletions
3
.sass-lint.yml
Normal file
3
.sass-lint.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
rules:
|
||||
no-color-literals: 0
|
||||
single-line-per-selector: 0
|
||||
|
|
@ -4,7 +4,7 @@ module.exports = function (grunt) {
|
|||
grunt.loadTasks("tasks");
|
||||
|
||||
grunt.registerTask("default", ["bower-install-simple", "lint", "copy", "sass", "postcss", "requirejs:default", "inline"]);
|
||||
grunt.registerTask("lint", ["eslint"]);
|
||||
grunt.registerTask("lint", ["sasslint", "eslint"]);
|
||||
grunt.registerTask("dev", ["bower-install-simple", "lint", "copy", "sass", "requirejs:dev"]);
|
||||
grunt.registerTask("serve", ["dev", "connect:server", "watch"]);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -54,6 +54,11 @@ Use `grunt serve` for development.
|
|||
|
||||
Copy `config.json.example` to `build/config.json` and change it to match your community.
|
||||
|
||||
|
||||
## Customize style
|
||||
|
||||
Start your development and edit files in `scss/custom/`. Additional information in comments.
|
||||
|
||||
## dataPath (string/array)
|
||||
|
||||
`dataPath` can be either a string containing the address of a [HopGlass Server](https://github.com/plumpudding/hopglass-server) or an array containing multiple addresses.
|
||||
|
|
|
|||
7
assets/icons/_icon-mixin.scss
Normal file
7
assets/icons/_icon-mixin.scss
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@mixin icon($name, $code, $prefix: 'ion-') {
|
||||
.#{$prefix}#{$name} {
|
||||
&:before {
|
||||
content: '#{$code}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
@font-face {
|
||||
font-family: "Ionicons";
|
||||
src: url("fonts/icon.woff2") format("woff2"),
|
||||
url("fonts/icon.woff") format("woff"),
|
||||
url("fonts/icon.ttf") format("truetype");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
[class^="ion-"]:before,
|
||||
[class*=" ion-"]:before, .ion-inside {
|
||||
display: inline-block;
|
||||
font-family: "ionicons" !important;
|
||||
speak: none;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
text-rendering: auto;
|
||||
line-height: 1;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.ion-android-add:before {
|
||||
content: "\f2c7";
|
||||
}
|
||||
|
||||
.ion-chevron-left:before {
|
||||
content: "\f124";
|
||||
}
|
||||
|
||||
.ion-chevron-right:before {
|
||||
content: "\f125";
|
||||
}
|
||||
|
||||
.ion-pin:before {
|
||||
content: "\f3a3";
|
||||
}
|
||||
|
||||
.ion-wifi:before {
|
||||
content: "\f25c";
|
||||
}
|
||||
|
||||
.ion-eye:before {
|
||||
content: "\f133";
|
||||
}
|
||||
|
||||
.ion-ios-arrow-thin-left:before {
|
||||
content: "\f3d5";
|
||||
}
|
||||
|
||||
.ion-ios-arrow-thin-right:before {
|
||||
content: "\f3d6";
|
||||
}
|
||||
|
||||
.ion-arrow-up-b:before {
|
||||
content: "\f10d";
|
||||
}
|
||||
|
||||
.ion-arrow-down-b:before {
|
||||
content: "\f104";
|
||||
}
|
||||
|
||||
.ion-android-locate:before {
|
||||
content: "\f2e9";
|
||||
}
|
||||
|
||||
.ion-android-close:before {
|
||||
content: "\f2d7";
|
||||
}
|
||||
|
||||
.ion-android-lock:before {
|
||||
content: "\f392";
|
||||
}
|
||||
|
||||
.ion-ios-copy:before {
|
||||
content: "\f41c";
|
||||
}
|
||||
|
||||
.ion-location:before {
|
||||
content: "\f456";
|
||||
}
|
||||
|
||||
.ion-android-remove:before {
|
||||
content: "\f2f4";
|
||||
}
|
||||
|
||||
.ion-ios-person:before {
|
||||
content: "\f47e";
|
||||
}
|
||||
|
||||
.ion-layer:before {
|
||||
content: "\f229";
|
||||
}
|
||||
45
assets/icons/icon.scss
Normal file
45
assets/icons/icon.scss
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// Needed for standalone scss
|
||||
// @import 'icon-mixin';
|
||||
|
||||
@font-face {
|
||||
font-family: 'ionicons';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: url('fonts/icon.woff2') format('woff2'),
|
||||
url('fonts/icon.woff') format('woff'),
|
||||
url('fonts/icon.ttf') format('truetype');
|
||||
}
|
||||
|
||||
[class^='ion-'], [class*=' ion-'] {
|
||||
&:before {
|
||||
display: inline-block;
|
||||
font-family: $font-family-icons;
|
||||
font-style: normal;
|
||||
font-variant: normal;
|
||||
font-weight: normal;
|
||||
line-height: 1;
|
||||
speak: none;
|
||||
text-rendering: auto;
|
||||
text-transform: none;
|
||||
vertical-align: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@include icon('android-add', '\f2c7');
|
||||
@include icon('chevron-left', '\f124');
|
||||
@include icon('chevron-right', '\f125');
|
||||
@include icon('pin', '\f3a3');
|
||||
@include icon('wifi', '\f25c');
|
||||
@include icon('eye', '\f133');
|
||||
@include icon('ios-arrow-thin-left', '\f3d5');
|
||||
@include icon('ios-arrow-thin-right', '\f3d6');
|
||||
@include icon('arrow-up-b', '\f10d');
|
||||
@include icon('arrow-down-b', '\f104');
|
||||
@include icon('android-locate', '\f2e9');
|
||||
@include icon('android-close', '\f2d7');
|
||||
@include icon('android-lock', '\f392');
|
||||
@include icon('ios-copy', '\f41c');
|
||||
@include icon('location', '\f456');
|
||||
@include icon('android-remove', '\f2f4');
|
||||
@include icon('ios-person', '\f47e');
|
||||
@include icon('layer', '\f229');
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||
<link rel="stylesheet" href="hopglass-icons.css?__inline=true">
|
||||
<link rel="stylesheet" href="roboto-slab-fontface.css">
|
||||
<link rel="stylesheet" href="roboto-fontface.css">
|
||||
<link rel="stylesheet" href="style.css?__inline=true">
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ define(function () {
|
|||
|
||||
return function () {
|
||||
this.render = function (d) {
|
||||
var el = document.createElement("div");
|
||||
d.appendChild(el);
|
||||
var s = "<h2>Über HopGlass</h2>";
|
||||
|
||||
s += "<p>Mit Doppelklick und Shift+Doppelklick kann man in der Karte ";
|
||||
|
|
@ -34,7 +32,7 @@ define(function () {
|
|||
s += "<a href=\"https://github.com/plumpudding/hopglass\">";
|
||||
s += "https://github.com/plumpudding/hopglass</a>.";
|
||||
|
||||
el.innerHTML = s;
|
||||
d.innerHTML = s;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,13 +17,11 @@ define(function () {
|
|||
|
||||
filters.forEach(function (d) {
|
||||
var li = document.createElement("li");
|
||||
var div = document.createElement("div");
|
||||
container.appendChild(li);
|
||||
li.appendChild(div);
|
||||
d.render(div);
|
||||
d.render(li);
|
||||
|
||||
var button = document.createElement("button");
|
||||
button.textContent = "";
|
||||
button.classList.add("ion-android-close");
|
||||
button.onclick = function () {
|
||||
distributor.removeFilter(d);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ define(["helper"], function (helper) {
|
|||
|
||||
var label = document.createElement("label");
|
||||
var strong = document.createElement("strong");
|
||||
label.textContent = name + " ";
|
||||
label.textContent = name + ": ";
|
||||
label.appendChild(strong);
|
||||
|
||||
function run(d) {
|
||||
|
|
@ -26,12 +26,12 @@ define(["helper"], function (helper) {
|
|||
|
||||
function draw(el) {
|
||||
if (negate) {
|
||||
el.parentNode.classList.add("not");
|
||||
el.classList.add("not");
|
||||
} else {
|
||||
el.parentNode.classList.remove("not");
|
||||
el.classList.remove("not");
|
||||
}
|
||||
|
||||
strong.textContent = (negate ? "¬" : "" ) + value;
|
||||
strong.textContent = value;
|
||||
}
|
||||
|
||||
function render(el) {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ define(["chroma-js", "map", "sidebar", "tabs", "container", "meshstats",
|
|||
contentDiv.appendChild(buttons);
|
||||
|
||||
var buttonToggle = document.createElement("button");
|
||||
buttonToggle.textContent = "\uF133";
|
||||
buttonToggle.classList.add("ion-eye", "shadow");
|
||||
buttonToggle.onclick = function () {
|
||||
if (content.constructor === Map) {
|
||||
router.view("g");
|
||||
|
|
|
|||
|
|
@ -11,17 +11,23 @@ define(["helper"], function (helper) {
|
|||
}
|
||||
|
||||
return function (config, el, router, d) {
|
||||
var unknown = !(d.source.node);
|
||||
var unknown = !d.source.node;
|
||||
var h2 = document.createElement("h2");
|
||||
var a1 = document.createElement("a");
|
||||
var a1;
|
||||
if (!unknown) {
|
||||
a1 = document.createElement("a");
|
||||
a1.href = "#";
|
||||
a1.onclick = router.node(d.source.node);
|
||||
} else {
|
||||
a1 = document.createElement("span");
|
||||
}
|
||||
a1.textContent = unknown ? d.source.id : d.source.node.nodeinfo.hostname;
|
||||
h2.appendChild(a1);
|
||||
h2.appendChild(document.createTextNode(" \uF3D6 "));
|
||||
h2.className = "ion-inside";
|
||||
|
||||
var arrow = document.createElement("spam");
|
||||
arrow.classList.add("ion-ios-arrow-thin-right");
|
||||
h2.appendChild(arrow);
|
||||
|
||||
var a2 = document.createElement("a");
|
||||
a2.href = "#";
|
||||
a2.onclick = router.node(d.target.node);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ define(["helper"], function (helper) {
|
|||
"uci set gluon-node-info.@location[0].longitude='" + d.lng.toFixed(9) + "';" +
|
||||
"uci commit gluon-node-info";
|
||||
|
||||
el.appendChild(createBox("uci", "Befehl", editUci, false));
|
||||
el.appendChild(createBox("uci", "Uci", editUci));
|
||||
|
||||
var linkPlain = document.createElement("a");
|
||||
linkPlain.textContent = "plain";
|
||||
|
|
@ -49,22 +49,13 @@ define(["helper"], function (helper) {
|
|||
};
|
||||
linkUci.href = "#";
|
||||
|
||||
var hintText = document.createElement("p");
|
||||
hintText.appendChild(document.createTextNode("Du kannst zwischen "));
|
||||
hintText.appendChild(linkPlain);
|
||||
hintText.appendChild(document.createTextNode(" und "));
|
||||
hintText.appendChild(linkUci);
|
||||
hintText.appendChild(document.createTextNode(" wechseln."));
|
||||
el.appendChild(hintText);
|
||||
|
||||
function createBox(name, title, inputElem, isVisible) {
|
||||
var visible = typeof isVisible !== "undefined" ? isVisible : true;
|
||||
function createBox(name, title, inputElem) {
|
||||
var box = document.createElement("div");
|
||||
var heading = document.createElement("h3");
|
||||
heading.textContent = title;
|
||||
box.appendChild(heading);
|
||||
var btn = document.createElement("button");
|
||||
btn.className = "ion-ios-copy";
|
||||
btn.classList.add("ion-ios-copy");
|
||||
btn.title = "Kopieren";
|
||||
btn.onclick = function () {
|
||||
copy2clip(inputElem.id);
|
||||
|
|
@ -76,7 +67,6 @@ define(["helper"], function (helper) {
|
|||
line.appendChild(btn);
|
||||
box.appendChild(line);
|
||||
box.id = "box-" + name;
|
||||
box.style.display = visible ? "block" : "none";
|
||||
return box;
|
||||
}
|
||||
|
||||
|
|
@ -90,16 +80,5 @@ define(["helper"], function (helper) {
|
|||
}
|
||||
}
|
||||
|
||||
function switch2plain() {
|
||||
document.getElementById("box-uci").style.display = "none";
|
||||
document.getElementById("box-lat").style.display = "block";
|
||||
document.getElementById("box-lng").style.display = "block";
|
||||
}
|
||||
|
||||
function switch2uci() {
|
||||
document.getElementById("box-uci").style.display = "block";
|
||||
document.getElementById("box-lat").style.display = "none";
|
||||
document.getElementById("box-lng").style.display = "none";
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ define(["infobox/link", "infobox/node", "infobox/location"], function (Link, Nod
|
|||
el.destroy = destroy;
|
||||
|
||||
var closeButton = document.createElement("button");
|
||||
closeButton.classList.add("close");
|
||||
closeButton.classList.add("close", "ion-android-close");
|
||||
closeButton.onclick = router.reset;
|
||||
el.appendChild(closeButton);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
define(["moment", "tablesort", "helper", "moment.de"],
|
||||
function (moment, Tablesort, helper) {
|
||||
define(["chroma-js", "moment", "tablesort", "helper", "moment.de"],
|
||||
function (chroma, moment, Tablesort, helper) {
|
||||
"use strict";
|
||||
|
||||
function showGeoURI(d) {
|
||||
|
|
@ -158,7 +158,7 @@ define(["moment", "tablesort", "helper", "moment.de"],
|
|||
|
||||
var span = document.createElement("span");
|
||||
span.classList.add("clients");
|
||||
span.textContent = "\uF47E ".repeat(d.statistics.clients);
|
||||
span.innerHTML = "<i class=\"ion-ios-person\"></i>".repeat(d.statistics.clients);
|
||||
el.appendChild(span);
|
||||
|
||||
var spanmesh = document.createElement("span");
|
||||
|
|
@ -255,8 +255,7 @@ define(["moment", "tablesort", "helper", "moment.de"],
|
|||
|
||||
function showBar(className, v) {
|
||||
var span = document.createElement("span");
|
||||
span.classList.add("bar");
|
||||
span.classList.add(className);
|
||||
span.classList.add("bar", className);
|
||||
|
||||
var bar = document.createElement("span");
|
||||
bar.style.width = (v * 100) + "%";
|
||||
|
|
@ -271,8 +270,7 @@ define(["moment", "tablesort", "helper", "moment.de"],
|
|||
|
||||
function showLoadBar(className, v) {
|
||||
var span = document.createElement("span");
|
||||
span.classList.add("bar");
|
||||
span.classList.add(className);
|
||||
span.classList.add("bar", className);
|
||||
|
||||
var bar = document.createElement("span");
|
||||
if (v >= 1) {
|
||||
|
|
@ -411,7 +409,7 @@ define(["moment", "tablesort", "helper", "moment.de"],
|
|||
link.href = webpage;
|
||||
if (webpage.search(/^https:\/\//i) !== -1) {
|
||||
var lock = document.createElement("span");
|
||||
lock.className = "ion-android-lock";
|
||||
lock.classList.add("ion-android-lock");
|
||||
a.appendChild(lock);
|
||||
var t1 = document.createTextNode(" ");
|
||||
a.appendChild(t1);
|
||||
|
|
@ -476,6 +474,11 @@ define(["moment", "tablesort", "helper", "moment.de"],
|
|||
}
|
||||
|
||||
return function (config, el, router, d) {
|
||||
var linkScale = chroma.scale(chroma.bezier(["#04C714", "#FF5500", "#F02311"])).domain([1, 5]);
|
||||
var h2 = document.createElement("h2");
|
||||
h2.textContent = d.nodeinfo.hostname;
|
||||
el.appendChild(h2);
|
||||
|
||||
var attributes = document.createElement("table");
|
||||
attributes.classList.add("attributes");
|
||||
|
||||
|
|
@ -495,9 +498,9 @@ define(["moment", "tablesort", "helper", "moment.de"],
|
|||
}
|
||||
helper.attributeEntry(attributes, top, d.nodeinfo.hostname);
|
||||
} else {
|
||||
var h2 = document.createElement("h2");
|
||||
h2.textContent = d.nodeinfo.hostname;
|
||||
el.appendChild(h2);
|
||||
var heading = document.createElement("h2");
|
||||
heading.textContent = d.nodeinfo.hostname;
|
||||
el.appendChild(heading);
|
||||
}
|
||||
|
||||
helper.attributeEntry(attributes, "Status", showStatus(d));
|
||||
|
|
@ -579,28 +582,34 @@ define(["moment", "tablesort", "helper", "moment.de"],
|
|||
var tr = document.createElement("tr");
|
||||
|
||||
var td1 = document.createElement("td");
|
||||
td1.className = "ion-inside";
|
||||
td1.appendChild(document.createTextNode(d.incoming ? " \uF3D5 " : " \uF3D6 "));
|
||||
tr.appendChild(td1);
|
||||
|
||||
var td2 = document.createElement("td");
|
||||
td2.appendChild(createLink(d, router));
|
||||
var direction = document.createElement("span");
|
||||
direction.classList.add(d.incoming ? "ion-ios-arrow-thin-left" : "ion-ios-arrow-thin-right");
|
||||
td1.appendChild(direction);
|
||||
|
||||
if (!unknown && helper.hasLocation(d.node)) {
|
||||
var span = document.createElement("span");
|
||||
span.classList.add("icon");
|
||||
span.classList.add("ion-location");
|
||||
td2.appendChild(span);
|
||||
span.classList.add("icon", "ion-location");
|
||||
td1.appendChild(span);
|
||||
}
|
||||
|
||||
tr.appendChild(td1);
|
||||
|
||||
var td2 = document.createElement("td");
|
||||
var a1 = document.createElement("a");
|
||||
a1.classList.add("hostname", d.link.target.node.flags.online ? "online" : "unseen");
|
||||
a1.textContent = unknown ? d.id : d.node.nodeinfo.hostname;
|
||||
if (!unknown) {
|
||||
a1.href = "#";
|
||||
}
|
||||
a1.onclick = router.node(d.node);
|
||||
td2.appendChild(a1);
|
||||
|
||||
tr.appendChild(td2);
|
||||
|
||||
var td3 = document.createElement("td");
|
||||
var a2 = document.createElement("a");
|
||||
a2.href = "#";
|
||||
a2.textContent = helper.showTq(d.link);
|
||||
a2.onclick = router.link(d.link);
|
||||
td3.appendChild(a2);
|
||||
td3.textContent = helper.showTq(d.link);
|
||||
td3.style.color = linkScale(d.link.tq).hex();
|
||||
tr.appendChild(td3);
|
||||
|
||||
var td4 = document.createElement("td");
|
||||
|
|
@ -612,11 +621,7 @@ define(["moment", "tablesort", "helper", "moment.de"],
|
|||
tr.appendChild(td4);
|
||||
|
||||
var td5 = document.createElement("td");
|
||||
var a4 = document.createElement("a");
|
||||
a4.href = "#";
|
||||
a4.textContent = helper.showDistance(d.link);
|
||||
a4.onclick = router.link(d.link);
|
||||
td5.appendChild(a4);
|
||||
td5.textContent = helper.showDistance(d.link);
|
||||
td5.setAttribute("data-sort", d.link.distance !== undefined ? -d.link.distance : 1);
|
||||
tr.appendChild(td5);
|
||||
|
||||
|
|
@ -624,7 +629,7 @@ define(["moment", "tablesort", "helper", "moment.de"],
|
|||
});
|
||||
|
||||
table.appendChild(tbody);
|
||||
table.className = "node-links";
|
||||
table.classList.add("node-links");
|
||||
|
||||
Tablesort(table);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ define(["sorttable", "virtual-dom", "helper"], function (SortTable, V, helper) {
|
|||
|
||||
return function (linkScale, router) {
|
||||
var table = new SortTable(headings, 2, renderRow);
|
||||
table.el.classList.add("link-list");
|
||||
|
||||
function renderRow(d) {
|
||||
var td1Content = [V.h("a", {href: "#", onclick: router.link(d)}, linkName(d))];
|
||||
|
|
@ -50,15 +51,11 @@ define(["sorttable", "virtual-dom", "helper"], function (SortTable, V, helper) {
|
|||
}
|
||||
|
||||
this.render = function (d) {
|
||||
var el = document.createElement("div");
|
||||
el.last = V.h("div");
|
||||
d.appendChild(el);
|
||||
|
||||
var h2 = document.createElement("h2");
|
||||
h2.textContent = "Verbindungen";
|
||||
el.appendChild(h2);
|
||||
d.appendChild(h2);
|
||||
|
||||
el.appendChild(table.el);
|
||||
d.appendChild(table.el);
|
||||
};
|
||||
|
||||
this.setData = function (d) {
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ define(["moment", "router", "leaflet", "gui", "helper", "moment.de"],
|
|||
|
||||
var urls = [];
|
||||
|
||||
if (typeof config.dataPath === "string" || config.dataPath instanceof String) {
|
||||
if (typeof config.dataPath === "string") {
|
||||
config.dataPath = [config.dataPath];
|
||||
}
|
||||
|
||||
|
|
|
|||
10
lib/map.js
10
lib/map.js
|
|
@ -20,8 +20,7 @@ define(["map/clientlayer", "map/labelslayer",
|
|||
},
|
||||
|
||||
onAdd: function () {
|
||||
var button = L.DomUtil.create("button", "add-layer");
|
||||
button.textContent = "\uF2C7";
|
||||
var button = L.DomUtil.create("button", "add-layer ion-android-add shadow");
|
||||
|
||||
// L.DomEvent.disableClickPropagation(button)
|
||||
// Click propagation isn't disabled as this causes problems with the
|
||||
|
|
@ -48,9 +47,7 @@ define(["map/clientlayer", "map/labelslayer",
|
|||
},
|
||||
|
||||
onAdd: function () {
|
||||
var button = L.DomUtil.create("button", "locate-user");
|
||||
button.textContent = "\uF2E9";
|
||||
|
||||
var button = L.DomUtil.create("button", "locate-user ion-android-locate shadow");
|
||||
L.DomEvent.disableClickPropagation(button);
|
||||
L.DomEvent.addListener(button, "click", this.onClick, this);
|
||||
|
||||
|
|
@ -87,8 +84,7 @@ define(["map/clientlayer", "map/labelslayer",
|
|||
},
|
||||
|
||||
onAdd: function () {
|
||||
var button = L.DomUtil.create("button", "coord-picker");
|
||||
button.textContent = "\uF3A3";
|
||||
var button = L.DomUtil.create("button", "coord-picker ion-pin shadow");
|
||||
|
||||
// Click propagation isn't disabled as this causes problems with the
|
||||
// location picking mode; instead propagation is stopped in onClick().
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ define(["sorttable", "virtual-dom", "helper"], function (SortTable, V, helper) {
|
|||
}
|
||||
|
||||
var headings = [{
|
||||
name: ''
|
||||
}, {
|
||||
name: "Knoten",
|
||||
sort: function (a, b) {
|
||||
var aname = typeof a.nodeinfo.hostname === "string" ? a.nodeinfo.hostname : a.nodeinfo.node_id;
|
||||
|
|
@ -61,6 +63,7 @@ define(["sorttable", "virtual-dom", "helper"], function (SortTable, V, helper) {
|
|||
|
||||
return function (router) {
|
||||
function renderRow(d) {
|
||||
var td0Content = [];
|
||||
var td1Content = [];
|
||||
var aClass = ["hostname", d.flags.online ? "online" : "offline"];
|
||||
|
||||
|
|
@ -71,28 +74,27 @@ define(["sorttable", "virtual-dom", "helper"], function (SortTable, V, helper) {
|
|||
}, d.nodeinfo.hostname));
|
||||
|
||||
if (helper.hasLocation(d)) {
|
||||
td1Content.push(V.h("span", {className: "icon ion-location"}));
|
||||
td0Content.push(V.h("span", {className: "icon ion-location"}));
|
||||
}
|
||||
|
||||
var td0 = V.h("td", td0Content);
|
||||
var td1 = V.h("td", td1Content);
|
||||
var td2 = V.h("td", showUptime(d.uptime));
|
||||
var td3 = V.h("td", d.meshlinks.toString());
|
||||
var td4 = V.h("td", ("clients" in d.statistics ? d.statistics.clients : 0).toFixed(0));
|
||||
|
||||
return V.h("tr", [td1, td2, td3, td4]);
|
||||
return V.h("tr", [td0, td1, td2, td3, td4]);
|
||||
}
|
||||
|
||||
var table = new SortTable(headings, 0, renderRow);
|
||||
var table = new SortTable(headings, 1, renderRow);
|
||||
table.el.classList.add('node-list');
|
||||
|
||||
this.render = function (d) {
|
||||
var el = document.createElement("div");
|
||||
d.appendChild(el);
|
||||
|
||||
var h2 = document.createElement("h2");
|
||||
h2.textContent = "Alle Knoten";
|
||||
el.appendChild(h2);
|
||||
d.appendChild(h2);
|
||||
|
||||
el.appendChild(table.el);
|
||||
d.appendChild(table.el);
|
||||
};
|
||||
|
||||
this.setData = function (d) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ define(function () {
|
|||
var button = document.createElement("button");
|
||||
sidebar.appendChild(button);
|
||||
|
||||
button.classList.add("sidebarhandle");
|
||||
button.classList.add("sidebarhandle", "shadow");
|
||||
button.onclick = function () {
|
||||
sidebar.classList.toggle("hidden");
|
||||
};
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue