From: Mike Taylor Date: Fri, 5 Jul 2013 16:27:19 +0000 (+0100) Subject: Much simpler switchView() code, what a dummy I was. X-Git-Tag: 0.9.1~307^2~3 X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=400f8f4e8a1da22f2796da885a8ac4b891f02b67;p=mkws-moved-to-github.git Much simpler switchView() code, what a dummy I was. Fixes bug MKWS-30 --- diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index bdba531..4c75a8c 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -398,36 +398,24 @@ function pagerPrev() { function switchView(view) { var targets = document.getElementById('mkwsTargets'); - var results = document.getElementById('mkwsResults'); - var records = document.getElementById('mkwsRecords'); + var results = document.getElementById('mkwsResults') || + document.getElementById('mkwsRecords'); var blanket = document.getElementById('mkwsBlanket'); switch(view) { case 'targets': if (targets) targets.style.display = "block"; - if (results) { - results.style.display = "none"; - } else { - records.style.display = "none"; - } + if (results) results.style.display = "none"; if (blanket) blanket.style.display = "none"; break; case 'records': if (targets) targets.style.display = "none"; - if (results) { - results.style.display = "block"; - } else { - records.style.display = "block"; - } + if (results) results.style.display = "block"; if (blanket) blanket.style.display = "block"; break; case 'none': if (targets) targets.style.display = "none"; - if (results) { - results.style.display = "none"; - } else { - records.style.display = "none"; - } + if (results) results.style.display = "none"; if (blanket) blanket.style.display = "none"; break; default: