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 e1ae3c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 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
18 changes: 9 additions & 9 deletions static/js/tutorials.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
document.querySelectorAll('.pill-lang').forEach(e => search.helper.state.facetsRefinements.languages.includes(e.textContent) ? e.classList.add('highlight') : e.classList.remove('highlight'));
const { TypesenseInstantSearchAdapter, instantsearch } = window;
const observer = lozad();

Expand Down Expand Up @@ -187,29 +186,30 @@ search.addWidgets([

search.start();
search.on('render', function() {
if (search.helper.state.facetsRefinements.languages.length) {
document.getElementById("filter-languages").textContent = "Languages (" + search.helper.state.facetsRefinements.languages.length + ")";
if (search.helper.state.disjunctiveFacetsRefinements.languages && search.helper.state.disjunctiveFacetsRefinements.languages.length) {
document.getElementById("filter-languages").textContent = "Languages (" + search.helper.state.disjunctiveFacetsRefinements.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.disjunctiveFacetsRefinements.languages && search.helper.state.facetsRefinements.viamcomponents) {
document.querySelectorAll('.pill-lang').forEach(e => search.helper.state.disjunctiveFacetsRefinements.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 e1ae3c3

Please sign in to comment.