"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.mapDescription) + "" + "") + ("" + (map.mapAddress1 ? cityssm.escapeHTML(map.mapAddress1) + "
" : "") + (map.mapAddress2 ? cityssm.escapeHTML(map.mapAddress2) + "
" : "") + (map.mapCity || map.mapProvince ? cityssm.escapeHTML(map.mapCity) + ", " + cityssm.escapeHTML(map.mapProvince) + "
" : "") + (map.mapPostalCode ? cityssm.escapeHTML(map.mapPostalCode) : "") + "") + ("" + cityssm.escapeHTML(map.mapPhoneNumber) + "") + '' + (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 + "") + "Address" + "Phone Number" + '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(); })();