From 1cbfce927905510670becaf98663887f3bbc7fc5 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Thu, 22 Sep 2022 10:53:27 -0400 Subject: [PATCH] sanitize html --- public-typescript/lotOccupancySearch.js | 39 +++------- public-typescript/lotOccupancySearch.ts | 76 ++++++-------------- public-typescript/lotSearch.js | 31 +++----- public-typescript/lotSearch.ts | 45 +++++------- public-typescript/mapSearch.js | 3 +- public-typescript/mapSearch.ts | 4 +- public/javascripts/lotOccupancySearch.min.js | 2 +- public/javascripts/lotSearch.min.js | 2 +- public/javascripts/mapSearch.min.js | 2 +- 9 files changed, 64 insertions(+), 140 deletions(-) diff --git a/public-typescript/lotOccupancySearch.js b/public-typescript/lotOccupancySearch.js index 679dc2be..27d76fe8 100644 --- a/public-typescript/lotOccupancySearch.js +++ b/public-typescript/lotOccupancySearch.js @@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const urlPrefix = document.querySelector("main").dataset.urlPrefix; const searchFilterFormElement = document.querySelector("#form--searchFilters"); const searchResultsContainerElement = document.querySelector("#container--searchResults"); - const limit = Number.parseInt(document.querySelector("#searchFilter--limit") - .value, 10); + const limit = Number.parseInt(document.querySelector("#searchFilter--limit").value, 10); const offsetElement = document.querySelector("#searchFilter--offset"); const getLotOccupancies = () => { const offset = Number.parseInt(offsetElement.value, 10); @@ -21,7 +20,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); searchResultsContainerElement.innerHTML = '
' + '

There are no ' + - exports.aliases.occupancy.toLowerCase() + + cityssm.escapeHTML(exports.aliases.occupancy.toLowerCase()) + " records that meet the search criteria.

