You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
fmlist integration, new admin panel, bugfixes
This commit is contained in:
@@ -77,6 +77,9 @@ function submitData() {
|
||||
plugins.push($(this).data('name'));
|
||||
});
|
||||
|
||||
const fmlistIntegration = $("#fmlist-integration").is(":checked") || false;
|
||||
const fmlistOmid = $('#fmlist-omid').val();
|
||||
|
||||
const publicTuner = $("#tuner-public").is(":checked");
|
||||
const lockToAdmin = $("#tuner-lock").is(":checked");
|
||||
const autoShutdown = $("#shutdown-tuner").is(":checked") || false;
|
||||
@@ -143,6 +146,10 @@ function submitData() {
|
||||
tunePass,
|
||||
adminPass,
|
||||
},
|
||||
extras: {
|
||||
fmlistIntegration,
|
||||
fmlistOmid,
|
||||
},
|
||||
plugins,
|
||||
device,
|
||||
publicTuner,
|
||||
@@ -164,7 +171,7 @@ function submitData() {
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(data),
|
||||
success: function (message) {
|
||||
alert(message);
|
||||
sendToast('success', 'Data saved!', message, true, true);
|
||||
},
|
||||
error: function (error) {
|
||||
console.error(error);
|
||||
@@ -307,6 +314,9 @@ function submitData() {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$("#fmlist-integration").prop("checked", data.extras ? data.extras?.fmlist_integration : "true");
|
||||
$('#fmlist-omid').val(data.extras?.fmlist_omid);
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching data:', error.message);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
var currentDate = new Date('Sep 12, 2024 21:30:00');
|
||||
var currentDate = new Date('Sep 15, 2024 00:00:00');
|
||||
var day = currentDate.getDate();
|
||||
var month = currentDate.getMonth() + 1; // Months are zero-indexed, so add 1
|
||||
var year = currentDate.getFullYear();
|
||||
var formattedDate = day + '/' + month + '/' + year;
|
||||
var currentVersion = 'v1.2.8.1 [' + formattedDate + ']';
|
||||
var currentVersion = 'v1.3.0 [' + formattedDate + ']';
|
||||
|
||||
getInitialSettings();
|
||||
removeUrlParameters(); // Call this function to remove URL parameters
|
||||
@@ -30,9 +30,8 @@ function getInitialSettings() {
|
||||
}
|
||||
|
||||
function removeUrlParameters() {
|
||||
// Get the current URL without the query parameters
|
||||
var urlWithoutParams = window.location.protocol + "//" + window.location.host + window.location.pathname;
|
||||
|
||||
// Replace the current URL with the new one, without reloading the page
|
||||
window.history.replaceState({ path: urlWithoutParams }, '', urlWithoutParams);
|
||||
if (window.location.pathname === "/") {
|
||||
var urlWithoutParams = window.location.protocol + "//" + window.location.host + window.location.pathname;
|
||||
window.history.replaceState({ path: urlWithoutParams }, '', urlWithoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -828,12 +828,18 @@ const updateDataElements = throttle(function(parsedData) {
|
||||
updateTextIfChanged($('#data-station-pol'), parsedData.txInfo.pol);
|
||||
updateTextIfChanged($('#data-station-distance'), parsedData.txInfo.dist);
|
||||
updateHtmlIfChanged($('#data-station-azimuth'), parsedData.txInfo.azi + '°');
|
||||
updateHtmlIfChanged($('#data-regular-pi'), parsedData.txInfo.reg === true ? parsedData.txInfo.pi : ' ');
|
||||
$dataStationContainer.css('display', 'block');
|
||||
} else {
|
||||
$dataStationContainer.removeAttr('style');
|
||||
}
|
||||
|
||||
if(parsedData.txInfo.tx.length > 1 && parsedData.txInfo.dist > 150 && parsedData.txInfo.dist < 4000) {
|
||||
$('#log-fmlist').attr('disabled', 'false').removeClass('btn-disabled cursor-disabled');
|
||||
} else {
|
||||
$('#log-fmlist').attr('disabled', 'true').addClass('btn-disabled cursor-disabled');
|
||||
}
|
||||
updateHtmlIfChanged($('#data-regular-pi'), parsedData.txInfo.reg === true ? parsedData.txInfo.pi : ' ');
|
||||
|
||||
updateCounter++;
|
||||
if (updateCounter % 8 === 0) {
|
||||
$dataTp.html(parsedData.tp === 0 ? "<span class='opacity-half'>TP</span>" : "TP");
|
||||
|
||||
@@ -153,6 +153,7 @@ $(document).ready(function() {
|
||||
|
||||
updateTabFocus(currentTabIndex);
|
||||
$tabs.on('keydown', handleKeyDown);
|
||||
//toggleNav();
|
||||
});
|
||||
|
||||
function MapCreate() {
|
||||
@@ -188,4 +189,49 @@ function MapCreate() {
|
||||
// Add active class to the corresponding li element
|
||||
$('.nav li[data-panel="' + panelId + '"]').addClass('active');
|
||||
}
|
||||
}
|
||||
if(window.location.hash.length == 0) {
|
||||
$('.nav li[data-panel="dashboard"]').addClass('active');
|
||||
}
|
||||
}
|
||||
|
||||
function toggleNav() {
|
||||
const navOpen = $("#navigation").css('margin-left') === '0px';
|
||||
const isMobile = window.innerWidth <= 768; // Define mobile screen width threshold (you can adjust this as needed)
|
||||
|
||||
if (navOpen) {
|
||||
// Close the navigation
|
||||
if (isMobile) {
|
||||
// Do nothing to .admin-wrapper on mobile (since we're overlaying)
|
||||
$(".admin-wrapper").css({
|
||||
'margin-left': '0',
|
||||
'width': '100%' // Reset content to full width on close
|
||||
});
|
||||
$("#navigation").css('margin-left', 'calc(64px - 100vw)');
|
||||
} else {
|
||||
// On desktop, adjust the content margin and width
|
||||
$(".admin-wrapper").css({
|
||||
'margin-left': '64px',
|
||||
'width': 'calc(100% - 64px)'
|
||||
});
|
||||
$("#navigation").css('margin-left', '-356px');
|
||||
}
|
||||
$(".sidenav-close").html('<i class="fa-solid fa-chevron-right"></i>');
|
||||
} else {
|
||||
// Open the navigation
|
||||
$("#navigation").css('margin-left', '0');
|
||||
if (isMobile) {
|
||||
// On mobile, overlay the navigation
|
||||
$(".admin-wrapper").css({
|
||||
'margin-left': '0', // Keep content in place when sidenav is open
|
||||
'width': '100%' // Keep content at full width
|
||||
});
|
||||
} else {
|
||||
// On desktop, push the content
|
||||
$(".admin-wrapper").css({
|
||||
'margin-left': '420px',
|
||||
'width': 'calc(100% - 420px)'
|
||||
});
|
||||
}
|
||||
$(".sidenav-close").html('<i class="fa-solid fa-chevron-left"></i>');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ function sendToast(type, title, message, persistent, important) {
|
||||
|
||||
// Create the toast element
|
||||
var $toast = $(`
|
||||
<div class="toast ${type} flex-container ${important ? 'important' : ''}" id="${toastId}">
|
||||
<div class="toast ${type} flex-container flex-phone ${important ? 'important' : ''}" id="${toastId}">
|
||||
<div class="toast-icon"><i class="fa-solid ${iconClass}"></i></div>
|
||||
<div>
|
||||
<div class="toast-title">${toastTitle}</div>
|
||||
|
||||
Reference in New Issue
Block a user