[TASK] Improve code, remove unsed code
This commit is contained in:
parent
3b4896f0da
commit
7d838dd7a1
54
lib/about.js
54
lib/about.js
@ -3,42 +3,40 @@ define(function () {
|
|||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
this.render = function (d) {
|
this.render = function (d) {
|
||||||
var s = "<h2>Über Meshviewer</h2>";
|
d.innerHTML = "<h2>Über Meshviewer</h2>" +
|
||||||
|
|
||||||
s += "<p>Mit Doppelklick und Shift+Doppelklick kann man in der Karte ";
|
"<p>Mit Doppelklick und Shift+Doppelklick kann man in der Karte " +
|
||||||
s += "auch zoomen.</p>";
|
"auch zoomen.</p>" +
|
||||||
|
|
||||||
s += "<h3>AGPL 3</h3>";
|
"<h3>AGPL 3</h3>" +
|
||||||
|
|
||||||
s += "<p>Copyright (C) Milan Pässler</p>";
|
"<p>Copyright (C) Milan Pässler</p>" +
|
||||||
s += "<p>Copyright (C) Nils Schneider</p>";
|
"<p>Copyright (C) Nils Schneider</p>" +
|
||||||
|
|
||||||
s += "<p>This program is free software: you can redistribute it and/or ";
|
"<p>This program is free software: you can redistribute it and/or " +
|
||||||
s += "modify it under the terms of the GNU Affero General Public ";
|
"modify it under the terms of the GNU Affero General Public " +
|
||||||
s += "License as published by the Free Software Foundation, either ";
|
"License as published by the Free Software Foundation, either " +
|
||||||
s += "version 3 of the License, or (at your option) any later version.</p>";
|
"version 3 of the License, or (at your option) any later version.</p>" +
|
||||||
|
|
||||||
s += "<p>This program is distributed in the hope that it will be useful, ";
|
"<p>This program is distributed in the hope that it will be useful, " +
|
||||||
s += "but WITHOUT ANY WARRANTY; without even the implied warranty of ";
|
"but WITHOUT ANY WARRANTY; without even the implied warranty of " +
|
||||||
s += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ";
|
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " +
|
||||||
s += "GNU Affero General Public License for more details.</p>";
|
"GNU Affero General Public License for more details.</p>" +
|
||||||
|
|
||||||
s += "<p>You should have received a copy of the GNU Affero General ";
|
"<p>You should have received a copy of the GNU Affero General " +
|
||||||
s += "Public License along with this program. If not, see ";
|
"Public License along with this program. If not, see " +
|
||||||
s += "<a href=\"https://www.gnu.org/licenses/\">";
|
"<a href=\"https://www.gnu.org/licenses/\">" +
|
||||||
s += "https://www.gnu.org/licenses/</a>.</p>";
|
"https://www.gnu.org/licenses/</a>.</p>" +
|
||||||
|
|
||||||
s += "<p>The source code is available at ";
|
"<p>The source code is available at " +
|
||||||
s += "<a href=\"https://github.com/ffrgb/meshviewer\">";
|
"<a href=\"https://github.com/ffrgb/meshviewer\">" +
|
||||||
s += "https://github.com/ffrgb/meshviewer</a>.";
|
"https://github.com/ffrgb/meshviewer</a>." +
|
||||||
|
|
||||||
s += "<p>Forked and based on ";
|
"<p>Forked and based on " +
|
||||||
s += "<a href=\"https://github.com/ffnord/meshviewer\">";
|
"<a href=\"https://github.com/ffnord/meshviewer\">" +
|
||||||
s += "https://github.com/ffnord/meshviewer</a> and ";
|
"https://github.com/ffnord/meshviewer</a> and " +
|
||||||
s += "<a href=\"https://github.com/plumpudding/hopglass\">";
|
"<a href=\"https://github.com/plumpudding/hopglass\">" +
|
||||||
s += "https://github.com/plumpudding/hopglass</a>.</p>";
|
"https://github.com/plumpudding/hopglass</a>.</p>";
|
||||||
|
|
||||||
d.innerHTML = s;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -33,22 +33,6 @@ define(["helper"], function (helper) {
|
|||||||
|
|
||||||
el.appendChild(createBox("uci", "Uci", editUci));
|
el.appendChild(createBox("uci", "Uci", editUci));
|
||||||
|
|
||||||
var linkPlain = document.createElement("a");
|
|
||||||
linkPlain.textContent = "plain";
|
|
||||||
linkPlain.onclick = function () {
|
|
||||||
switch2plain();
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
linkPlain.href = "#";
|
|
||||||
|
|
||||||
var linkUci = document.createElement("a");
|
|
||||||
linkUci.textContent = "uci";
|
|
||||||
linkUci.onclick = function () {
|
|
||||||
switch2uci();
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
linkUci.href = "#";
|
|
||||||
|
|
||||||
function createBox(name, title, inputElem) {
|
function createBox(name, title, inputElem) {
|
||||||
var box = document.createElement("div");
|
var box = document.createElement("div");
|
||||||
var heading = document.createElement("h3");
|
var heading = document.createElement("h3");
|
||||||
|
@ -6,35 +6,11 @@ define(function () {
|
|||||||
|
|
||||||
self.render = function (el) {
|
self.render = function (el) {
|
||||||
var p = document.createElement("p");
|
var p = document.createElement("p");
|
||||||
p.setAttribute("class", "legend");
|
p.classList.add("legend");
|
||||||
|
p.innerHTML = '<span class="legend-new"><span class="symbol"></span> Neuer Knoten</span>' +
|
||||||
|
'<span class="legend-online"><span class="symbol"></span> Knoten ist online</span>' +
|
||||||
|
'<span class="legend-offline"><span class="symbol"></span> Knoten ist offline</span>';
|
||||||
el.appendChild(p);
|
el.appendChild(p);
|
||||||
|
|
||||||
var spanNew = document.createElement("span");
|
|
||||||
spanNew.setAttribute("class", "legend-new");
|
|
||||||
var symbolNew = document.createElement("span");
|
|
||||||
symbolNew.setAttribute("class", "symbol");
|
|
||||||
var textNew = document.createTextNode(" Neuer Knoten");
|
|
||||||
spanNew.appendChild(symbolNew);
|
|
||||||
spanNew.appendChild(textNew);
|
|
||||||
p.appendChild(spanNew);
|
|
||||||
|
|
||||||
var spanOnline = document.createElement("span");
|
|
||||||
spanOnline.setAttribute("class", "legend-online");
|
|
||||||
var symbolOnline = document.createElement("span");
|
|
||||||
symbolOnline.setAttribute("class", "symbol");
|
|
||||||
var textOnline = document.createTextNode(" Knoten ist online");
|
|
||||||
spanOnline.appendChild(symbolOnline);
|
|
||||||
spanOnline.appendChild(textOnline);
|
|
||||||
p.appendChild(spanOnline);
|
|
||||||
|
|
||||||
var spanOffline = document.createElement("span");
|
|
||||||
spanOffline.setAttribute("class", "legend-offline");
|
|
||||||
var symbolOffline = document.createElement("span");
|
|
||||||
symbolOffline.setAttribute("class", "symbol");
|
|
||||||
var textOffline = document.createTextNode(" Knoten ist offline");
|
|
||||||
spanOffline.appendChild(symbolOffline);
|
|
||||||
spanOffline.appendChild(textOffline);
|
|
||||||
p.appendChild(spanOffline);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -333,14 +333,14 @@ define(["map/clientlayer", "map/labelslayer",
|
|||||||
if (cssMode) {
|
if (cssMode) {
|
||||||
cssMode.parentNode.removeChild(cssMode);
|
cssMode.parentNode.removeChild(cssMode);
|
||||||
document.querySelector("html").className = '';
|
document.querySelector("html").className = '';
|
||||||
labelsLayer.updateColor();
|
labelsLayer.updateLayer();
|
||||||
}
|
}
|
||||||
if (e.layer.options.mode) {
|
if (e.layer.options.mode) {
|
||||||
document.querySelector("head").innerHTML += "<link rel='stylesheet' class='css-mode' href='" + e.layer.options.mode + ".css'>";
|
document.querySelector("head").innerHTML += "<link rel='stylesheet' class='css-mode' href='" + e.layer.options.mode + ".css'>";
|
||||||
document.querySelector("html").classList.add(e.layer.options.mode);
|
document.querySelector("html").classList.add(e.layer.options.mode);
|
||||||
var cssInterval = setInterval(function () {
|
var cssInterval = setInterval(function () {
|
||||||
if (typeof document.querySelector(".css-mode").sheet.cssRules != 'undefined') {
|
if (typeof document.querySelector(".css-mode").sheet.cssRules != 'undefined') {
|
||||||
labelsLayer.updateColor();
|
labelsLayer.updateLayer();
|
||||||
clearInterval(cssInterval);
|
clearInterval(cssInterval);
|
||||||
}
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
|
@ -84,12 +84,10 @@ define(["leaflet", "rbush"],
|
|||||||
},
|
},
|
||||||
setData: function (d) {
|
setData: function (d) {
|
||||||
this.data = d;
|
this.data = d;
|
||||||
if (this._map) {
|
this.updateLayer();
|
||||||
this.prepareLabels();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
updateColor: function() {
|
updateLayer: function () {
|
||||||
if(this._map) {
|
if (this._map) {
|
||||||
this.prepareLabels();
|
this.prepareLabels();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -108,7 +106,7 @@ define(["leaflet", "rbush"],
|
|||||||
var labelsOffline = d.offline.map(prepareLabel("rgba(212, 62, 42, 0.9)", 9, 5, false, 16));
|
var labelsOffline = d.offline.map(prepareLabel("rgba(212, 62, 42, 0.9)", 9, 5, false, 16));
|
||||||
var labelsNew = d.new.map(prepareLabel("rgba(48, 99, 20, 0.9)", 11, 8, true, 0));
|
var labelsNew = d.new.map(prepareLabel("rgba(48, 99, 20, 0.9)", 11, 8, true, 0));
|
||||||
var labelsLost = d.lost.map(prepareLabel("rgba(212, 62, 42, 0.9)", 11, 8, true, 0));
|
var labelsLost = d.lost.map(prepareLabel("rgba(212, 62, 42, 0.9)", 11, 8, true, 0));
|
||||||
labelShadow = bodyStyle.backgroundColor.replace(/rgb/i, "rgba").replace(/\)/i,',0.7)');
|
labelShadow = bodyStyle.backgroundColor.replace(/rgb/i, "rgba").replace(/\)/i, ',0.7)');
|
||||||
|
|
||||||
var labels = []
|
var labels = []
|
||||||
.concat(labelsNew)
|
.concat(labelsNew)
|
||||||
|
Loading…
Reference in New Issue
Block a user