" + "
"; return; @@ -30,11 +29,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); const nowDateString = cityssm.dateToString(new Date()); for (const lotOccupancy of responseJSON.lotOccupancies) { let occupancyTimeHTML = ""; - if (lotOccupancy.occupancyStartDateString <= - nowDateString && + if (lotOccupancy.occupancyStartDateString <= nowDateString && (lotOccupancy.occupancyEndDateString === "" || - lotOccupancy.occupancyEndDateString >= - nowDateString)) { + lotOccupancy.occupancyEndDateString >= nowDateString)) { occupancyTimeHTML = '"; + occupantsHTML += cityssm.escapeHTML(occupant.occupantName) + "
"; } resultsTbodyElement.insertAdjacentHTML("beforeend", "" + - "" + - occupancyTimeHTML + - "" + + ("" + occupancyTimeHTML + "") + ("" + '" + "") + - ("" + - lotOccupancy.occupancyStartDateString + - "") + + ("" + lotOccupancy.occupancyStartDateString + "") + ("" + (lotOccupancy.occupancyEndDate ? lotOccupancy.occupancyEndDateString @@ -99,17 +90,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); '' + "" + "" + - "" + - "" + + ("") + + ("") + "" + "" + - "" + + ("") + "" + "
" + - exports.aliases.occupancy + - " Type" + - exports.aliases.lot + - "" + cityssm.escapeHTML(exports.aliases.occupancy) + " Type" + cityssm.escapeHTML(exports.aliases.lot) + "Start DateEnd Date" + - exports.aliases.occupants + - "" + cityssm.escapeHTML(exports.aliases.occupants) + "
" + '
' + @@ -141,9 +126,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); : "") + "
") + ""; - searchResultsContainerElement - .querySelector("table") - .append(resultsTbodyElement); + searchResultsContainerElement.querySelector("table").append(resultsTbodyElement); if (offset > 0) { searchResultsContainerElement .querySelector("button[data-page='previous']") diff --git a/public-typescript/lotOccupancySearch.ts b/public-typescript/lotOccupancySearch.ts index bd33777c..5dd2ac13 100644 --- a/public-typescript/lotOccupancySearch.ts +++ b/public-typescript/lotOccupancySearch.ts @@ -17,13 +17,10 @@ declare const cityssm: cityssmGlobal; ) as HTMLElement; const limit = Number.parseInt( - (document.querySelector("#searchFilter--limit") as HTMLInputElement) - .value, + (document.querySelector("#searchFilter--limit") as HTMLInputElement).value, 10 ); - const offsetElement = document.querySelector( - "#searchFilter--offset" - ) as HTMLInputElement; + const offsetElement = document.querySelector("#searchFilter--offset") as HTMLInputElement; const getLotOccupancies = () => { const offset = Number.parseInt(offsetElement.value, 10); @@ -39,15 +36,12 @@ declare const cityssm: cityssmGlobal; cityssm.postJSON( urlPrefix + "/lotOccupancies/doSearchLotOccupancies", searchFilterFormElement, - (responseJSON: { - count: number; - lotOccupancies: recordTypes.LotOccupancy[]; - }) => { + (responseJSON: { count: number; lotOccupancies: recordTypes.LotOccupancy[] }) => { if (responseJSON.lotOccupancies.length === 0) { searchResultsContainerElement.innerHTML = '
' + '

There are no ' + - exports.aliases.occupancy.toLowerCase() + + cityssm.escapeHTML(exports.aliases.occupancy.toLowerCase()) + " records that meet the search criteria.

" + "
"; @@ -62,19 +56,15 @@ declare const cityssm: cityssmGlobal; let occupancyTimeHTML = ""; if ( - lotOccupancy.occupancyStartDateString <= - nowDateString && + lotOccupancy.occupancyStartDateString <= nowDateString && (lotOccupancy.occupancyEndDateString === "" || - lotOccupancy.occupancyEndDateString >= - nowDateString) + lotOccupancy.occupancyEndDateString >= nowDateString) ) { occupancyTimeHTML = ''; - } else if ( - lotOccupancy.occupancyStartDateString > nowDateString - ) { + } else if (lotOccupancy.occupancyStartDateString > nowDateString) { occupancyTimeHTML = '"; + occupantsHTML += cityssm.escapeHTML(occupant.occupantName) + "
"; } resultsTbodyElement.insertAdjacentHTML( "beforeend", "
" + - "" + + ("") + ("") + ("") + - ("") + + ("") + ("
" + - occupancyTimeHTML + - "" + occupancyTimeHTML + "" + '' + - cityssm.escapeHTML( - lotOccupancy.occupancyType as string - ) + + cityssm.escapeHTML(lotOccupancy.occupancyType as string) + "" + "" + @@ -122,9 +106,7 @@ declare const cityssm: cityssmGlobal; cityssm.escapeHTML(lotOccupancy.mapName || "") + "" + "" + - lotOccupancy.occupancyStartDateString + - "" + lotOccupancy.occupancyStartDateString + "" + (lotOccupancy.occupancyEndDate ? lotOccupancy.occupancyEndDateString @@ -141,17 +123,11 @@ declare const cityssm: cityssmGlobal; '' + "" + "" + - "" + - "" + + ("") + + ("") + "" + "" + - "" + + ("") + "" + "
" + - exports.aliases.occupancy + - " Type" + - exports.aliases.lot + - "" + cityssm.escapeHTML(exports.aliases.occupancy) + " Type" + cityssm.escapeHTML(exports.aliases.lot) + "Start DateEnd Date" + - exports.aliases.occupants + - "" + cityssm.escapeHTML(exports.aliases.occupants) + "
" + '
' + @@ -184,17 +160,12 @@ declare const cityssm: cityssmGlobal; "
") + ""; - searchResultsContainerElement - .querySelector("table") - .append(resultsTbodyElement); + searchResultsContainerElement.querySelector("table").append(resultsTbodyElement); if (offset > 0) { searchResultsContainerElement .querySelector("button[data-page='previous']") - .addEventListener( - "click", - previousAndGetLotOccupancies - ); + .addEventListener("click", previousAndGetLotOccupancies); } if (limit + offset < responseJSON.count) { @@ -220,21 +191,16 @@ declare const cityssm: cityssmGlobal; }; const nextAndGetLotOccupancies = () => { - offsetElement.value = ( - Number.parseInt(offsetElement.value, 10) + limit - ).toString(); + offsetElement.value = (Number.parseInt(offsetElement.value, 10) + limit).toString(); getLotOccupancies(); }; - const filterElements = searchFilterFormElement.querySelectorAll( - "input, select" - ) as NodeListOf; + const filterElements = searchFilterFormElement.querySelectorAll("input, select") as NodeListOf< + HTMLInputElement | HTMLSelectElement + >; for (const filterElement of filterElements) { - filterElement.addEventListener( - "change", - resetOffsetAndGetLotOccupancies - ); + filterElement.addEventListener("change", resetOffsetAndGetLotOccupancies); } searchFilterFormElement.addEventListener("submit", (formEvent) => { diff --git a/public-typescript/lotSearch.js b/public-typescript/lotSearch.js index 9c035646..1671bb8d 100644 --- a/public-typescript/lotSearch.js +++ b/public-typescript/lotSearch.js @@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); const urlPrefix = document.querySelector("main").dataset.urlPrefix; const searchFilterFormElement = document.querySelector("#form--searchFilters"); const searchResultsContainerElement = document.querySelector("#container--searchResults"); - const limit = Number.parseInt(document.querySelector("#searchFilter--limit") - .value, 10); + const limit = Number.parseInt(document.querySelector("#searchFilter--limit").value, 10); const offsetElement = document.querySelector("#searchFilter--offset"); const getLots = () => { const offset = Number.parseInt(offsetElement.value, 10); @@ -35,7 +34,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); "/lots/" + lot.lotId + '">' + - lot.lotName + + cityssm.escapeHTML(lot.lotName) + "" + "") + ("") + - "" + + ("") + ("
" + @@ -44,14 +43,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); "/maps/" + lot.mapId + '">' + - lot.mapName + + (lot.mapName + ? cityssm.escapeHTML(lot.mapName) + : '(No Name)') + "" + "" + - lot.lotType + - "" + cityssm.escapeHTML(lot.lotType) + "" + - lot.lotStatus + + cityssm.escapeHTML(lot.lotStatus) + "
" + (lot.lotOccupancyCount > 0 ? 'Currently Occupied' @@ -62,15 +61,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); searchResultsContainerElement.innerHTML = '' + "" + - "" + - "" + - "" + + ("") + + ("") + + ("") + "" + "" + "
" + - exports.aliases.lot + - "" + - exports.aliases.map + - "" + - exports.aliases.lot + - " Type" + cityssm.escapeHTML(exports.aliases.lot) + "" + cityssm.escapeHTML(exports.aliases.map) + "" + cityssm.escapeHTML(exports.aliases.lot) + " TypeStatus
" + @@ -103,9 +96,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); : "") + "") + ""; - searchResultsContainerElement - .querySelector("table") - .append(resultsTbodyElement); + searchResultsContainerElement.querySelector("table").append(resultsTbodyElement); if (offset > 0) { searchResultsContainerElement .querySelector("button[data-page='previous']") diff --git a/public-typescript/lotSearch.ts b/public-typescript/lotSearch.ts index 14392503..a7af7368 100644 --- a/public-typescript/lotSearch.ts +++ b/public-typescript/lotSearch.ts @@ -17,13 +17,10 @@ declare const cityssm: cityssmGlobal; ) as HTMLElement; const limit = Number.parseInt( - (document.querySelector("#searchFilter--limit") as HTMLInputElement) - .value, + (document.querySelector("#searchFilter--limit") as HTMLInputElement).value, 10 ); - const offsetElement = document.querySelector( - "#searchFilter--offset" - ) as HTMLInputElement; + const offsetElement = document.querySelector("#searchFilter--offset") as HTMLInputElement; const getLots = () => { const offset = Number.parseInt(offsetElement.value, 10); @@ -63,7 +60,7 @@ declare const cityssm: cityssmGlobal; "/lots/" + lot.lotId + '">' + - lot.lotName + + cityssm.escapeHTML(lot.lotName) + "" + "") + ("") + - "" + + ("") + ("
" + @@ -72,14 +69,14 @@ declare const cityssm: cityssmGlobal; "/maps/" + lot.mapId + '">' + - lot.mapName + + (lot.mapName + ? cityssm.escapeHTML(lot.mapName) + : '(No Name)') + "" + "" + - lot.lotType + - "" + cityssm.escapeHTML(lot.lotType) + "" + - lot.lotStatus + + cityssm.escapeHTML(lot.lotStatus) + "
" + (lot.lotOccupancyCount > 0 ? 'Currently Occupied' @@ -92,15 +89,9 @@ declare const cityssm: cityssmGlobal; searchResultsContainerElement.innerHTML = '' + "" + - "" + - "" + - "" + + ("") + + ("") + + ("") + "" + "" + "
" + - exports.aliases.lot + - "" + - exports.aliases.map + - "" + - exports.aliases.lot + - " Type" + cityssm.escapeHTML(exports.aliases.lot) + "" + cityssm.escapeHTML(exports.aliases.map) + "" + cityssm.escapeHTML(exports.aliases.lot) + " TypeStatus
" + @@ -134,9 +125,7 @@ declare const cityssm: cityssmGlobal; "") + ""; - searchResultsContainerElement - .querySelector("table") - .append(resultsTbodyElement); + searchResultsContainerElement.querySelector("table").append(resultsTbodyElement); if (offset > 0) { searchResultsContainerElement @@ -167,15 +156,13 @@ declare const cityssm: cityssmGlobal; }; const nextAndGetLots = () => { - offsetElement.value = ( - Number.parseInt(offsetElement.value, 10) + limit - ).toString(); + offsetElement.value = (Number.parseInt(offsetElement.value, 10) + limit).toString(); getLots(); }; - const filterElements = searchFilterFormElement.querySelectorAll( - "input, select" - ) as NodeListOf; + const filterElements = searchFilterFormElement.querySelectorAll("input, select") as NodeListOf< + HTMLInputElement | HTMLSelectElement + >; for (const filterElement of filterElements) { filterElement.addEventListener("change", resetOffsetAndGetLots); diff --git a/public-typescript/mapSearch.js b/public-typescript/mapSearch.js index d4d53cc9..390498c5 100644 --- a/public-typescript/mapSearch.js +++ b/public-typescript/mapSearch.js @@ -38,7 +38,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); continue; } searchResultCount += 1; - const mapName = map.mapName === "" ? "(No Name)" : map.mapName; searchResultsTbodyElement.insertAdjacentHTML("beforeend", "" + ("") + diff --git a/public-typescript/mapSearch.ts b/public-typescript/mapSearch.ts index 7252d358..b0a08996 100644 --- a/public-typescript/mapSearch.ts +++ b/public-typescript/mapSearch.ts @@ -62,8 +62,6 @@ declare const cityssm: cityssmGlobal; searchResultCount += 1; - const mapName = map.mapName === "" ? "(No Name)" : map.mapName; - searchResultsTbodyElement.insertAdjacentHTML( "beforeend", "" + @@ -73,7 +71,7 @@ declare const cityssm: cityssmGlobal; "/maps/" + map.mapId + '">' + - cityssm.escapeHTML(mapName) + + cityssm.escapeHTML(map.mapName || "(No Name)") + "
" + cityssm.escapeHTML(map.mapAddress1) + "") + diff --git a/public/javascripts/lotOccupancySearch.min.js b/public/javascripts/lotOccupancySearch.min.js index a461334d..a9f53487 100644 --- a/public/javascripts/lotOccupancySearch.min.js +++ b/public/javascripts/lotOccupancySearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=document.querySelector("main").dataset.urlPrefix,t=document.querySelector("#form--searchFilters"),a=document.querySelector("#container--searchResults"),s=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),c=document.querySelector("#searchFilter--offset"),i=()=>{const i=Number.parseInt(c.value,10);a.innerHTML='

Loading '+exports.aliases.occupancies+"...
",cityssm.postJSON(e+"/lotOccupancies/doSearchLotOccupancies",t,t=>{if(0===t.lotOccupancies.length)return void(a.innerHTML='

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

");const c=document.createElement("tbody"),n=cityssm.dateToString(new Date);for(const a of t.lotOccupancies){let t="";t=a.occupancyStartDateString<=n&&(""===a.occupancyEndDateString||a.occupancyEndDateString>=n)?'':a.occupancyStartDateString>n?'':'';let s="";for(const e of a.lotOccupancyOccupants)s+=cityssm.escapeHTML(e.occupantName)+"
";c.insertAdjacentHTML("beforeend","")}a.innerHTML='
" + '' + - cityssm.escapeHTML(mapName) + + cityssm.escapeHTML(map.mapName || "(No Name)") + "
" + cityssm.escapeHTML(map.mapAddress1) + "
"+t+''+cityssm.escapeHTML(a.occupancyType)+""+(a.lotName?cityssm.escapeHTML(a.lotName):'(No '+cityssm.escapeHTML(exports.aliases.lot)+")")+'
'+cityssm.escapeHTML(a.mapName||"")+"
"+a.occupancyStartDateString+""+(a.occupancyEndDate?a.occupancyEndDateString:'(No End Date)')+""+s+"
'+exports.aliases.occupancy+" Type"+exports.aliases.lot+"Start DateEnd Date"+exports.aliases.occupants+'
Displaying '+(i+1).toString()+" to "+Math.min(t.count,s+i)+" of "+t.count+'
'+(i>0?'
':"")+(s+i
':"")+"
",a.querySelector("table").append(c),i>0&&a.querySelector("button[data-page='previous']").addEventListener("click",r),s+i{c.value="0",i()},r=()=>{c.value=Math.max(Number.parseInt(c.value,10)-s,0).toString(),i()},o=()=>{c.value=(Number.parseInt(c.value,10)+s).toString(),i()},l=t.querySelectorAll("input, select");for(const e of l)e.addEventListener("change",n);t.addEventListener("submit",e=>{e.preventDefault(),n()}),i()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=document.querySelector("main").dataset.urlPrefix,t=document.querySelector("#form--searchFilters"),a=document.querySelector("#container--searchResults"),s=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),c=document.querySelector("#searchFilter--offset"),i=()=>{const i=Number.parseInt(c.value,10);a.innerHTML='

Loading '+exports.aliases.occupancies+"...
",cityssm.postJSON(e+"/lotOccupancies/doSearchLotOccupancies",t,t=>{if(0===t.lotOccupancies.length)return void(a.innerHTML='

There are no '+cityssm.escapeHTML(exports.aliases.occupancy.toLowerCase())+" records that meet the search criteria.

");const c=document.createElement("tbody"),n=cityssm.dateToString(new Date);for(const a of t.lotOccupancies){let t="";t=a.occupancyStartDateString<=n&&(""===a.occupancyEndDateString||a.occupancyEndDateString>=n)?'':a.occupancyStartDateString>n?'':'';let s="";for(const e of a.lotOccupancyOccupants)s+=cityssm.escapeHTML(e.occupantName)+"
";c.insertAdjacentHTML("beforeend","
")}a.innerHTML='
"+t+''+cityssm.escapeHTML(a.occupancyType)+""+(a.lotName?cityssm.escapeHTML(a.lotName):'(No '+cityssm.escapeHTML(exports.aliases.lot)+")")+'
'+cityssm.escapeHTML(a.mapName||"")+"
"+a.occupancyStartDateString+""+(a.occupancyEndDate?a.occupancyEndDateString:'(No End Date)')+""+s+"
'+cityssm.escapeHTML(exports.aliases.occupancy)+" Type"+cityssm.escapeHTML(exports.aliases.lot)+"Start DateEnd Date"+cityssm.escapeHTML(exports.aliases.occupants)+'
Displaying '+(i+1).toString()+" to "+Math.min(t.count,s+i)+" of "+t.count+'
'+(i>0?'
':"")+(s+i
':"")+"
",a.querySelector("table").append(c),i>0&&a.querySelector("button[data-page='previous']").addEventListener("click",r),s+i{c.value="0",i()},r=()=>{c.value=Math.max(Number.parseInt(c.value,10)-s,0).toString(),i()},o=()=>{c.value=(Number.parseInt(c.value,10)+s).toString(),i()},l=t.querySelectorAll("input, select");for(const e of l)e.addEventListener("change",n);t.addEventListener("submit",e=>{e.preventDefault(),n()}),i()})(); \ No newline at end of file diff --git a/public/javascripts/lotSearch.min.js b/public/javascripts/lotSearch.min.js index a0a0ac0f..2d360136 100644 --- a/public/javascripts/lotSearch.min.js +++ b/public/javascripts/lotSearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=document.querySelector("main").dataset.urlPrefix,t=document.querySelector("#form--searchFilters"),s=document.querySelector("#container--searchResults"),a=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),r=document.querySelector("#searchFilter--offset"),i=()=>{const i=Number.parseInt(r.value,10);s.innerHTML='

