mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-08-11 15:11:41 +00:00
Replace dash-separated config & API properties with underscore-separated versions. #127
This commit is contained in:
+13
-13
@@ -61,11 +61,11 @@ function loadURLParams() {
|
||||
}
|
||||
|
||||
// Handle other params
|
||||
updateSelectFromParam(params, "color-scheme", "color-scheme");
|
||||
updateSelectFromParam(params, "time-zone", "time-zone"); // Only on Spots and Alerts pages
|
||||
updateSelectFromParam(params, "limit", "spots-to-fetch"); // Only on Spots page
|
||||
updateSelectFromParam(params, "limit", "alerts-to-fetch"); // Only on Alerts page
|
||||
updateSelectFromParam(params, "max_age", "max-spot-age"); // Only on Map & Bands pages
|
||||
updateSelectFromParam(params, "color_scheme", "color_scheme");
|
||||
updateSelectFromParam(params, "time_zone", "time_zone"); // Only on Spots and Alerts pages
|
||||
updateSelectFromParam(params, "limit", "spots_to_fetch"); // Only on Spots page
|
||||
updateSelectFromParam(params, "limit", "alerts_to_fetch"); // Only on Alerts page
|
||||
updateSelectFromParam(params, "max_age", "max_spot_age"); // Only on Map & Bands pages
|
||||
updateFilterFromParam(params, "band", "band");
|
||||
updateFilterFromParam(params, "sig", "sig");
|
||||
updateFilterFromParam(params, "source", "source");
|
||||
@@ -80,7 +80,7 @@ function updateSelectFromParam(params, paramName, selectID) {
|
||||
if (v != null) {
|
||||
$("#" + selectID).prop("value", v);
|
||||
// Extra check if this is the "color scheme" select
|
||||
if (selectID === "color-scheme") {
|
||||
if (selectID === "color_scheme") {
|
||||
setColorScheme(v);
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ function columnsUpdated() {
|
||||
|
||||
// Function to set the colour scheme based on the state of the UI select box
|
||||
function setColorSchemeFromUI() {
|
||||
let theme = $("#color-scheme option:selected").val();
|
||||
let theme = $("#color_scheme option:selected").val();
|
||||
if (theme !== "") {
|
||||
setColorScheme(theme);
|
||||
saveSettings();
|
||||
@@ -168,7 +168,7 @@ function setColorSchemeFromUI() {
|
||||
function setColorScheme(mode) {
|
||||
let effectiveModeDark = mode === "dark";
|
||||
if (mode === "auto") {
|
||||
effectiveModeDark = window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
effectiveModeDark = window.matchMedia('(prefers-color_scheme: dark)').matches
|
||||
}
|
||||
$("html").attr("data-bs-theme", effectiveModeDark ? "dark" : "light");
|
||||
const metaThemeColor = document.querySelector("meta[name=theme-color]");
|
||||
@@ -182,7 +182,7 @@ function usePreferredTheme() {
|
||||
// Work out if we have ever explicitly saved the value of our select box. If so, we set our colour scheme now based
|
||||
// on that. If not, we let the select stay with nothing selected, so that the server sets it to whatever the
|
||||
// server's default is when the options call is retrieved.
|
||||
let val = localStorage.getItem("#color-scheme:value");
|
||||
let val = localStorage.getItem("#color_scheme:value");
|
||||
if (val != null) {
|
||||
setColorScheme(JSON.parse(val));
|
||||
}
|
||||
@@ -191,8 +191,8 @@ function usePreferredTheme() {
|
||||
// Sets up a listener on the OS light-dark theme change. If the Spothole user theme is set to Auto, the UI will be
|
||||
// updated, otherwise if the Spothole user theme is forced to light or dark, that preference will remain.
|
||||
function listenForOSThemeChange() {
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
||||
setColorScheme($("#color-scheme option:selected").val());
|
||||
window.matchMedia('(prefers-color_scheme: dark)').addEventListener('change', () => {
|
||||
setColorScheme($("#color_scheme option:selected").val());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -254,13 +254,13 @@ function closeDataPanel() {
|
||||
// provided the corresponding "enabled" checkbox is ticked.
|
||||
function getCredentialHeaders() {
|
||||
const headers = {};
|
||||
if ($("#qrz-enabled")[0] && $("#qrz-enabled")[0].checked) {
|
||||
if ($("#qrz_enabled")[0] && $("#qrz_enabled")[0].checked) {
|
||||
const qrzUsername = $("#qrz-username").val();
|
||||
const qrzPassword = $("#qrz-password").val();
|
||||
if (qrzUsername) headers["X-QRZ-Username"] = qrzUsername;
|
||||
if (qrzPassword) headers["X-QRZ-Password"] = qrzPassword;
|
||||
}
|
||||
if ($("#hamqth-enabled")[0] && $("#hamqth-enabled")[0].checked) {
|
||||
if ($("#hamqth_enabled")[0] && $("#hamqth_enabled")[0].checked) {
|
||||
const hamqthUsername = $("#hamqth-username").val();
|
||||
const hamqthPassword = $("#hamqth-password").val();
|
||||
if (hamqthUsername) headers["X-HamQTH-Username"] = hamqthUsername;
|
||||
|
||||
Reference in New Issue
Block a user