You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-27 06:23:53 +01:00
minor fixes, code cleanup, accesibility features
This commit is contained in:
@@ -5,6 +5,7 @@ var socket = new WebSocket(socketAddress);
|
||||
var parsedData;
|
||||
var data = [];
|
||||
let signalChart;
|
||||
let updateCounter = 0;
|
||||
|
||||
const europe_programmes = [
|
||||
"No PTY", "News", "Current Affairs", "Info",
|
||||
@@ -176,15 +177,12 @@ function getLocalizedTime(serverTime) {
|
||||
// Convert server time to a Date object
|
||||
const serverDate = new Date(serverTime);
|
||||
|
||||
// Get local time zone offset
|
||||
const localOffset = serverDate.getTimezoneOffset() * 60000; // Convert minutes to milliseconds
|
||||
|
||||
// Calculate local time by adding the offset
|
||||
const localTime = new Date(serverDate.getTime());
|
||||
|
||||
// Format local time
|
||||
const options = { year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', hour12: false };
|
||||
const formattedLocalTime = localTime.toLocaleString('en-US', options);
|
||||
const formattedLocalTime = localTime.toLocaleString(navigator.language ? navigator.language : 'en-US', options);
|
||||
|
||||
return formattedLocalTime;
|
||||
}
|
||||
@@ -603,12 +601,17 @@ function updateDataElements(parsedData) {
|
||||
} else {
|
||||
$('#data-station-container').removeAttr('style');
|
||||
}
|
||||
|
||||
updateCounter++;
|
||||
if (updateCounter % 30 === 0) {
|
||||
$('#data-ps').attr('aria-label', parsedData.ps);
|
||||
$('#data-rt0').attr('aria-label', parsedData.rt0);
|
||||
$('#data-rt1').attr('aria-label', parsedData.rt1);
|
||||
}
|
||||
}
|
||||
|
||||
let isEventListenerAdded = false;
|
||||
|
||||
let updateCounter = 0;
|
||||
|
||||
function updatePanels(parsedData) {
|
||||
updateCounter++;
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@ function fetchData() {
|
||||
|
||||
$("#tuner-public").prop("checked", data.publicTuner);
|
||||
$("#tuner-lock").prop("checked", data.lockToAdmin);
|
||||
$("#shutdown-tuner").prop("checked", data.autoShutdown);
|
||||
|
||||
// Check if latitude and longitude are present in the data
|
||||
if (data.identification.lat && data.identification.lon) {
|
||||
@@ -214,6 +215,7 @@ function submitData() {
|
||||
|
||||
const publicTuner = $("#tuner-public").is(":checked");
|
||||
const lockToAdmin = $("#tuner-lock").is(":checked");
|
||||
const autoShutdown = $("#shutdown-tuner").is(":checked");
|
||||
|
||||
const data = {
|
||||
webserver: {
|
||||
@@ -244,7 +246,8 @@ function submitData() {
|
||||
adminPass,
|
||||
},
|
||||
publicTuner,
|
||||
lockToAdmin
|
||||
lockToAdmin,
|
||||
autoShutdown
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user