Loading '+exports.aliases.lots+"...
",cityssm.postJSON(e+"/lots/doSearchLots",t,t=>{if(0===t.lots.length)return void(s.innerHTML='

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

");const r=document.createElement("tbody");for(const s of t.lots)r.insertAdjacentHTML("beforeend",'
");s.innerHTML='
'+s.lotName+''+s.mapName+""+s.lotType+""+s.lotStatus+"
"+(s.lotOccupancyCount>0?'Currently Occupied':"")+"
'+exports.aliases.lot+""+exports.aliases.map+""+exports.aliases.lot+' TypeStatus
Displaying '+(i+1).toString()+" to "+Math.min(t.count,a+i)+" of "+t.count+'
'+(i>0?'
':"")+(a+i
':"")+"
",s.querySelector("table").append(r),i>0&&s.querySelector("button[data-page='previous']").addEventListener("click",o),a+i{r.value="0",i()},o=()=>{r.value=Math.max(Number.parseInt(r.value,10)-a,0).toString(),i()},n=()=>{r.value=(Number.parseInt(r.value,10)+a).toString(),i()},d=t.querySelectorAll("input, select");for(const e of d)e.addEventListener("change",l);t.addEventListener("submit",e=>{e.preventDefault(),l()}),i()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=document.querySelector("main").dataset.urlPrefix,t=document.querySelector("#form--searchFilters"),s=document.querySelector("#container--searchResults"),a=Number.parseInt(document.querySelector("#searchFilter--limit").value,10),i=document.querySelector("#searchFilter--offset"),r=()=>{const r=Number.parseInt(i.value,10);s.innerHTML='

