44 lines
1.7 KiB
HTML
44 lines
1.7 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>
|
|
<link rel="stylesheet" href="/css/style.css">
|
|
<link rel="stylesheet" href="/css/global.css">
|
|
</head>
|
|
<body>
|
|
<ul class="navbar">
|
|
<li><a href="/">Home</a></li>
|
|
<li><a href="/user">Profile</a></li>
|
|
<li><a href="/posts">Posts</a></li>
|
|
</ul>
|
|
<h3 id="userName">USER</h3>
|
|
<h4 id="userBio">Bio: </h4>
|
|
<button id="mentionClick" onclick="mention()">Mention this User in Posts!</button>
|
|
|
|
|
|
<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)) || ""}`
|
|
document.title = `${(!user["error"] && user.username+"'s Page") || "No such User!"}`
|
|
if(user["error"]) {
|
|
document.body.removeChild(document.getElementById("mentionClick"))
|
|
}
|
|
}
|
|
getuser()
|
|
|
|
function mention() {
|
|
window.location.href = `/posts?mention=${other_username}`
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|