"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); (() => { const urlPrefix = document.querySelector("main").dataset.urlPrefix; const maps = exports.maps; const searchFilterElement = document.querySelector("#searchFilter--map"); const searchResultsContainerElement = document.querySelector("#container--searchResults"); const renderResults = () => { searchResultsContainerElement.innerHTML = '
' + '
' + "Loading " + exports.aliases.maps + "..." + "
"; let searchResultCount = 0; const searchResultsTbodyElement = document.createElement("tbody"); const filterStringSplit = searchFilterElement.value .trim() .toLowerCase() .split(" "); for (const map of maps) { const mapSearchString = (map.mapName + " " + map.mapDescription + " " + map.mapAddress1 + " " + map.mapAddress2).toLowerCase(); let showMap = true; for (const filterStringPiece of filterStringSplit) { if (!mapSearchString.includes(filterStringPiece)) { showMap = false; break; } } if (!showMap) { continue; } searchResultCount += 1; searchResultsTbodyElement.insertAdjacentHTML("beforeend", "" + ("" + '' + cityssm.escapeHTML(map.mapName || "(No Name)") + "
" + cityssm.escapeHTML(map.mapAddress1) + "") + '' + (map.mapLatitude && map.mapLongitude ? '' : "") + "" + '' + (map.mapSVG ? '' : "") + "" + ('' + '' + map.lotCount + "" + "") + ""); } searchResultsContainerElement.innerHTML = ""; if (searchResultCount === 0) { searchResultsContainerElement.innerHTML = '
' + '

There are no ' + exports.aliases.maps.toLowerCase() + " that meet the search criteria.

" + "
"; } else { const searchResultsTableElement = document.createElement("table"); searchResultsTableElement.className = "table is-fullwidth is-striped is-hoverable has-sticky-header"; searchResultsTableElement.innerHTML = "" + "" + exports.aliases.map + "" + 'Coordinates' + 'Image' + '' + exports.aliases.lot + " Count" + ""; searchResultsTableElement.append(searchResultsTbodyElement); searchResultsContainerElement.append(searchResultsTableElement); } }; searchFilterElement.addEventListener("keyup", renderResults); document .querySelector("#form--searchFilters") .addEventListener("submit", (formEvent) => { formEvent.preventDefault(); renderResults(); }); renderResults(); })();