[TASK] Replace numeraljs with toFixed vanilla js
This commit is contained in:
parent
2738967343
commit
fe3ba88887
7 changed files with 15 additions and 26 deletions
|
@ -1,5 +1,5 @@
|
|||
define(["moment", "numeral", "tablesort", "tablesort.number", "moment.de"],
|
||||
function (moment, numeral, Tablesort) {
|
||||
define(["moment", "tablesort", "tablesort.number", "moment.de"],
|
||||
function (moment, Tablesort) {
|
||||
function showGeoURI(d) {
|
||||
function showLatitude(d) {
|
||||
var suffix = Math.sign(d) > -1 ? "' N" : "' S";
|
||||
|
@ -8,7 +8,7 @@ define(["moment", "numeral", "tablesort", "tablesort.number", "moment.de"],
|
|||
var min = (d * 60) % 60;
|
||||
a = (a < 10 ? "0" : "") + a;
|
||||
|
||||
return a + "° " + numeral(min).format("0.000") + suffix;
|
||||
return a + "° " + min.toFixed(3) + suffix;
|
||||
}
|
||||
|
||||
function showLongitude(d) {
|
||||
|
@ -18,7 +18,7 @@ define(["moment", "numeral", "tablesort", "tablesort.number", "moment.de"],
|
|||
var min = (d * 60) % 60;
|
||||
a = (a < 100 ? "0" + (a < 10 ? "0" : "") : "") + a;
|
||||
|
||||
return a + "° " + numeral(min).format("0.000") + suffix;
|
||||
return a + "° " + min.toFixed(3) + suffix;
|
||||
}
|
||||
|
||||
if (!has_location(d)) {
|
||||
|
@ -297,7 +297,7 @@ define(["moment", "numeral", "tablesort", "tablesort.number", "moment.de"],
|
|||
}
|
||||
|
||||
return function (el) {
|
||||
el.appendChild(showLoadBar("load-avg", numeral(d.statistics.loadavg).format("0.00")));
|
||||
el.appendChild(showLoadBar("load-avg", d.statistics.loadavg.toFixed(2)));
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define(["moment", "router", "leaflet", "gui", "numeral", "moment.de"],
|
||||
function (moment, Router, L, GUI, numeral) {
|
||||
define(["moment", "router", "leaflet", "gui", "moment.de"],
|
||||
function (moment, Router, L, GUI) {
|
||||
return function (config) {
|
||||
function handleData(data) {
|
||||
var dataNodes = {};
|
||||
|
@ -197,8 +197,6 @@ define(["moment", "router", "leaflet", "gui", "numeral", "moment.de"],
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
numeral.language("de");
|
||||
moment.locale("de");
|
||||
|
||||
var router = new Router();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(["sorttable", "virtual-dom", "numeral"], function (SortTable, V, numeral) {
|
||||
define(["sorttable", "virtual-dom"], function (SortTable, V) {
|
||||
function getUptime(now, d) {
|
||||
if (d.flags.online && "uptime" in d.statistics) {
|
||||
return Math.round(d.statistics.uptime);
|
||||
|
@ -75,7 +75,7 @@ define(["sorttable", "virtual-dom", "numeral"], function (SortTable, V, numeral)
|
|||
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", numeral("clients" in d.statistics ? d.statistics.clients : "").format("0,0"));
|
||||
var td4 = V.h("td", ("clients" in d.statistics ? d.statistics.clients : 0).toFixed(0));
|
||||
|
||||
return V.h("tr", [td1, td2, td3, td4]);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercomp"],
|
||||
function (Chroma, V, numeral, Filter, vercomp) {
|
||||
define(["chroma-js", "virtual-dom", "filters/genericnode", "vercomp"],
|
||||
function (Chroma, V, Filter, vercomp) {
|
||||
|
||||
return function (config, filterManager) {
|
||||
var self = this;
|
||||
|
@ -80,7 +80,6 @@ define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercom
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
function addFilter(filter) {
|
||||
return function () {
|
||||
filterManager.addFilter(filter);
|
||||
|
@ -117,7 +116,7 @@ define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercom
|
|||
backgroundColor: scale(v).hex(),
|
||||
color: c1 > c2 ? "white" : "black"
|
||||
}
|
||||
}, numeral(d[1]).format("0,0")));
|
||||
}, d[1].toFixed(0)));
|
||||
|
||||
return V.h("tr", [th, td]);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue