勛圖窪蹋

Search

Search results

) // handles "show 4, reveal 4 at a time" for every facet group except the first (Type). showMoreButtonContainerTemplate: { template: ``, showMoreButtonClass: "searchstax-facet-show-more-container" } } }); searchstax.addSearchSortingWidget("search-sorting-container", { templates: { main: { template: ` {{#searchExecuted}} {{#hasResultsOrExternalPromotions}}
{{/hasResultsOrExternalPromotions}} {{/searchExecuted}} `, selectId: `searchstax-search-order-select`, }, }, }); searchstax.addSearchResultsWidget("searchstax-results-container", { renderMethod: renderConfig.resultsWidget.renderMethod, templates: { // OUTER WRAPPER ��� mirrors original structure & IDs mainTemplate: { template: `
`, // where SearchStax injects individual results searchResultsContainerId: "searchstax-search-results" }, searchResultTemplate: { template: `
  • `, searchResultUniqueIdAttribute: "data-searchstax-unique-result-id" }, // NO RESULTS ��� you can keep your existing styling here or tweak later noSearchResultTemplate: { template: ` {{#searchExecuted}}
    Showing no results for "{{ searchTerm }}"
    {{#spellingSuggestion}}  Did you mean {{ spellingSuggestion }} ? {{/spellingSuggestion}}
    • Try searching for related terms or topics.
    • Click the ���X��� in the search box to reset your search.
    {{/searchExecuted}} ` } } }); searchstax.addPaginationWidget("searchstax-pagination-container", { templates: { mainTemplate: { template: ` {{#results.length}} {{/results.length}} `, previousButtonClass: "searchstax-pagination-previous", nextButtonClass: "searchstax-pagination-next" }, infiniteScrollTemplate: { template: ` {{#results.length}} {{/results.length}} `, loadMoreButtonClass: "searchstax-pagination-load-more" } } }); searchstax.addRelatedSearchesWidget( "searchstax-related-searches-container", { relatedSearchesURL: config.relatedSearchesURL, relatedSearchesAPIKey: config.relatedSearchesAPIKey, templates: { main: { template: ` {{#hasRelatedSearches}} {{/hasRelatedSearches}} `, relatedSearchesContainerClass: `searchstax-related-search`, }, relatedSearch: { template: ` `, relatedSearchContainerClass: `searchstax-related-search-item`, }, }, } ); searchstax.addExternalPromotionsWidget( "searchstax-external-promotions-layout-container", { templates: { mainTemplate: { template: ` {{#hasExternalPromotions}}
    {{/hasExternalPromotions}} `, externalPromotionsContainerId: "searchstax-external-promotions-container" }, externalPromotion: { template: ` ` } } } ); const currentViewStyle = localStorage.getItem("viewStyle") || "list"; console.log('currentViewStyle', currentViewStyle); const viewStyleElement = document.getElementById("icon-view-style"); const toggleElement = document.getElementById("toggle-view-style"); viewStyleElement.classList.add(`icon-${currentViewStyle}`); if(currentViewStyle === 'list'){ toggleElement.setAttribute("aria-label", "View Style Change Button. Current view style is: list"); } else { toggleElement.setAttribute("aria-label", "View Style Change Button. Current view style is: grid"); } // add class to .searchstax-results-container const searchResultsContainer = document.getElementById("searchstax-results-container"); searchResultsContainer.classList.add(`searchstax-results-container-${currentViewStyle}`); const changeViewStyle = () => { const currentViewStyle = localStorage.getItem("viewStyle") || "list"; const newViewStyle = currentViewStyle === "list" ? "grid" : "list"; localStorage.setItem("viewStyle", newViewStyle); searchResultsContainer.classList.add(`searchstax-results-container-${newViewStyle}`); searchResultsContainer.classList.remove(`searchstax-results-container-${currentViewStyle}`); viewStyleElement.classList.remove(`icon-${currentViewStyle}`); viewStyleElement.classList.add(`icon-${newViewStyle}`); const accessibilityElement = document.createElement('span'); accessibilityElement.setAttribute('id', 'searchAccessibility'); accessibilityElement.innerHTML = newViewStyle === 'grid' ? 'View style changed to grid view' : 'View style changed to list view'; if(newViewStyle === 'list'){ toggleElement.setAttribute("aria-label", "View Style Change Button. Current view style is: list"); } else { toggleElement.setAttribute("aria-label", "View Style Change Button. Current view style is: grid"); } const existingContainerElement = document.getElementById('searchAccessibilityContainer'); if(existingContainerElement) { setTimeout(() => { existingContainerElement.appendChild(accessibilityElement); }, 100); } } toggleElement.addEventListener('keyup', (event) => { if (event.code === 'Space' || event.code === 'Enter') { changeViewStyle() } }) // on click of #toggle-view-style change the view style toggleElement.addEventListener("click", function() { changeViewStyle() }); }; document.head.appendChild(script); };