From f9b151ccfdf07e72f6358fdd9287b2f0fea208b2 Mon Sep 17 00:00:00 2001 From: MrOtherGuy Date: Sat, 18 Jul 2020 11:39:59 +0300 Subject: [PATCH] properly store current primary and secondary nodes --- html_resources/selector.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/html_resources/selector.js b/html_resources/selector.js index c589193..9e40f6a 100644 --- a/html_resources/selector.js +++ b/html_resources/selector.js @@ -46,23 +46,23 @@ function fetchWithType(url){ } let currentCategory = new (function(){ - const currentPrimaryNode = null; - const currentSecondaryNode = null; + let currentPrimaryNode = null; + let currentSecondaryNode = null; // TODO make filenames store ONLY the top level fileNames // let currentTopLevelFileNames = null; this.set = function(t,secondary){ - let targetNode; if(secondary){ - targetNode = currentSecondaryNode; + currentSecondaryNode && currentSecondaryNode.classList.remove("currentCategory"); + currentSecondaryNode = t; + currentSecondaryNode.classList.add("currentCategory"); }else{ - targetNode = currentPrimaryNode; + currentPrimaryNode && currentPrimaryNode.classList.remove("currentCategory"); + currentPrimaryNode = t; + currentPrimaryNode.classList.add("currentCategory"); } - targetNode && targetNode.classList.remove("currentCategory"); - targetNode = t; - targetNode.classList.add("currentCategory"); if(!secondary){ currentTopLevelFileNames = DB.query(t.textContent); }