diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ws/node.js | 2 | ||||
-rw-r--r-- | src/ws/view.js | 35 |
2 files changed, 3 insertions, 34 deletions
diff --git a/src/ws/node.js b/src/ws/node.js index 4da3969..75fe1ec 100644 --- a/src/ws/node.js +++ b/src/ws/node.js @@ -225,7 +225,7 @@ Node.prototype.create = function() node.id = createId(this.subscribeid, this.id); { - var collapsed = getCookie(node.id+"_collapsed") == "true"; + var collapsed = localStorage.getItem(node.id+"_collapsed") == "true"; if(collapsed) { this.element.classList.add('collapsed'); diff --git a/src/ws/view.js b/src/ws/view.js index 8ed5184..7fc69bb 100644 --- a/src/ws/view.js +++ b/src/ws/view.js @@ -14,37 +14,6 @@ function createNode() } */ -var cookies = null; -function initCookie(cookie, index) -{ - const name = cookie.split('=')[0].trim(); - const value = cookie.split('=')[1]; - cookies[name] = value; -} -function initCookies() -{ - cookies = new Object(); - document.cookie.split(';').forEach(initCookie); -} -function setCookie(name, value) -{ - if(cookies == null) - { - initCookies(); - } - cookies[name] = value; - document.cookie = name + "=" + value+"; expires=Fri, 31 Dec 9999 23:59:59 GMT"; -} - -function getCookie(name) -{ - if(cookies == null) - { - initCookies(); - } - return cookies[name]; -} - function getNode(subscribeid, id) { } @@ -383,9 +352,9 @@ function collapse(e) return; // no node } - var collapsed = getCookie(id+"_collapsed") == "true"; + var collapsed = localStorage.getItem(id+"_collapsed") == "true"; collapsed = !collapsed; - setCookie(id+"_collapsed", collapsed?"true":"false"); + localStorage.setItem(id+"_collapsed", collapsed?"true":"false"); e.stopPropagation(); if(collapsed) |