| 1 | const showUserEls = [...document.querySelectorAll(".data-show-user")]; |
| 2 | |
| 3 | showUserEls.forEach(showUserEl => { |
| 4 | showUserEl.addEventListener("click", () => { |
| 5 | const userID = showUserEl.getAttribute("data-id"); |
| 6 | const panelEl = document.getElementById(userID); |
| 7 | |
| 8 | panelEl.style.display = panelEl.style.display == 'flex' ? 'none' : 'flex'; |
| 9 | showUserEl.innerText = showUserEl.innerText.toLowerCase().startsWith('show') ? 'Hide user' : 'Show user'; |
| 10 | }); |
| 11 | }); |
| 12 |