diff --git a/webassets/css/style.css b/webassets/css/style.css
index 26504d7..89d5f00 100644
--- a/webassets/css/style.css
+++ b/webassets/css/style.css
@@ -47,7 +47,7 @@ div.appearing-panel {
display: none;
}
-p.filter-card-text {
+.spothole-card-text {
line-height: 2.5em !important;
}
diff --git a/webassets/js/alerts.js b/webassets/js/alerts.js
index 4e001c2..256c739 100644
--- a/webassets/js/alerts.js
+++ b/webassets/js/alerts.js
@@ -39,7 +39,7 @@ function buildQueryString() {
// Update the alerts table
function updateTable() {
// Use local time instead of UTC?
- var useLocalTime = $("#useLocalTime")[0].checked;
+ var useLocalTime = $("#timeZone")[0].value == "local";
// Populate table with headers
let table = $('
').append('
');
@@ -89,7 +89,7 @@ function addAlertRowsToTable(tbody, alerts) {
let $tr = $('
');
// Use local time instead of UTC?
- var useLocalTime = $("#useLocalTime")[0].checked;
+ var useLocalTime = $("#timeZone")[0].value == "local";
// Get times for the alert, and convert to local time if necessary.
var start_time_unix = moment.unix(a["start_time"]);
@@ -226,7 +226,7 @@ function generateMaxDurationDropdownFilterCard(band_options) {
let $card = $("
");
let $card_body = $("
");
$card_body.append(`
Duration Limit
`);
- $p = $("
");
+ $p = $("
");
$p.append("Hide any alerts lasting more than: ");
$p.append(``);
- $p2 = $("
");
+ $p2 = $("
");
$p2.append(``);
// Compile HTML elements to return
$card_body.append($p);
@@ -252,15 +252,32 @@ function filtersUpdated() {
loadAlerts();
saveSettings();
}
-// Set up UI element event listeners, after the document is ready
-function setUpEventListeners() {
- $("#filters-button").click(function() {
- $("#filters-area").toggle();
- });
- $("#close-filters-button").click(function() {
- $("#filters-button").button("toggle");
+
+// React to toggling/closing panels
+function toggleFiltersPanel() {
+ // If we are going to display the filters panel, hide the display panel
+ if (!$("#filters-area").is(":visible") && $("#display-area").is(":visible")) {
+ $("#display-area").hide();
+ $("#display-button").button("toggle");
+ }
+ $("#filters-area").toggle();
+}
+function closeFiltersPanel() {
+ $("#filters-button").button("toggle");
+ $("#filters-area").hide();
+}
+
+function toggleDisplayPanel() {
+ // If we are going to display status, load the data for the status panel, and hide the filters panel
+ if (!$("#display-area").is(":visible") && $("#filters-area").is(":visible")) {
$("#filters-area").hide();
- });
+ $("#filters-button").button("toggle");
+ }
+ $("#display-area").toggle();
+}
+function closeDisplayPanel() {
+ $("#display-button").button("toggle");
+ $("#display-area").hide();
}
// Startup
@@ -269,6 +286,4 @@ $(document).ready(function() {
loadOptions();
// Update the refresh timing display every second
setInterval(updateRefreshDisplay, 1000);
- // Set up event listeners
- setUpEventListeners();
});
\ No newline at end of file
diff --git a/webassets/js/common.js b/webassets/js/common.js
index 288abde..513ede4 100644
--- a/webassets/js/common.js
+++ b/webassets/js/common.js
@@ -34,7 +34,7 @@ function generateMultiToggleFilterCard(displayName, filterQuery, options) {
let $card = $("
");
let $card_body = $("
");
$card_body.append(`
${displayName}
`);
- $p = $("
");
+ $p = $("
");
// Create a button for each option
options.forEach(o => {
$p.append(` `);
@@ -98,7 +98,7 @@ function escapeHtml(str) {
}
// When the "use local time" field is changed, reload the table and save settings
-function localTimeUpdated() {
+function timeZoneUpdated() {
updateTable();
saveSettings();
}
@@ -108,10 +108,13 @@ 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.
$(".storeable-checkbox").each(function() {
- localStorage.setItem("#" + $(this)[0].id + ":checked", $(this)[0].checked);
+ localStorage.setItem("#" + $(this)[0].id + ":checked", JSON.stringify($(this)[0].checked));
});
$(".storeable-select").each(function() {
- localStorage.setItem("#" + $(this)[0].id + ":value", $(this)[0].value);
+ localStorage.setItem("#" + $(this)[0].id + ":value", JSON.stringify($(this)[0].value));
+ });
+ $(".storeable-text").each(function() {
+ localStorage.setItem("#" + $(this)[0].id + ":value", JSON.stringify($(this)[0].value));
});
}
diff --git a/webassets/js/spots.js b/webassets/js/spots.js
index 7793263..623cf81 100644
--- a/webassets/js/spots.js
+++ b/webassets/js/spots.js
@@ -32,7 +32,7 @@ function buildQueryString() {
// Update the spots table
function updateTable() {
// Use local time instead of UTC?
- var useLocalTime = $("#useLocalTime")[0].checked;
+ var useLocalTime = $("#timeZone")[0].value == "local";
// Populate table with headers
let table = $('
').append('
');
@@ -211,7 +211,7 @@ function generateBandsMultiToggleFilterCard(band_options) {
let $card = $("
");
let $card_body = $("
");
$card_body.append(`
Bands
`);
- $p = $("
");
+ $p = $("
");
// Create a button for each option
band_options.forEach(o => {
// CSS doesn't like IDs with decimal points in, so we need to replace that in the same way as when we originally
@@ -234,15 +234,31 @@ function filtersUpdated() {
saveSettings();
}
-// Set up UI element event listeners, after the document is ready
-function setUpEventListeners() {
- $("#filters-button").click(function() {
- $("#filters-area").toggle();
- });
- $("#close-filters-button").click(function() {
- $("#filters-button").button("toggle");
+// React to toggling/closing panels
+function toggleFiltersPanel() {
+ // If we are going to display the filters panel, hide the display panel
+ if (!$("#filters-area").is(":visible") && $("#display-area").is(":visible")) {
+ $("#display-area").hide();
+ $("#display-button").button("toggle");
+ }
+ $("#filters-area").toggle();
+}
+function closeFiltersPanel() {
+ $("#filters-button").button("toggle");
+ $("#filters-area").hide();
+}
+
+function toggleDisplayPanel() {
+ // If we are going to display status, load the data for the status panel, and hide the filters panel
+ if (!$("#display-area").is(":visible") && $("#filters-area").is(":visible")) {
$("#filters-area").hide();
- });
+ $("#filters-button").button("toggle");
+ }
+ $("#display-area").toggle();
+}
+function closeDisplayPanel() {
+ $("#display-button").button("toggle");
+ $("#display-area").hide();
}
// Display the intro box, unless the user has already dismissed it once.
@@ -261,8 +277,6 @@ $(document).ready(function() {
loadOptions();
// Update the refresh timing display every second
setInterval(updateRefreshDisplay, 1000);
- // Set up event listeners
- setUpEventListeners();
// Display intro box
displayIntroBox();
});
\ No newline at end of file