#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; return;
} }
//Modify button //Modify button
$("#minimize_arrow_event_sound").removeClass("arrow_menu_down"); $("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
$("#minimize_arrow_event_sound").addClass("arrow_menu_up"); $("#minimize_arrow_event_sound").addClass("arrow_menu_down");
$("#minimize_arrow_event_sound").show(); $("#minimize_arrow_event_sound").show();
// Initialize modal. // Initialize modal.
@ -1370,8 +1370,12 @@ function removeElement(name_select, id_modal) {
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) { $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data; const requestBody = ajaxOptions.data;
try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) { 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 // Find the dialog element by the aria-describedby attribute
var dialog = $('[aria-describedby="modal-sound"]'); var dialog = $('[aria-describedby="modal-sound"]');
@ -1424,11 +1428,13 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
// Define the minimize button functionality; // Define the minimize button functionality;
function hidden_dialog() { function hidden_dialog() {
setTimeout(function() { setTimeout(function() {
$("#modal-sound").css("visibility", "hidden");
dialog.css("z-index", "-1"); dialog.css("z-index", "-1");
}, 200); }, 200);
} }
function show_dialog() { function show_dialog() {
setTimeout(function() { setTimeout(function() {
$("#modal-sound").css("visibility", "visible");
dialog.css("z-index", "1115"); dialog.css("z-index", "1115");
}, 50); }, 50);
} }
@ -1438,7 +1444,9 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
console.log("arrow_menu_up"); console.log("arrow_menu_up");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up"); $("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
$("#minimize_arrow_event_sound").addClass("arrow_menu_down"); $("#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"); console.log("arrow_menu_down");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_down"); $("#minimize_arrow_event_sound").removeClass("arrow_menu_down");
$("#minimize_arrow_event_sound").addClass("arrow_menu_up"); $("#minimize_arrow_event_sound").addClass("arrow_menu_up");
@ -1465,13 +1473,28 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
hidden_dialog() hidden_dialog()
); );
dialog.css({ height: "" }); dialog.css({ height: "" });
dialog.animate(
{
height: dialog.data("originalSize").height + "px",
top: dialog.data("originalPos").top + "px"
},
5
);
//dialog.find(".ui-dialog-content").hide(); //dialog.find(".ui-dialog-content").hide();
} else { } else {
console.log("Restore Window"); console.log("Restore Window");
$(".ui-widget-overlay").show(); $(".ui-widget-overlay").show();
//dialog.find(".ui-dialog-content").show(); //dialog.find(".ui-dialog-content").show();
dialog.data("isMinimized", false); dialog.data("isMinimized", false);
dialog.animate(
{
height: "40px",
top: 0,
top: $(window).height() - 100
},
5
);
dialog.animate( dialog.animate(
{ {
height: dialog.data("originalSize").height + "px", height: dialog.data("originalSize").height + "px",
@ -1497,44 +1520,6 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
for (var i = 0; i < addedNodes.length; i++) { for (var i = 0; i < addedNodes.length; i++) {
if (addedNodes[i].nodeName.toLowerCase() === "li") { if (addedNodes[i].nodeName.toLowerCase() === "li") {
console.log("The dialog content contains an <li> tag."); 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; break;
} }
} }
@ -1545,6 +1530,9 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
var config = { childList: true, subtree: true }; var config = { childList: true, subtree: true };
observer.observe(dialogContent[0], config); 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) { $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data; const requestBody = ajaxOptions.data;
try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) { 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 // Find the dialog element by the aria-describedby attribute
var dialog = $('[aria-describedby="modal-sound"]'); var dialog = $('[aria-describedby="modal-sound"]');
@ -1608,4 +1600,7 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
image.height(height); image.height(height);
}); });
} }
} catch (e) {
console.log(e);
}
}); });