replace Intl.NumberFormat with numeraljs
This commit is contained in:
parent
534f7bbed4
commit
141e98f027
5
app.js
5
app.js
@ -8,6 +8,8 @@ require.config({
|
||||
"tablesort": "../bower_components/tablesort/tablesort.min",
|
||||
"tablesort.numeric": "../bower_components/tablesort/src/sorts/tablesort.numeric",
|
||||
"d3": "../bower_components/d3/d3.min",
|
||||
"numeral": "../bower_components/numeraljs/min/numeral.min",
|
||||
"numeral-intl": "../bower_components/numeraljs/min/languages.min",
|
||||
"helper": "../helper"
|
||||
},
|
||||
shim: {
|
||||
@ -15,8 +17,9 @@ require.config({
|
||||
"tablesort": {
|
||||
exports: "Tablesort"
|
||||
},
|
||||
"numeral-intl": ["numeral"],
|
||||
"tablesort.numeric": ["tablesort"],
|
||||
"helper": []
|
||||
"helper": ["numeral-intl"]
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
"dependencies": {
|
||||
"Leaflet.label": "~0.2.1",
|
||||
"chroma-js": "~0.6.1",
|
||||
"intl": "~0.1.4",
|
||||
"leaflet": "~0.7.3",
|
||||
"ionicons": "~2.0.1",
|
||||
"moment": "~2.9.0",
|
||||
@ -20,7 +19,8 @@
|
||||
"es6-shim": "~0.27.1",
|
||||
"almond": "~0.3.1",
|
||||
"r.js": "~2.1.16",
|
||||
"d3": "~3.5.5"
|
||||
"d3": "~3.5.5",
|
||||
"numeraljs": "~1.5.3"
|
||||
},
|
||||
"authors": [
|
||||
"Nils Schneider <nils@nilsschneider.net>"
|
||||
|
@ -105,13 +105,11 @@ function showDistance(d) {
|
||||
if (isNaN(d.distance))
|
||||
return
|
||||
|
||||
return (new Intl.NumberFormat("de-DE", {maximumFractionDigits: 0}).format(d.distance)) + " m"
|
||||
return numeral(d.distance).format("0,0") + " m"
|
||||
}
|
||||
|
||||
function showTq(d) {
|
||||
var opts = { maximumFractionDigits: 0 }
|
||||
|
||||
return (new Intl.NumberFormat("de-DE", opts).format(100/d.tq)) + "%"
|
||||
return numeral(1/d.tq).format("0%")
|
||||
}
|
||||
|
||||
function linkId(d) {
|
||||
|
@ -7,7 +7,6 @@
|
||||
<link rel="stylesheet" href="roboto-slab-fontface.css">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script src="vendor/es6-shim/es6-shim.min.js"></script>
|
||||
<script src="vendor/intl/Intl.complete.js"></script>
|
||||
<script src="app.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -9,7 +9,6 @@
|
||||
<link rel="stylesheet" href="bower_components/ionicons/css/ionicons.min.css">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script src="bower_components/es6-shim/es6-shim.min.js"></script>
|
||||
<script src="bower_components/intl/Intl.complete.js"></script>
|
||||
<script src="bower_components/requirejs/require.js" data-main="app"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -1,5 +1,5 @@
|
||||
define(["config", "moment", "router", "leaflet", "gui"],
|
||||
function (config, moment, Router, L, GUI) {
|
||||
define(["config", "moment", "router", "leaflet", "gui", "numeral"],
|
||||
function (config, moment, Router, L, GUI, numeral) {
|
||||
return function () {
|
||||
function handleData(data) {
|
||||
var nodes = Object.keys(data[0].nodes).map(function (key) { return data[0].nodes[key] })
|
||||
@ -77,7 +77,9 @@ function (config, moment, Router, L, GUI) {
|
||||
}
|
||||
}
|
||||
|
||||
numeral.language("de")
|
||||
moment.locale("de")
|
||||
|
||||
var router = new Router()
|
||||
|
||||
var urls = [ config.dataPath + "nodes.json",
|
||||
|
@ -13,9 +13,7 @@ module.exports = function(grunt) {
|
||||
dest: "build/"
|
||||
},
|
||||
vendorjs: {
|
||||
src: [ "es6-shim/es6-shim.min.js",
|
||||
"intl/Intl.complete.js"
|
||||
],
|
||||
src: [ "es6-shim/es6-shim.min.js" ],
|
||||
expand: true,
|
||||
cwd: "bower_components/",
|
||||
dest: "build/vendor/"
|
||||
|
Loading…
Reference in New Issue
Block a user