From 8497a5f833c95495e8271f70dbaa7721481220a4 Mon Sep 17 00:00:00 2001 From: anoy Date: Thu, 21 Apr 2016 22:34:21 +0200 Subject: [PATCH] reimplement feature 'encoded url' (#16) change symbol names for better readability beautify location-sidebar cleanup sourcecode * change symbols to unicode-names * reimplement feature 'encoded url' --- lib/gui.js | 2 +- lib/map.js | 6 +++--- lib/router.js | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/gui.js b/lib/gui.js index ff52361..4ce989d 100644 --- a/lib/gui.js +++ b/lib/gui.js @@ -57,7 +57,7 @@ function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Legend, Linklist, contentDiv.appendChild(buttons) var buttonToggle = document.createElement("button") - buttonToggle.textContent = "" + buttonToggle.textContent = "\uF133" buttonToggle.onclick = function () { if (content.constructor === Map) router.view("g") diff --git a/lib/map.js b/lib/map.js index bd45447..a9aa8f2 100644 --- a/lib/map.js +++ b/lib/map.js @@ -18,7 +18,7 @@ define(["map/clientlayer", "map/labelslayer", onAdd: function () { var button = L.DomUtil.create("button", "add-layer") - button.textContent = "" + button.textContent = "\uF2C7" // L.DomEvent.disableClickPropagation(button) // Click propagation isn't disabled as this causes problems with the @@ -46,7 +46,7 @@ define(["map/clientlayer", "map/labelslayer", onAdd: function () { var button = L.DomUtil.create("button", "locate-user") - button.textContent = "" + button.textContent = "\uF2E9" L.DomEvent.disableClickPropagation(button) L.DomEvent.addListener(button, "click", this.onClick, this) @@ -85,7 +85,7 @@ define(["map/clientlayer", "map/labelslayer", onAdd: function () { var button = L.DomUtil.create("button", "coord-picker") - button.textContent = "" + button.textContent = "\uF2A6" // Click propagation isn't disabled as this causes problems with the // location picking mode; instead propagation is stopped in onClick(). diff --git a/lib/router.js b/lib/router.js index 7aa6aae..fb56bb1 100644 --- a/lib/router.js +++ b/lib/router.js @@ -78,6 +78,8 @@ define(function () { if (!s) return false + s = decodeURIComponent(s) + if (!s.startsWith("#!")) return false @@ -94,7 +96,7 @@ define(function () { var id if (args[0] === "n") { - id = decodeURIComponent(args[1]) + id = args[1] if (id in objects.nodes) { currentObject = { node: objects.nodes[id] } gotoNode(objects.nodes[id]) @@ -103,7 +105,7 @@ define(function () { } if (args[0] === "l") { - id = decodeURIComponent(args[1]) + id = args[1] if (id in objects.links) { currentObject = { link: objects.links[id] } gotoLink(objects.links[id])