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
new chat window, bugfixes, component update
This commit is contained in:
@@ -34,20 +34,17 @@ function OnConnectivityCallback(isConnected) {
|
||||
}
|
||||
}
|
||||
|
||||
function isIOS() {
|
||||
return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
||||
}
|
||||
|
||||
function OnPlayButtonClick(_ev) {
|
||||
const $playbutton = $('.playbutton');
|
||||
const isiOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
||||
const isAppleiOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
||||
|
||||
if (Stream) {
|
||||
console.log("Stopping stream...");
|
||||
shouldReconnect = false;
|
||||
destroyStream();
|
||||
$playbutton.find('.fa-solid').toggleClass('fa-stop fa-play');
|
||||
if (isiOS && 'audioSession' in navigator) {
|
||||
if (isAppleiOS && 'audioSession' in navigator) {
|
||||
navigator.audioSession.type = "none";
|
||||
}
|
||||
} else {
|
||||
@@ -56,7 +53,7 @@ function OnPlayButtonClick(_ev) {
|
||||
createStream();
|
||||
Stream.Start();
|
||||
$playbutton.find('.fa-solid').toggleClass('fa-play fa-stop');
|
||||
if (isiOS && 'audioSession' in navigator) {
|
||||
if (isAppleiOS && 'audioSession' in navigator) {
|
||||
navigator.audioSession.type = "playback";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,29 @@ $(document).ready(function() {
|
||||
const chatNicknameInput = $('#chat-nickname');
|
||||
const chatNicknameSave = $('#chat-nickname-save');
|
||||
|
||||
$(function () {
|
||||
$("#popup-panel-chat").draggable({
|
||||
handle: ".popup-header"
|
||||
}).resizable({
|
||||
minHeight: 300,
|
||||
minWidth: 250
|
||||
});
|
||||
|
||||
$(".chatbutton").on("click", function () {
|
||||
$("#popup-panel-chat").fadeIn(200, function () {
|
||||
chatMessages.scrollTop(chatMessages[0].scrollHeight);
|
||||
});
|
||||
});
|
||||
|
||||
$("#popup-panel-chat .popup-close").on("click", function () {
|
||||
$("#popup-panel-chat").fadeOut(200);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Function to generate a random string
|
||||
function generateRandomString(length) {
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
const characters = 'ABCDEFGHJKMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz0123456789';
|
||||
let result = '';
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
||||
@@ -21,7 +41,7 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
// Load nickname from localStorage on page load
|
||||
let savedNickname = localStorage.getItem('nickname') || `Anonymous User ${generateRandomString(5)}`;
|
||||
let savedNickname = localStorage.getItem('nickname') || `User ${generateRandomString(5)}`;
|
||||
chatNicknameInput.val(savedNickname);
|
||||
chatIdentityNickname.text(savedNickname);
|
||||
|
||||
|
||||
@@ -96,8 +96,6 @@ function populateFields(data, prefix = "") {
|
||||
$element.val(value);
|
||||
}
|
||||
});
|
||||
|
||||
updateIconState();
|
||||
}
|
||||
|
||||
function updateConfigData(data, prefix = "") {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
var currentDate = new Date('Apr 19, 2025 21:30:00');
|
||||
var currentDate = new Date('Apr 22, 2025 21:30: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.6.1 [' + formattedDate + ']';
|
||||
var currentVersion = 'v1.3.7 [' + formattedDate + ']';
|
||||
|
||||
getInitialSettings();
|
||||
removeUrlParameters();
|
||||
|
||||
@@ -2,7 +2,6 @@ $(document).ready(function() {
|
||||
// Cache jQuery objects for reuse
|
||||
var modal = $("#myModal");
|
||||
var modalPanel = $(".modal-panel");
|
||||
var chatPanel = $(".modal-panel-chat");
|
||||
var openBtn = $("#settings");
|
||||
var closeBtn = $(".closeModal, .closeModalButton");
|
||||
|
||||
@@ -20,7 +19,6 @@ $(document).ready(function() {
|
||||
modal.css("opacity", 0);
|
||||
setTimeout(function() {
|
||||
modal.css("display", "none");
|
||||
modalPanel.add(chatPanel).css("display", "none");
|
||||
$("body").removeClass("modal-open"); // Enable body scrolling
|
||||
}, 300);
|
||||
}
|
||||
@@ -30,10 +28,6 @@ $(document).ready(function() {
|
||||
openModal(modalPanel);
|
||||
});
|
||||
|
||||
$(".chatbutton").on("click", function() {
|
||||
openModal(chatPanel);
|
||||
});
|
||||
|
||||
closeBtn.on("click", closeModal);
|
||||
|
||||
// Close the modal when clicking outside of it
|
||||
|
||||
@@ -166,11 +166,6 @@ $(document).ready(() => {
|
||||
$('.version-string').text(currentVersion);
|
||||
|
||||
setBg();
|
||||
|
||||
// Update icons when the checkbox state changes
|
||||
$('input[type="checkbox"]').change(function() {
|
||||
updateIconState(this);
|
||||
});
|
||||
});
|
||||
|
||||
function getQueryParameter(name) {
|
||||
@@ -178,29 +173,6 @@ function getQueryParameter(name) {
|
||||
return urlParams.get(name);
|
||||
}
|
||||
|
||||
function updateIconState(el) {
|
||||
// If an element is passed, update only that one
|
||||
if (el) {
|
||||
var $checkbox = $(el);
|
||||
var icon = $checkbox.siblings('label').find('i');
|
||||
if ($checkbox.is(':checked')) {
|
||||
icon.removeClass('fa-toggle-off').addClass('fa-toggle-on');
|
||||
} else {
|
||||
icon.removeClass('fa-toggle-on').addClass('fa-toggle-off');
|
||||
}
|
||||
} else {
|
||||
// Otherwise, update all checkboxes
|
||||
$('input[type="checkbox"]').each(function() {
|
||||
var icon = $(this).siblings('label').find('i');
|
||||
if ($(this).is(':checked')) {
|
||||
icon.removeClass('fa-toggle-off').addClass('fa-toggle-on');
|
||||
} else {
|
||||
icon.removeClass('fa-toggle-on').addClass('fa-toggle-off');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setTheme(themeName) {
|
||||
const themeColors = themes[themeName];
|
||||
if (themeColors) {
|
||||
|
||||
@@ -20,34 +20,48 @@ $(document).ready(function() {
|
||||
function mapCreate() {
|
||||
if (!(typeof map == "object")) {
|
||||
map = L.map('map', {
|
||||
center: [40,0],
|
||||
center: [40, 0],
|
||||
zoom: 3
|
||||
});
|
||||
} else {
|
||||
map.setZoom(3).panTo([40, 0]);
|
||||
}
|
||||
else {
|
||||
map.setZoom(3).panTo([40,0]);
|
||||
}
|
||||
|
||||
|
||||
L.tileLayer(tilesURL, {
|
||||
attribution: mapAttrib,
|
||||
maxZoom: 19
|
||||
}).addTo(map);
|
||||
|
||||
// Check for initial lat/lon values
|
||||
const latVal = parseFloat($('#identification-lat').val());
|
||||
const lonVal = parseFloat($('#identification-lon').val());
|
||||
|
||||
if (!isNaN(latVal) && !isNaN(lonVal)) {
|
||||
const initialLatLng = L.latLng(latVal, lonVal);
|
||||
pin = L.marker(initialLatLng, { riseOnHover: true, draggable: true }).addTo(map);
|
||||
map.setView(initialLatLng, 8); // Optional: Zoom in closer to the pin
|
||||
|
||||
pin.on('dragend', function(ev) {
|
||||
$('#identification-lat').val(ev.target.getLatLng().lat.toFixed(6));
|
||||
$('#identification-lon').val(ev.target.getLatLng().lng.toFixed(6));
|
||||
});
|
||||
}
|
||||
|
||||
map.on('click', function(ev) {
|
||||
$('#identification-lat').val((ev.latlng.lat).toFixed(6));
|
||||
$('#identification-lon').val((ev.latlng.lng).toFixed(6));
|
||||
|
||||
$('#identification-lat').val(ev.latlng.lat.toFixed(6));
|
||||
$('#identification-lon').val(ev.latlng.lng.toFixed(6));
|
||||
|
||||
if (typeof pin == "object") {
|
||||
pin.setLatLng(ev.latlng);
|
||||
} else {
|
||||
pin = L.marker(ev.latlng,{ riseOnHover:true,draggable:true });
|
||||
pin.addTo(map);
|
||||
pin.on('dragend',function(ev) {
|
||||
$('#identification-lat').val((ev.latlng.lat).toFixed(6));
|
||||
$('#identification.lon').val((ev.latlng.lng).toFixed(6));
|
||||
pin = L.marker(ev.latlng, { riseOnHover: true, draggable: true }).addTo(map);
|
||||
pin.on('dragend', function(ev) {
|
||||
$('#identification-lat').val(ev.target.getLatLng().lat.toFixed(6));
|
||||
$('#identification-lon').val(ev.target.getLatLng().lng.toFixed(6));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
mapReload();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user