Debug: Edit-Button mit globaler Event-Delegation + alert()
This commit is contained in:
@@ -250,6 +250,24 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/* ─── Global: editState ─── */
|
||||
var editState = { site: "", screen: "", oldName: "" };
|
||||
|
||||
/* Event-Delegation für Edit-Buttons (global, sofort aktiv) */
|
||||
document.addEventListener("click", function (e) {
|
||||
var btn = e.target.closest(".edit-url-btn");
|
||||
if (!btn) return;
|
||||
e.preventDefault();
|
||||
alert("DEBUG: Edit geklickt - " + btn.dataset.site + "/" + btn.dataset.screen + " - " + btn.dataset.oldname);
|
||||
editState.site = btn.dataset.site;
|
||||
editState.screen = btn.dataset.screen;
|
||||
editState.oldName = btn.dataset.oldname;
|
||||
document.getElementById("edit-url-input").value = btn.dataset.oldname;
|
||||
document.getElementById("edit-zoom-input").value = btn.dataset.zoom;
|
||||
document.getElementById("edit-url-error").style.display = "none";
|
||||
new bootstrap.Modal(document.getElementById("edit-url-modal")).show();
|
||||
});
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
function initSortable(name) {
|
||||
@@ -298,20 +316,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
return new bootstrap.Tooltip(tooltipTriggerEl);
|
||||
});
|
||||
|
||||
/* ─── Edit-URL-Button: Modal öffnen (Event-Delegation) ─── */
|
||||
document.addEventListener("click", function (e) {
|
||||
var btn = e.target.closest(".edit-url-btn");
|
||||
if (!btn) return;
|
||||
e.preventDefault();
|
||||
editState.site = btn.dataset.site;
|
||||
editState.screen = btn.dataset.screen;
|
||||
editState.oldName = btn.dataset.oldname;
|
||||
document.getElementById("edit-url-input").value = btn.dataset.oldname;
|
||||
document.getElementById("edit-zoom-input").value = btn.dataset.zoom;
|
||||
document.getElementById("edit-url-error").style.display = "none";
|
||||
new bootstrap.Modal(document.getElementById("edit-url-modal")).show();
|
||||
});
|
||||
|
||||
/* ─── Edit-URL-Modal: Speichern-Button ─── */
|
||||
document.getElementById("edit-url-save").addEventListener("click", function () {
|
||||
const newUrl = document.getElementById("edit-url-input").value.trim();
|
||||
@@ -350,9 +354,6 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/* ─── Global: editState ─── */
|
||||
var editState = { site: "", screen: "", oldName: "" };
|
||||
</script>
|
||||
|
||||
<!-- Modal: URL bearbeiten -->
|
||||
|
||||
Reference in New Issue
Block a user