Loading '+exports.aliases.lots+"...
",cityssm.postJSON(e+"/lots/doSearchLots",t,t=>{if(0===t.lots.length)return void(s.innerHTML='

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

");const i=document.createElement("tbody");for(const s of t.lots)i.insertAdjacentHTML("beforeend",'
");s.innerHTML='
'+cityssm.escapeHTML(s.lotName)+''+(s.mapName?cityssm.escapeHTML(s.mapName):'(No Name)')+""+cityssm.escapeHTML(s.lotType)+""+cityssm.escapeHTML(s.lotStatus)+"
"+(s.lotOccupancyCount>0?'Currently Occupied':"")+"
'+cityssm.escapeHTML(exports.aliases.lot)+""+cityssm.escapeHTML(exports.aliases.map)+""+cityssm.escapeHTML(exports.aliases.lot)+' TypeStatus
Displaying '+(r+1).toString()+" to "+Math.min(t.count,a+r)+" of "+t.count+'
'+(r>0?'
':"")+(a+r
':"")+"
",s.querySelector("table").append(i),r>0&&s.querySelector("button[data-page='previous']").addEventListener("click",o),a+r{i.value="0",r()},o=()=>{i.value=Math.max(Number.parseInt(i.value,10)-a,0).toString(),r()},n=()=>{i.value=(Number.parseInt(i.value,10)+a).toString(),r()},c=t.querySelectorAll("input, select");for(const e of c)e.addEventListener("change",l);t.addEventListener("submit",e=>{e.preventDefault(),l()}),r()})(); \ No newline at end of file diff --git a/public/javascripts/mapSearch.min.js b/public/javascripts/mapSearch.min.js index 053c2ffd..ac05bcef 100644 --- a/public/javascripts/mapSearch.min.js +++ b/public/javascripts/mapSearch.min.js @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=document.querySelector("main").dataset.urlPrefix,t=exports.maps,a=document.querySelector("#searchFilter--map"),s=document.querySelector("#container--searchResults"),r=()=>{s.innerHTML='

Loading '+exports.aliases.maps+"...
";let r=0;const i=document.createElement("tbody"),o=a.value.trim().toLowerCase().split(" ");for(const a of t){const t=(a.mapName+" "+a.mapDescription+" "+a.mapAddress1+" "+a.mapAddress2).toLowerCase();let s=!0;for(const e of o)if(!t.includes(e)){s=!1;break}if(!s)continue;r+=1;const c=""===a.mapName?"(No Name)":a.mapName;i.insertAdjacentHTML("beforeend",'
")}if(s.innerHTML="",0===r)s.innerHTML='

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

";else{const e=document.createElement("table");e.className="table is-fullwidth is-striped is-hoverable",e.innerHTML="",e.append(i),s.append(e)}};a.addEventListener("keyup",r),document.querySelector("#form--searchFilters").addEventListener("submit",e=>{e.preventDefault(),r()}),r()})(); \ No newline at end of file +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const e=document.querySelector("main").dataset.urlPrefix,t=exports.maps,a=document.querySelector("#searchFilter--map"),s=document.querySelector("#container--searchResults"),r=()=>{s.innerHTML='

Loading '+exports.aliases.maps+"...
";let r=0;const i=document.createElement("tbody"),d=a.value.trim().toLowerCase().split(" ");for(const a of t){const t=(a.mapName+" "+a.mapDescription+" "+a.mapAddress1+" "+a.mapAddress2).toLowerCase();let s=!0;for(const e of d)if(!t.includes(e)){s=!1;break}s&&(r+=1,i.insertAdjacentHTML("beforeend",'"))}if(s.innerHTML="",0===r)s.innerHTML='

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

";else{const e=document.createElement("table");e.className="table is-fullwidth is-striped is-hoverable",e.innerHTML="",e.append(i),s.append(e)}};a.addEventListener("keyup",r),document.querySelector("#form--searchFilters").addEventListener("submit",e=>{e.preventDefault(),r()}),r()})(); \ No newline at end of file
'+cityssm.escapeHTML(c)+"
"+cityssm.escapeHTML(a.mapAddress1)+'
'+(a.mapLatitude&&a.mapLongitude?'':"")+''+(a.mapSVG?'':"")+''+a.lotCount+"
"+exports.aliases.map+'CoordinatesImage'+exports.aliases.lot+" Count
'+cityssm.escapeHTML(a.mapName||"(No Name)")+"
"+cityssm.escapeHTML(a.mapAddress1)+'
'+(a.mapLatitude&&a.mapLongitude?'':"")+''+(a.mapSVG?'':"")+''+a.lotCount+"
"+exports.aliases.map+'CoordinatesImage'+exports.aliases.lot+" Count