[TASK] Replace numeraljs with toFixed vanilla js
This commit is contained in:
parent
ea5d9291f5
commit
1768e82793
9
app.js
9
app.js
@ -10,8 +10,6 @@ require.config({
|
|||||||
"tablesort": "../bower_components/tablesort/tablesort.min",
|
"tablesort": "../bower_components/tablesort/tablesort.min",
|
||||||
"tablesort.number": "../bower_components/tablesort/src/sorts/tablesort.number",
|
"tablesort.number": "../bower_components/tablesort/src/sorts/tablesort.number",
|
||||||
"d3": "../bower_components/d3/d3.min",
|
"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",
|
"virtual-dom": "../bower_components/virtual-dom/dist/virtual-dom",
|
||||||
"rbush": "../bower_components/rbush/rbush",
|
"rbush": "../bower_components/rbush/rbush",
|
||||||
"helper": "../helper",
|
"helper": "../helper",
|
||||||
@ -24,12 +22,7 @@ require.config({
|
|||||||
"tablesort": {
|
"tablesort": {
|
||||||
exports: "Tablesort"
|
exports: "Tablesort"
|
||||||
},
|
},
|
||||||
"numeral.de": {
|
"tablesort.number": ["tablesort"]
|
||||||
deps: ["numeral"],
|
|
||||||
exports: "numeral"
|
|
||||||
},
|
|
||||||
"tablesort.number": ["tablesort"],
|
|
||||||
"helper": ["numeral.de"]
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
"es6-shim": "~0.35.1",
|
"es6-shim": "~0.35.1",
|
||||||
"almond": "~0.3.2",
|
"almond": "~0.3.2",
|
||||||
"d3": "~3.5.17",
|
"d3": "~3.5.17",
|
||||||
"numeraljs": "~1.5.3",
|
|
||||||
"roboto-fontface": "~0.3.0",
|
"roboto-fontface": "~0.3.0",
|
||||||
"virtual-dom": "~2.1.1",
|
"virtual-dom": "~2.1.1",
|
||||||
"leaflet-providers": "~1.1.10",
|
"leaflet-providers": "~1.1.10",
|
||||||
|
@ -118,11 +118,11 @@ function showDistance(d) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return numeral(d.distance).format("0,0") + " m"
|
return d.distance.toFixed(0) + " m"
|
||||||
}
|
}
|
||||||
|
|
||||||
function showTq(d) {
|
function showTq(d) {
|
||||||
return numeral(1 / d.tq).format("0%")
|
return (1 / d.tq * 100).toFixed(0) + "%"
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Infobox stuff (XXX: move to module) */
|
/* Infobox stuff (XXX: move to module) */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
define(["moment", "numeral", "tablesort", "tablesort.number", "moment.de"],
|
define(["moment", "tablesort", "tablesort.number", "moment.de"],
|
||||||
function (moment, numeral, Tablesort) {
|
function (moment, Tablesort) {
|
||||||
function showGeoURI(d) {
|
function showGeoURI(d) {
|
||||||
function showLatitude(d) {
|
function showLatitude(d) {
|
||||||
var suffix = Math.sign(d) > -1 ? "' N" : "' S";
|
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;
|
var min = (d * 60) % 60;
|
||||||
a = (a < 10 ? "0" : "") + a;
|
a = (a < 10 ? "0" : "") + a;
|
||||||
|
|
||||||
return a + "° " + numeral(min).format("0.000") + suffix;
|
return a + "° " + min.toFixed(3) + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showLongitude(d) {
|
function showLongitude(d) {
|
||||||
@ -18,7 +18,7 @@ define(["moment", "numeral", "tablesort", "tablesort.number", "moment.de"],
|
|||||||
var min = (d * 60) % 60;
|
var min = (d * 60) % 60;
|
||||||
a = (a < 100 ? "0" + (a < 10 ? "0" : "") : "") + a;
|
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)) {
|
if (!has_location(d)) {
|
||||||
@ -178,7 +178,7 @@ define(["moment", "numeral", "tablesort", "tablesort.number", "moment.de"],
|
|||||||
}
|
}
|
||||||
|
|
||||||
return function (el) {
|
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"],
|
define(["moment", "router", "leaflet", "gui", "moment.de"],
|
||||||
function (moment, Router, L, GUI, numeral) {
|
function (moment, Router, L, GUI) {
|
||||||
return function (config) {
|
return function (config) {
|
||||||
function handleData(data) {
|
function handleData(data) {
|
||||||
var dataNodes = {};
|
var dataNodes = {};
|
||||||
@ -154,8 +154,6 @@ define(["moment", "router", "leaflet", "gui", "numeral", "moment.de"],
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
numeral.language("de");
|
|
||||||
moment.locale("de");
|
moment.locale("de");
|
||||||
|
|
||||||
var router = new Router();
|
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) {
|
function getUptime(now, d) {
|
||||||
if (d.flags.online && "uptime" in d.statistics) {
|
if (d.flags.online && "uptime" in d.statistics) {
|
||||||
return Math.round(d.statistics.uptime);
|
return Math.round(d.statistics.uptime);
|
||||||
@ -70,7 +70,7 @@ define(["sorttable", "virtual-dom", "numeral"], function (SortTable, V, numeral)
|
|||||||
var td1 = V.h("td", td1Content);
|
var td1 = V.h("td", td1Content);
|
||||||
var td2 = V.h("td", showUptime(d.uptime));
|
var td2 = V.h("td", showUptime(d.uptime));
|
||||||
var td3 = V.h("td", d.meshlinks.toString());
|
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 : "").toFixed(0));
|
||||||
|
|
||||||
return V.h("tr", [td1, td2, td3, td4]);
|
return V.h("tr", [td1, td2, td3, td4]);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercomp"],
|
define(["chroma-js", "virtual-dom", "filters/genericnode", "vercomp"],
|
||||||
function (Chroma, V, numeral, Filter, vercomp) {
|
function (Chroma, V, Filter, vercomp) {
|
||||||
|
|
||||||
return function (config, filterManager) {
|
return function (config, filterManager) {
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -49,7 +49,7 @@ define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercom
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addFilter(filter) {
|
function addFilter(filter) {
|
||||||
return function () {
|
return function () {
|
||||||
filterManager.addFilter(filter);
|
filterManager.addFilter(filter);
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercom
|
|||||||
backgroundColor: scale(v).hex(),
|
backgroundColor: scale(v).hex(),
|
||||||
color: c1 > c2 ? "white" : "black"
|
color: c1 > c2 ? "white" : "black"
|
||||||
}
|
}
|
||||||
}, numeral(d[1]).format("0,0")));
|
}, d[1].toFixed(0)));
|
||||||
|
|
||||||
return V.h("tr", [th, td]);
|
return V.h("tr", [th, td]);
|
||||||
});
|
});
|
||||||
@ -150,7 +150,7 @@ define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercom
|
|||||||
fillTable("Autom. Updates", autoTable, autoDict.sort(function (a, b) {
|
fillTable("Autom. Updates", autoTable, autoDict.sort(function (a, b) {
|
||||||
return b[1] - a[1];
|
return b[1] - a[1];
|
||||||
}));
|
}));
|
||||||
fillTable("Site", siteTable, siteDict.sort(function (a, b) {
|
fillTable("Site", siteTable, siteDict.sort(function (a, b) {
|
||||||
return b[1] - a[1];
|
return b[1] - a[1];
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user