tagbrowser should show target buttons that match file querystring

This commit is contained in:
MrOtherGuy 2021-05-30 20:39:58 +03:00
parent b43f70e395
commit 5dec38dfb2

View file

@ -111,6 +111,13 @@ function clearCodeBlock(){
return return
} }
function showMatchingTargets(fileNames){
for(let c of Array.from(document.querySelectorAll(".target"))){
fileNames.includes(getText(c)) ? c.classList.remove("hidden") : c.classList.add("hidden");
}
document.getElementById("targets").setAttribute("style",`--grid-rows:${Math.ceil(fileNames.length/3)}`)
}
function onCategoryClicked(categoryNode,isSecondary = false){ function onCategoryClicked(categoryNode,isSecondary = false){
clearCodeBlock(); clearCodeBlock();
@ -131,11 +138,8 @@ function onCategoryClicked(categoryNode,isSecondary = false){
} }
} }
showMatchingTargets(fileNames);
for(let c of Array.from(document.querySelectorAll(".target"))){ return
fileNames.includes(getText(c)) ? c.classList.remove("hidden") : c.classList.add("hidden");
}
document.getElementById("targets").setAttribute("style",`--grid-rows:${Math.ceil(fileNames.length/3)}`)
} }
async function onTargetClicked(target){ async function onTargetClicked(target){
@ -462,7 +466,7 @@ async function handleSearchQuery(){
Promise.all(promises) Promise.all(promises)
.then(responses => { .then(responses => {
showMatchingTargets(files);
Highlighter.parse(codeBlock,responses.join("\n\n/*************************************/\n\n")) Highlighter.parse(codeBlock,responses.join("\n\n/*************************************/\n\n"))
}); });