1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-27 06:23:53 +01:00
Files
fm-dx-webserver/web/js/init.js
NoobishSVK 7830deabc9 bugfix pack
2024-08-29 21:42:14 +02:00

39 lines
1.5 KiB
JavaScript

var currentDate = new Date('Aug 28, 2024 22: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.7 [' + formattedDate + ']';
getInitialSettings();
removeUrlParameters(); // Call this function to remove URL parameters
function getInitialSettings() {
$.ajax({
url: './static_data',
dataType: 'json',
success: function (data) {
localStorage.setItem('qthLatitude', data.qthLatitude);
localStorage.setItem('qthLongitude', data.qthLongitude);
localStorage.setItem('defaultTheme', data.defaultTheme);
localStorage.setItem('preset1', data.presets[0]);
localStorage.setItem('preset2', data.presets[1]);
localStorage.setItem('preset3', data.presets[2]);
localStorage.setItem('preset4', data.presets[3]);
localStorage.setItem('bgImage', data.bgImage);
localStorage.setItem('rdsMode', data.rdsMode);
},
error: function (error) {
console.error('Error:', error);
}
});
}
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);
}