Profile page

- add discord username under logo discord when mouse over
This commit is contained in:
Kum1ta
2024-11-19 00:01:18 +01:00
parent c6dc286943
commit 5a1e40c11d
2 changed files with 29 additions and 1 deletions

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/19 23:08:31 by edbernar #+# #+# */
/* Updated: 2024/11/18 16:35:44 by edbernar ### ########.fr */
/* Updated: 2024/11/18 23:53:19 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -137,7 +137,28 @@ function externButtons(userInfo)
else
githubButton.remove();
if (userInfo.discord)
{
discordButton.setAttribute('name', userInfo.discord);
discordButton.addEventListener('mouseover', () => {
const bound = discordButton.getBoundingClientRect();
const div = document.createElement('div');
let boundDiv;
div.setAttribute('class', 'discord-username-settings');
document.body.appendChild(div);
div.style.top = `${bound.top + bound.height + 10}px`;
div.style.opacity = 0;
setTimeout(() => {
boundDiv = div.getBoundingClientRect();
div.style.left = `${bound.left - (boundDiv.width / 2) + (bound.width / 2)}px`;
div.style.opacity = 1;
}, 10);
div.innerHTML = userInfo.discord;
});
discordButton.addEventListener('mouseout', () => {
document.getElementsByClassName('discord-username-settings')[0].remove();
});
}
else
discordButton.remove();
}