From 82935b2cf0cc3371014640013e3b7296afd0170d Mon Sep 17 00:00:00 2001 From: anoy Date: Wed, 2 Dec 2015 13:24:31 +0100 Subject: [PATCH] added OS switch for the coords and restore backwards compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit added OS switch for the coords … (new) fix for plumpudding/meshviewer/#6 restore backwards compatibility resolve builderror fixed typo --- README.md | 4 ++-- config.json.example | 2 +- lib/infobox/node.js | 11 +++++++++-- lib/main.js | 10 +++++++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a6618e0..2d0e9e4 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,9 @@ There is no stable release cycle at the moment. Please use the master branch and Copy `config.json.example` to `build/config.json` and change it to match your community. -## dataPaths (array) +## dataPath (array) -`dataPaths` must contain one ore more strings pointing to a directory containing +`dataPath` must contain one or more strings pointing to a directory containing `nodes.json` and `graph.json` (both are generated by [ffmap-backend](https://github.com/ffnord/ffmap-backend)). Don't forget the trailing slash! Data may be served from a different domain with [CORS enabled]. diff --git a/config.json.example b/config.json.example index fbe1a37..219625b 100644 --- a/config.json.example +++ b/config.json.example @@ -1,5 +1,5 @@ { - "dataPaths": [ + "dataPath": [ "http://map.gl.wupper.ffrl.de/data/", "http://map.ffdus.de/data/", "http://map.fichtenfunk.freifunk.ruhr/json/" diff --git a/lib/infobox/node.js b/lib/infobox/node.js index 8eb3421..98f1b40 100644 --- a/lib/infobox/node.js +++ b/lib/infobox/node.js @@ -28,10 +28,17 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"], var latitude = d.nodeinfo.location.latitude var longitude = d.nodeinfo.location.longitude var a = document.createElement("a") - a.textContent = showLatitude(latitude) + " " + + a.innerHTML = showLatitude(latitude) + " " + showLongitude(longitude) - a.href = "geo:" + latitude + "," + longitude + if (/Android/i.test(navigator.userAgent)) + a.setAttribute("href", "geo:" + latitude + "," + longitude) + else + { + a.setAttribute("href", "https://www.openstreetmap.org/#map=18/" + latitude + "/" + longitude) + a.setAttribute("target", "_blank") + } + el.appendChild(a) } } diff --git a/lib/main.js b/lib/main.js index 9b5f7ac..dc6aa4b 100644 --- a/lib/main.js +++ b/lib/main.js @@ -114,9 +114,13 @@ function (moment, Router, L, GUI, numeral) { var router = new Router() var urls = [] - for (var i = 0; i < config.dataPaths.length; ++i) { - urls.push(config.dataPaths[i] + "nodes.json") - urls.push(config.dataPaths[i] + "graph.json") + + if (typeof config.dataPath === "string" || config.dataPath instanceof String) + config.dataPath = [config.dataPath] + + for (var i = 0; i < config.dataPath.length; ++i) { + urls.push(config.dataPath[i] + "nodes.json") + urls.push(config.dataPath[i] + "graph.json") } function update() {