diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/static/main.css | 9 | ||||
| -rw-r--r-- | src/static/main.js | 7 | ||||
| -rw-r--r-- | src/templates/options.html | 11 |
3 files changed, 21 insertions, 6 deletions
diff --git a/src/static/main.css b/src/static/main.css index a591298..b47803f 100644 --- a/src/static/main.css +++ b/src/static/main.css @@ -3,3 +3,12 @@ body { margin: 0; } + +#LoadingIndicator { + animation: spin 1.75s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +}
\ No newline at end of file diff --git a/src/static/main.js b/src/static/main.js index be136a4..58052b7 100644 --- a/src/static/main.js +++ b/src/static/main.js @@ -12,6 +12,7 @@ var polygons = L.featureGroup().addTo(map); var heatmap = L.featureGroup().addTo(map); const CategoryField = document.getElementById('Category'); +const LoadingIndicator = document.getElementById('LoadingIndicator'); const DefaultSearchValue = "supermarket"; var Categories = [] @@ -25,11 +26,12 @@ var overlayMaps = { var layerControl = L.control.layers({},overlayMaps).addTo(map); function runQueryAfterLoad() { + LoadingIndicator.hidden = false; fetchAll(CategoryField.value); } async function fetchCategories() { - const response = await fetch("categories"); + const response = await fetch("categories.json"); try { categories = await response.json(); const CategoriesDataList = document.getElementById('CategoriesDataList'); @@ -46,7 +48,7 @@ async function fetchCategories() { } async function fetchChains() { - const response = await fetch("chains"); + const response = await fetch("chains.json"); known_store_chains = await response.json(); icons["Unknown"] = L.icon({ iconUrl: 'icons/Unknown.png', @@ -112,6 +114,7 @@ async function fetchAll(Category) { const response = await fetch(`all.json?Category=${Category}`) const shops = await response.json(); shops.forEach((shop) => addShop(shop)); + LoadingIndicator.hidden = true; } async function fetchShopHeatmap() { diff --git a/src/templates/options.html b/src/templates/options.html index 01cc89e..ca079e7 100644 --- a/src/templates/options.html +++ b/src/templates/options.html @@ -12,10 +12,13 @@ <br> <button type="submit" class="btn btn-primary">Run query</button> +</form> - <br><br> - - Read more, and find the source code here: <a href="https://git.node5.net/poi_map/about/">POI map - git.node5.net</a> +<br><br> -</form> +Read more, and find the source code here: <a href="https://git.node5.net/poi_map/about/">POI map - git.node5.net</a> +<br><br><br> +<div id="LoadingIndicator" class="text-center"> + Loading +</div> |
