mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
removeElementOnKey - rewrite on vanilla ks
This commit is contained in:
parent
bedbb7cbff
commit
bb6941a1f5
2 changed files with 94 additions and 66 deletions
|
|
@ -136,10 +136,14 @@ function toggleMode() {
|
|||
}
|
||||
}
|
||||
|
||||
// trigger trash button click on "Delete" keypress
|
||||
function removeElementOnKey() {
|
||||
$(".dialog:visible .fastDelete").click();
|
||||
$("button:visible:contains('Remove')").click();
|
||||
const fastDelete = Array.from(document.querySelectorAll("[role='dialog'] .fastDelete")).find(dialog => dialog.style.display !== "none");
|
||||
if (fastDelete) fastDelete.click();
|
||||
|
||||
const visibleDialogs = Array.from(document.querySelectorAll("[role='dialog']")).filter(dialog => dialog.style.display !== "none");
|
||||
if (!visibleDialogs.length) return;
|
||||
|
||||
visibleDialogs.forEach(dialog => dialog.querySelectorAll("button").forEach(button => button.textContent === "Remove" && button.click()));
|
||||
}
|
||||
|
||||
function closeAllDialogs() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue