diff --git a/lib/forcegraph.js b/lib/forcegraph.js index c6d554c..eba9f19 100644 --- a/lib/forcegraph.js +++ b/lib/forcegraph.js @@ -38,10 +38,6 @@ define(['d3', 'helper'], function (d3, helper) { } function savePositions() { - if (!helper.localStorageTest()) { - return; - } - var save = intNodes.map(function (d) { return { id: d.o.id, x: d.x, y: d.y }; }); @@ -721,22 +717,20 @@ define(['d3', 'helper'], function (d3, helper) { return !d.o.node; }); - if (helper.localStorageTest()) { - var save = JSON.parse(localStorage.getItem('graph/nodeposition')); + var save = JSON.parse(localStorage.getItem('graph/nodeposition')); - if (save) { - var nodePositions = {}; - save.forEach(function (d) { - nodePositions[d.id] = d; - }); + if (save) { + var nodePositions = {}; + save.forEach(function (d) { + nodePositions[d.id] = d; + }); - intNodes.forEach(function (d) { - if (nodePositions[d.o.id] && (d.x === undefined || d.y === undefined)) { - d.x = nodePositions[d.o.id].x; - d.y = nodePositions[d.o.id].y; - } - }); - } + intNodes.forEach(function (d) { + if (nodePositions[d.o.id] && (d.x === undefined || d.y === undefined)) { + d.x = nodePositions[d.o.id].x; + d.y = nodePositions[d.o.id].y; + } + }); } var diameter = graphDiameter(intNodes); diff --git a/lib/utils/helper.js b/lib/utils/helper.js index ddcbc04..7693907 100644 --- a/lib/utils/helper.js +++ b/lib/utils/helper.js @@ -66,17 +66,6 @@ define({ return this.dictGet(dict[k], key); }, - localStorageTest: function localStorageTest() { - var test = 'test'; - try { - localStorage.setItem(test, test); - localStorage.removeItem(test); - return true; - } catch (e) { - return false; - } - }, - listReplace: function listReplace(s, subst) { for (var key in subst) { var re = new RegExp(key, 'g');