#11386 Fix modal error

This commit is contained in:
miguel angel rasteu 2023-07-25 11:12:05 +02:00
parent a1965de2ea
commit 7c9d441648

View File

@ -955,8 +955,8 @@ function openSoundEventsDialog(settings) {
return;
}
//Modify button
$("#minimize_arrow_event_sound").removeClass("arrow_menu_down");
$("#minimize_arrow_event_sound").addClass("arrow_menu_up");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
$("#minimize_arrow_event_sound").addClass("arrow_menu_down");
$("#minimize_arrow_event_sound").show();
// Initialize modal.
@ -1370,8 +1370,12 @@ function removeElement(name_select, id_modal) {
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data;
try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) {
console.log("AJAX request sent with drawConsoleSound=1:", ajaxOptions.url);
console.log(
"AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url
);
// Find the dialog element by the aria-describedby attribute
var dialog = $('[aria-describedby="modal-sound"]');
@ -1424,11 +1428,13 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
// Define the minimize button functionality;
function hidden_dialog() {
setTimeout(function() {
$("#modal-sound").css("visibility", "hidden");
dialog.css("z-index", "-1");
}, 200);
}
function show_dialog() {
setTimeout(function() {
$("#modal-sound").css("visibility", "visible");
dialog.css("z-index", "1115");
}, 50);
}
@ -1438,7 +1444,9 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
console.log("arrow_menu_up");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
$("#minimize_arrow_event_sound").addClass("arrow_menu_down");
} else if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_down")) {
} else if (
$("#minimize_arrow_event_sound").hasClass("arrow_menu_down")
) {
console.log("arrow_menu_down");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_down");
$("#minimize_arrow_event_sound").addClass("arrow_menu_up");
@ -1465,13 +1473,28 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
hidden_dialog()
);
dialog.css({ height: "" });
dialog.animate(
{
height: dialog.data("originalSize").height + "px",
top: dialog.data("originalPos").top + "px"
},
5
);
//dialog.find(".ui-dialog-content").hide();
} else {
console.log("Restore Window");
$(".ui-widget-overlay").show();
//dialog.find(".ui-dialog-content").show();
dialog.data("isMinimized", false);
dialog.animate(
{
height: "40px",
top: 0,
top: $(window).height() - 100
},
5
);
dialog.animate(
{
height: dialog.data("originalSize").height + "px",
@ -1497,44 +1520,6 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
for (var i = 0; i < addedNodes.length; i++) {
if (addedNodes[i].nodeName.toLowerCase() === "li") {
console.log("The dialog content contains an <li> tag.");
/*if (dialog.data("isMinimized")) {
console.log("Restore Window");
$(".ui-widget-overlay").show();
dialog.data("isMinimized", false);
dialog.animate(
{
height: dialog.data("originalSize").height + "px",
top: dialog.data("originalPos").top + "px"
},
200
);
}*/
/*
var $el = $('[aria-describedby="modal-sound"]').find(
".ui-dialog-title"
);
var flashingDuration = 10000; // 10 seconds
$("<style>")
.text(
`
@keyframes flashRed {
from { background-color: initial; }
to { background-color: red; }
}
.red-flash { animation: flashRed 0.5s alternate infinite; }
`
)
.appendTo("head");
$el.addClass("red-flash");
setTimeout(() => {
$el.removeClass("red-flash");
$("style")
.last()
.remove();
}, flashingDuration);*/
break;
}
}
@ -1545,6 +1530,9 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
var config = { childList: true, subtree: true };
observer.observe(dialogContent[0], config);
}
} catch (e) {
console.log(e);
}
});
/*
@ -1557,8 +1545,12 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
*/
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data;
try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) {
console.log("AJAX request sent with drawConsoleSound=1:", ajaxOptions.url);
console.log(
"AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url
);
// Find the dialog element by the aria-describedby attribute
var dialog = $('[aria-describedby="modal-sound"]');
@ -1608,4 +1600,7 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
image.height(height);
});
}
} catch (e) {
console.log(e);
}
});