FIX: Expand button not working

This commit is contained in:
Keegan George 2022-07-13 11:38:47 -07:00
parent 633109804c
commit 905e553635
1 changed files with 8 additions and 2 deletions

View File

@ -30,7 +30,7 @@ export default apiInitializer("0.11.1", (api) => {
}
function generateModal(event) {
const table = event.target.nextElementSibling;
const table = event.target.parentNode.lastElementChild;
const tempTable = table.cloneNode(true);
const postId = this.id;
@ -60,7 +60,13 @@ export default apiInitializer("0.11.1", (api) => {
const popupBtn = createButton();
table.parentNode.classList.add("fullscreen-table-wrapper");
table.parentNode.insertBefore(popupBtn, table);
const expandBtn = document.querySelector(".open-popup-link");
if (table.parentNode.contains(expandBtn)) {
expandBtn.parentNode.insertBefore(popupBtn, expandBtn);
} else {
table.parentNode.insertBefore(popupBtn, table);
}
popupBtn.addEventListener("click", generateModal.bind(attrs), false);
});
}