From 55893949b80d0005752e7f88342b1d3b07c16e33 Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Sat, 4 Oct 2025 16:52:08 +0100 Subject: [PATCH] Add select for how many spots to display. Closes #23 --- views/webpage_spots.tpl | 9 +++++++++ webassets/js/code.js | 10 ++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/views/webpage_spots.tpl b/views/webpage_spots.tpl index d923ee1..27e5a8f 100644 --- a/views/webpage_spots.tpl +++ b/views/webpage_spots.tpl @@ -57,4 +57,13 @@
+ +

Spots to view: + +

\ No newline at end of file diff --git a/webassets/js/code.js b/webassets/js/code.js index 45edfef..8c16914 100644 --- a/webassets/js/code.js +++ b/webassets/js/code.js @@ -29,7 +29,7 @@ function buildQueryString() { str = str + getQueryStringFor(fn) + "&"; } }); - str = str + "limit=50"; + str = str + "limit=" + $("#spots-to-fetch option:selected").val(); return str; } @@ -345,9 +345,12 @@ function escapeHtml(str) { function saveSettings() { // Find all storeable UI elements, store a key of "element id:property name" mapped to the value of that // property. For a checkbox, that's the "checked" property. - return $(".storeable-checkbox").each(function() { + $(".storeable-checkbox").each(function() { localStorage.setItem($(this)[0].id + ":checked", $(this)[0].checked); }); + $(".storeable-select").each(function() { + localStorage.setItem($(this)[0].id + ":value", $(this)[0].value); + }); } // Load settings from local storage and set up the filter selectors @@ -389,6 +392,9 @@ function setUpEventListeners() { $("#filters-button").button("toggle"); $("#filters-area").hide(); }); + $("#spots-to-fetch").click(function() { + filtersUpdated(); + }); } // Startup