Skip to content

Commit

Permalink
Attempt to fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
npentrel committed Sep 5, 2023
1 parent 6d4e82a commit 18d3557
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions .htmltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ IgnoreURLs:
- "slamtec.com"
- "softroboticsinc.com"
- "universal-robots.com"
- "digikey.com"
- "ufactory.cc"
IgnoreDirs:
- "lib"
Expand Down
15 changes: 8 additions & 7 deletions static/js/tutorials.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,29 +187,30 @@ search.addWidgets([

search.start();
search.on('render', function() {
if (search.helper.state.facetsRefinements.languages.length) {
if (search.helper.state.facetsRefinements.languages && search.helper.state.facetsRefinements.languages.length) {
document.getElementById("filter-languages").textContent = "Languages (" + search.helper.state.facetsRefinements.languages.length + ")";
} else {
document.getElementById("filter-languages").textContent = "Languages";
}
if (search.helper.state.facetsRefinements.viamcomponents.length) {
if (search.helper.state.facetsRefinements.viamcomponents && search.helper.state.facetsRefinements.viamcomponents.length) {
document.getElementById("filter-components").textContent = "Components (" + search.helper.state.facetsRefinements.viamcomponents.length + ")";
} else {
document.getElementById("filter-components").textContent = "Components";
}
if (search.helper.state.facetsRefinements.viamservices.length) {
if (search.helper.state.facetsRefinements.viamservices && search.helper.state.facetsRefinements.viamservices.length) {
document.getElementById("filter-services").textContent = "Services (" + search.helper.state.facetsRefinements.viamservices.length + ")";
} else {
document.getElementById("filter-services").textContent = "Services";
}
if (search.helper.state.disjunctiveFacetsRefinements.level.length) {
if (search.helper.state.disjunctiveFacetsRefinements.level && search.helper.state.disjunctiveFacetsRefinements.level.length) {
document.getElementById("filter-level").textContent = "Level (" + search.helper.state.disjunctiveFacetsRefinements.level.length + ")";
} else {
document.getElementById("filter-level").textContent = "Level";
}

document.querySelectorAll('.pill-lang').forEach(e => search.helper.state.facetsRefinements.languages.includes(e.textContent) ? e.classList.add('pill-highlight') : e.classList.remove('pill-highlight'));
document.querySelectorAll('.pill-component').forEach(e => (search.helper.state.facetsRefinements.viamcomponents.includes(e.textContent) || search.helper.state.facetsRefinements.viamservices.includes(e.textContent)) ? e.classList.add('pill-highlight') : e.classList.remove('pill-highlight'));
if (search.helper.state.facetsRefinements && search.helper.state.facetsRefinements.languages && search.helper.state.facetsRefinements.viamcomponents) {
document.querySelectorAll('.pill-lang').forEach(e => search.helper.state.facetsRefinements.languages.includes(e.textContent) ? e.classList.add('pill-highlight') : e.classList.remove('pill-highlight'));
document.querySelectorAll('.pill-component').forEach(e => (search.helper.state.facetsRefinements.viamcomponents.includes(e.textContent) || search.helper.state.facetsRefinements.viamservices.includes(e.textContent)) ? e.classList.add('pill-highlight') : e.classList.remove('pill-highlight'));
}

observer.observe()
});

0 comments on commit 18d3557

Please sign in to comment.