1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-26 14:11:59 +01:00
Files
fm-dx-webserver/web/js/init.js
2025-05-17 09:00:31 +02:00

39 lines
1.3 KiB
JavaScript

var currentDate = new Date('May 2, 2025 16: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.3.8 [' + formattedDate + ']';
getInitialSettings();
removeUrlParameters();
function getInitialSettings() {
$.ajax({
url: './static_data',
dataType: 'json',
success: function (data) {
['qthLatitude', 'qthLongitude', 'defaultTheme', 'bgImage', 'rdsMode', 'rdsTimeout'].forEach(key => {
if (data[key] !== undefined) {
localStorage.setItem(key, data[key]);
}
});
data.presets.forEach((preset, index) => {
localStorage.setItem(`preset${index + 1}`, preset);
});
},
error: function (error) {
console.error('Error:', error);
}
});
}
function removeUrlParameters() {
if (window.location.pathname === "/") {
var urlWithoutParams = window.location.protocol + "//" + window.location.host + window.location.pathname;
window.history.replaceState({ path: urlWithoutParams }, '', urlWithoutParams);
}
}