56 lines
2.0 KiB
HTML
56 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>USERS Page</title>
|
|
<%- newrelic %>
|
|
<link rel="stylesheet" href="/css/style.css">
|
|
<link rel="stylesheet" href="/css/global.css">
|
|
<script src="/js/addnavbar.js" charset="utf-8"></script>
|
|
<script src="/js/warn_message.js" charset="utf-8"></script>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1 id="userName">USER</h1>
|
|
</header>
|
|
<main>
|
|
<div class="info_div">
|
|
<img id="avatar" width=100 height=100> <br>
|
|
<h4 id="userBio">Bio: </h4>
|
|
<button id="mentionClick" onclick="mention()">Mention this User in Posts!</button>
|
|
</div>
|
|
</main>
|
|
|
|
|
|
<script type="text/javascript">
|
|
let other_username = window.location.pathname.split("/")[2]
|
|
console.log(other_username.search("@"),other_username);
|
|
if(other_username.search("@")==0)other_username=other_username.split("@")[1]
|
|
console.log(other_username);
|
|
async function getuser() {
|
|
let user = await (await fetch("/api/getotheruser?user="+other_username)).json()
|
|
document.getElementById('userName').innerText = `${(!user["error"] && "User: "+user.username) || "Error: "+user["error"]}`
|
|
document.getElementById('userBio').innerText = `${(!user["error"] && "Bio: " + decodeURIComponent(user.bio||"wow such empty")) || ""}`
|
|
document.title = `${(!user["error"] && user.username+"'s Page") || "No such User!"}`
|
|
let avatar = user["avatar"]
|
|
if(avatar) {
|
|
avatar = "/avatars/"+avatar
|
|
} else {
|
|
avatar = "/images/default_avatar.png"
|
|
}
|
|
document.getElementById("avatar").src = avatar
|
|
if(user["error"]) {
|
|
document.body.removeChild(document.getElementById("mentionClick"))
|
|
}
|
|
}
|
|
getuser()
|
|
|
|
function mention() {
|
|
window.location.href = `/posts?message=@${other_username}\n`
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|