diff --git a/app.js b/app.js index d5e560215633d9cdad8085c0f4c00042978639f9..1782431e820d5c2244aa7f566e8d05062696d132 100644 --- a/app.js +++ b/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"] } }) diff --git a/bower.json b/bower.json index 01cbcd2eb80f20961c80881e94d843a29337bf7d..d10289118b37e1e9e64e3a9402ad11ad98fd1a91 100644 --- a/bower.json +++ b/bower.json @@ -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>" diff --git a/helper.js b/helper.js index 51f07f65ae2ff6a329858c4002af12ba4b1f23bc..7450d79829fca3ea18f2da42957c6bb530b4a705 100644 --- a/helper.js +++ b/helper.js @@ -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) { diff --git a/html/index.html b/html/index.html index cc128380563be35aaaa18977c80b24142270ecc9..57e9eb108361173891e6de554e2606ac33ed7e16 100644 --- a/html/index.html +++ b/html/index.html @@ -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> diff --git a/index.html b/index.html index 932eb3a5c2879684146d659684921d295be53191..268b1af0cf741231ff09d43b48656f492879a6e3 100644 --- a/index.html +++ b/index.html @@ -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> diff --git a/lib/main.js b/lib/main.js index d7562f8c6f738f3ce4b4a65b41d478d55c660aa0..d9a21218b956afa8b36453dcd503620ae5bcb708 100644 --- a/lib/main.js +++ b/lib/main.js @@ -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", diff --git a/tasks/build.js b/tasks/build.js index cfa89a7c7f78b5030180ff4865932c835dcee724..0db0b0a531cbf5132c721a10ee2723141afc7cad 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -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/"