/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.js :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: edbernar { if (userMeInfo.id > 0) { sendRequest("get_user_info", {username: user}) clearInterval(interval); } }, 100); } else sendRequest("get_user_info", {id: user}); waitForUserInfo().then((userInfo) => { console.log(userInfo); if (userInfo == null) { pageRenderer.changePage('homePage'); return ; } if (typeof(user) != 'string') history.replaceState({}, document.title, window.location.pathname + '/' + userInfo.username); username.innerHTML = userInfo.username + ''; if (!userInfo.online) document.getElementsByClassName('online-status')[0].style.backgroundColor = '#E74040'; pfp.style.backgroundImage = `url("${userInfo.pfp}")` pfp.style.backgroundSize = "cover"; pfp.style.backgroundRepeat = "no-repeat"; banner.style.backgroundImage = `url("${userInfo.banner}")` banner.style.backgroundSize = "cover"; banner.style.backgroundRepeat = "no-repeat"; externButtons(userInfo) if (userInfo.id == userMeInfo.id) { pfp.innerHTML = `
` banner.innerHTML = `` } if (userInfo.id != userMeInfo.id) { convButton.addEventListener('click', () => { showChatMenu(); showPrivateChat({id: userInfo.id, name: userInfo.username}); }); } else convButton.remove(); }); } static dispose() { LiveChat.dispose(); } } function externButtons(userInfo) { const githubButton = document.getElementById('github'); const discordButton = document.getElementById('discord'); if (userInfo.github) githubButton.setAttribute('href', userInfo.github); else githubButton.remove(); if (userInfo.discord) discordButton.setAttribute('name', userInfo.discord); else discordButton.remove(); } export { ProfilPage };