diff --git a/lib/map.js b/lib/map.js
index e7b4f4e..9569229 100644
--- a/lib/map.js
+++ b/lib/map.js
@@ -10,7 +10,7 @@ define(function () {
m.setStyle(iconFunc(d))
}
- m.on('click', router.node(d, false))
+ m.on('click', router.node(d))
m.bindLabel(d.nodeinfo.hostname)
dict[d.nodeinfo.node_id] = m
@@ -38,7 +38,7 @@ define(function () {
}
line.bindLabel(d.source.node.nodeinfo.hostname + " – " + d.target.node.nodeinfo.hostname + "
" + showDistance(d) + " / " + showTq(d) + "")
- line.on('click', router.link(d, false))
+ line.on('click', router.link(d))
dict[linkId(d)] = line
diff --git a/lib/router.js b/lib/router.js
index 4b1d74d..fcda67b 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -15,32 +15,16 @@ define(function () {
saveState()
}
- function gotoNode(d, showMap, push) {
- showMap = trueDefault(showMap)
- push = trueDefault(push)
-
+ function gotoNode(d) {
targets.forEach( function (t) {
t.gotoNode(d)
})
-
- if (push)
- saveState( { node: d })
-
- return false
}
- function gotoLink(d, showMap, push) {
- showMap = trueDefault(showMap)
- push = trueDefault(push)
-
+ function gotoLink(d) {
targets.forEach( function (t) {
t.gotoLink(d)
})
-
- if (push)
- saveState( { link: d })
-
- return false
}
function saveState(d) {
@@ -73,20 +57,38 @@ define(function () {
var id = args[1]
if (id in objects.nodes)
- gotoNode(objects.nodes[id], true, false)
+ gotoNode(objects.nodes[id])
}
if (args[0] === "l") {
var id = args[1]
if (id in objects.links)
- gotoLink(objects.links[id], true, false)
+ gotoLink(objects.links[id])
}
}
- self.node = function (d, m, p) { return function () { return gotoNode(d, m, p) }}
- self.link = function (d, m, p) { return function () { return gotoLink(d, m, p) }}
- self.reset = resetView
+ self.node = function (d) {
+ return function () {
+ gotoNode(d)
+ saveState({ node: d })
+ return false
+ }
+ }
+
+ self.link = function (d) {
+ return function () {
+ gotoLink(d)
+ saveState({ link: d })
+ return false
+ }
+ }
+
+ self.reset = function () {
+ resetView()
+ saveState()
+ }
+
self.addMarkers = function (d) {
markers = d
}