|
@@ -12,6 +12,9 @@ define(["d3"], function (d3) {
|
|
|
var LINK_DISTANCE = 70
|
|
|
|
|
|
function savePositions() {
|
|
|
+ if (!localStorageTest())
|
|
|
+ return
|
|
|
+
|
|
|
var save = nodes.map( function (d) {
|
|
|
return { id: d.id, x: d.x, y: d.y }
|
|
|
})
|
|
@@ -140,13 +143,16 @@ define(["d3"], function (d3) {
|
|
|
window.addEventListener("resize", resize)
|
|
|
|
|
|
self.setData = function (data) {
|
|
|
- var save = JSON.parse(localStorage.getItem("graph/nodeposition"))
|
|
|
var nodePositions = {}
|
|
|
|
|
|
- if (save)
|
|
|
- save.forEach( function (d) {
|
|
|
- nodePositions[d.id] = d
|
|
|
- })
|
|
|
+ if (localStorageTest()) {
|
|
|
+ var save = JSON.parse(localStorage.getItem("graph/nodeposition"))
|
|
|
+
|
|
|
+ if (save)
|
|
|
+ save.forEach( function (d) {
|
|
|
+ nodePositions[d.id] = d
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
links = data.graph.links.filter( function (d) {
|
|
|
return !d.vpn
|