[TASK] Replace numeraljs with toFixed vanilla js
This commit is contained in:
parent
a56876a10e
commit
90d2c3e444
9
app.js
9
app.js
|
@ -10,8 +10,6 @@ require.config({
|
|||
"tablesort": "../bower_components/tablesort/tablesort.min",
|
||||
"tablesort.number": "../bower_components/tablesort/src/sorts/tablesort.number",
|
||||
"d3": "../bower_components/d3/d3.min",
|
||||
"numeral": "../bower_components/numeraljs/min/numeral.min",
|
||||
"numeral.de": "../bower_components/numeraljs/min/languages/de.min",
|
||||
"virtual-dom": "../bower_components/virtual-dom/dist/virtual-dom",
|
||||
"rbush": "../bower_components/rbush/rbush",
|
||||
"helper": "../helper",
|
||||
|
@ -24,12 +22,7 @@ require.config({
|
|||
"tablesort": {
|
||||
exports: "Tablesort"
|
||||
},
|
||||
"numeral.de": {
|
||||
deps: ["numeral"],
|
||||
exports: "numeral"
|
||||
},
|
||||
"tablesort.number": ["tablesort"],
|
||||
"helper": ["numeral.de"]
|
||||
"tablesort.number": ["tablesort"]
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
"es6-shim": "~0.35.1",
|
||||
"almond": "~0.3.2",
|
||||
"d3": "~3.5.17",
|
||||
"numeraljs": "~1.5.3",
|
||||
"roboto-fontface": "~0.3.0",
|
||||
"virtual-dom": "~2.1.1",
|
||||
"leaflet-providers": "~1.1.10",
|
||||
|
|
|
@ -118,11 +118,11 @@ function showDistance(d) {
|
|||
return;
|
||||
}
|
||||
|
||||
return numeral(d.distance).format("0,0") + " m";
|
||||
return d.distance.toFixed(0) + " m"
|
||||
}
|
||||
|
||||
function showTq(d) {
|
||||
return numeral(1 / d.tq).format("0%");
|
||||
return (1 / d.tq * 100).toFixed(0) + "%"
|
||||
}
|
||||
|
||||
/* Infobox stuff (XXX: move to module) */
|
||||
|
|
|
@ -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…
Reference in a new issue