mock_filter.html: Enable full filter hiding [#21]
This doesn't auto-skip It may also do a superfluous loop. Trying to compress now
This commit is contained in:
parent
73d7e996e5
commit
bd7baf9e5d
|
@ -276,39 +276,42 @@ filterModeElement.addEventListener("click", function(ev) {
|
|||
}
|
||||
});
|
||||
|
||||
for (var i = 0; i < filterTopics.length; ++i)
|
||||
for(var i = 0; i < filterTopics.length; ++i)
|
||||
{
|
||||
filterTopics[i].addEventListener("click", function(ev) {
|
||||
// NOTE(matt): Useful test
|
||||
// if(this.parentNode.className == "filter_topics")
|
||||
|
||||
var selectedCategory = this.childNodes[1].classList[2];
|
||||
var testMarkers = document.querySelectorAll(".cat_" + selectedCategory);
|
||||
|
||||
// TODO(matt): Fix this routine! off seems to work, but not skip
|
||||
var categorisedMarkers = document.querySelectorAll("." + selectedCategory);
|
||||
if(!(this.classList.contains("off")))
|
||||
{
|
||||
this.classList.add("off");
|
||||
var Skipping = 1;
|
||||
for (var j = 0; j < categorisedMarkers.length; ++j)
|
||||
for(var j = 0; j < testMarkers.length; ++j)
|
||||
{
|
||||
categorisedMarkers[j].classList.add("off");
|
||||
if(filterMode == "exclusive")
|
||||
var categorisedMarkers = testMarkers[j].querySelectorAll("." + selectedCategory);
|
||||
for(var k = 0; k < categorisedMarkers.length; ++k)
|
||||
{
|
||||
categorisedMarkers[j].parentNode.classList.add("skip");
|
||||
}
|
||||
else
|
||||
{
|
||||
for(var k = 0; k < categorisedMarkers[j].parentNode.childNodes.length; ++k)
|
||||
var Skipping = 1;
|
||||
categorisedMarkers[k].classList.add("off");
|
||||
if(filterMode == "exclusive")
|
||||
{
|
||||
if(!categorisedMarkers[j].parentNode.childNodes[k].contains == "off")
|
||||
{
|
||||
Skipping = 0;
|
||||
}
|
||||
testMarkers[j].classList.add("skip");
|
||||
}
|
||||
if(Skipping)
|
||||
else
|
||||
{
|
||||
categorisedMarkers[j].parentNode.classList.add("skip");
|
||||
var markerCategories = testMarkers[j].querySelectorAll(".category");
|
||||
for(var l = 0; l < markerCategories.length; ++l)
|
||||
{
|
||||
if(!markerCategories[l].classList.contains("off"))
|
||||
{
|
||||
Skipping = 0;
|
||||
}
|
||||
|
||||
}
|
||||
if(Skipping)
|
||||
{
|
||||
testMarkers[j].classList.add("skip");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,26 +319,32 @@ for (var i = 0; i < filterTopics.length; ++i)
|
|||
else
|
||||
{
|
||||
this.classList.remove("off");
|
||||
var Skipping = 0;
|
||||
for (var j = 0; j < categorisedMarkers.length; ++j)
|
||||
for(var j = 0; j < testMarkers.length; ++j)
|
||||
{
|
||||
categorisedMarkers[j].classList.remove("off");
|
||||
if(filterMode == "inclusive")
|
||||
var categorisedMarkers = testMarkers[j].querySelectorAll("." + selectedCategory);
|
||||
for(var k = 0; k < categorisedMarkers.length; ++k)
|
||||
{
|
||||
categorisedMarkers[j].parentNode.classList.remove("skip");
|
||||
}
|
||||
else
|
||||
{
|
||||
for(var k = 0; k < categorisedMarkers[j].parentNode.childNodes.length; ++k)
|
||||
var Skipping = 0;
|
||||
categorisedMarkers[k].classList.remove("off");
|
||||
if(filterMode == "inclusive")
|
||||
{
|
||||
if(categorisedMarkers[j].parentNode.childNodes[k].contains == "off")
|
||||
{
|
||||
Skipping = 1;
|
||||
}
|
||||
testMarkers[j].classList.remove("skip");
|
||||
}
|
||||
if(Skipping)
|
||||
else
|
||||
{
|
||||
categorisedMarkers[j].parentNode.classList.add("skip");
|
||||
var markerCategories = testMarkers[j].querySelectorAll(".category");
|
||||
for(var l = 0; l < markerCategories.length; ++l)
|
||||
{
|
||||
if(markerCategories[l].classList.contains("off"))
|
||||
{
|
||||
Skipping = 1;
|
||||
}
|
||||
|
||||
}
|
||||
if(!Skipping)
|
||||
{
|
||||
testMarkers[j].classList.remove("skip");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue