Primeiro commit
Signed-off-by: Rodrigo Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
commit
a1beb6a2e0
425 files changed
+193665
No files matched your search
+37
@@ -0,0 +1,37 @@
|
||||
document.querySelectorAll('.new-button, .search-button').forEach(button => {
|
||||
button.addEventListener('click', event => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const menu = event.target.nextElementSibling;
|
||||
document.querySelectorAll('.new-menu, .search-bar').forEach(otherMenu => {
|
||||
if (otherMenu !== menu) {
|
||||
otherMenu.classList.remove('active');
|
||||
}
|
||||
});
|
||||
menu.classList.toggle('active');
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('click', event => {
|
||||
document.querySelectorAll('.new-menu, .search-bar').forEach(menu => {
|
||||
if (!menu.contains(event.target) && !menu.previousElementSibling.contains(event.target)) {
|
||||
menu.classList.remove('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll('.user-info').forEach(userInfo => {
|
||||
userInfo.addEventListener('click', event => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
userInfo.querySelector('ul').classList.toggle('active');
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('click', event => {
|
||||
document.querySelectorAll('.user-info ul').forEach(menu => {
|
||||
if (!menu.contains(event.target) && !menu.previousElementSibling.contains(event.target)) {
|
||||
menu.classList.remove('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user