mirror of
https://git.sr.ht/~roxwize/mipilin
synced 2025-01-31 02:53:36 +00:00
21 lines
628 B
JavaScript
21 lines
628 B
JavaScript
|
const e_user_selected = document.getElementById("user-selected");
|
||
|
let current;
|
||
|
|
||
|
document.querySelectorAll("#users tr").forEach((el) => {
|
||
|
el.addEventListener("click", () => {
|
||
|
current = el.querySelector("td:nth-child(2)").textContent;
|
||
|
e_user_selected.textContent = current;
|
||
|
});
|
||
|
});
|
||
|
|
||
|
document.querySelectorAll("button").forEach((el) => {
|
||
|
el.addEventListener("click", (ev) => {
|
||
|
if (!current) {
|
||
|
ev.preventDefault();
|
||
|
return;
|
||
|
};
|
||
|
const e = el.parentElement;
|
||
|
e.setAttribute("action", el.parentElement.dataset.url.replaceAll("{}", current));
|
||
|
});
|
||
|
});
|