From 4fc81dd0c5dc790aca1c157ebae04d1a92f9fbcf Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Thu, 5 Feb 2026 12:45:52 +0000 Subject: [PATCH] style(templates): modernize JS to arrow functions and const/let Convert all remaining function declarations, var usage, and string concatenation across base, add, checkin, and data templates. --- templates/add.html | 24 +++++++++++------------ templates/base.html | 44 +++++++++++++++++++++--------------------- templates/checkin.html | 4 ++-- templates/data.html | 22 ++++++++++----------- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/templates/add.html b/templates/add.html index ce81e68..9521494 100644 --- a/templates/add.html +++ b/templates/add.html @@ -7,7 +7,7 @@ let _searchTimeout = null; let _nearbyCafes = []; - function locateUser(btn) { + const locateUser = (btn) => { const errorEl = document.getElementById('nearby-error'); const searchWrap = document.getElementById('nearby-search-wrap'); errorEl.classList.add('hidden'); @@ -44,9 +44,9 @@ }, { enableHighAccuracy: true, timeout: 15000 } ); - } + }; - function onSearchInput(input) { + const onSearchInput = (input) => { clearTimeout(_searchTimeout); const resultsEl = document.getElementById('nearby-results'); @@ -59,9 +59,9 @@ _searchTimeout = setTimeout(() => { searchNearby(input.value.trim()); }, 350); - } + }; - function toggleCitySearch(checkbox) { + const toggleCitySearch = (checkbox) => { const locateBtn = document.getElementById('locate-btn'); const cityWrap = document.getElementById('city-search-wrap'); const searchWrap = document.getElementById('nearby-search-wrap'); @@ -84,9 +84,9 @@ resultsEl.classList.add('hidden'); resultsEl.innerHTML = ''; } - } + }; - async function searchNearby(query) { + const searchNearby = async (query) => { const resultsEl = document.getElementById('nearby-results'); const errorEl = document.getElementById('nearby-error'); const spinnerEl = document.getElementById('nearby-spinner'); @@ -135,9 +135,9 @@ } finally { spinnerEl.classList.add('hidden'); } - } + }; - function selectPlace(index) { + const selectPlace = (index) => { const cafe = _nearbyCafes[index]; if (!cafe) return; @@ -151,13 +151,13 @@ document.getElementById('nearby-results').classList.add('hidden'); document.getElementById('nearby-search').value = ''; - } + }; - function escapeHtml(text) { + const escapeHtml = (text) => { const el = document.createElement('span'); el.textContent = text; return el.innerHTML; - } + }; {% endblock %} diff --git a/templates/base.html b/templates/base.html index f4ecba8..db32060 100644 --- a/templates/base.html +++ b/templates/base.html @@ -12,23 +12,23 @@ > {% block head %}{% endblock %} {% endblock %} diff --git a/templates/data.html b/templates/data.html index 6a46992..6232e10 100644 --- a/templates/data.html +++ b/templates/data.html @@ -81,24 +81,24 @@