77 lines
2.4 KiB
HTML
77 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html>
|
|
<head>
|
|
<title>Home - InfoPage</title>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<link rel="stylesheet" href="/css/base.css">
|
|
<link rel="stylesheet" href="/css/home.css">
|
|
<script src="/js/base.js"></script>
|
|
|
|
<script>
|
|
if (localStorage.getItem("token")) {
|
|
setCookie("token", localStorage.getItem("token"));
|
|
} else {
|
|
window.location.href = "/logout";
|
|
}
|
|
|
|
let public = eval("{{PUBLIC}}");
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>Welcome, {{DISPL_NAME}}!</h1>
|
|
<div tabindex="1" onclick="window.location.href = '/editor'" class="home-container">
|
|
<p>Edit your profile</p>
|
|
{{DISPL_NAME}} (@{{USERNAME}})<br>
|
|
</div>
|
|
<div tabindex="2" onclick="toggleVisibility()" class="home-container">
|
|
<p>Toggle visibility</p>
|
|
Visibility: <span id="public-thing"></span>Public
|
|
</div>
|
|
<div tabindex="3" onclick="window.location.href = '/browse'" class="home-container">
|
|
<p>Browse other profiles</p>
|
|
Total public profiles: <span id="total">{{TOTAL}}</span>
|
|
</div>
|
|
<div tabindex="4" onclick="window.location.href = '/u/{{USERNAME}}'" class="home-container">
|
|
<p>Preview your profile</p>
|
|
Shortened url:<br>
|
|
https://infopg.web.app/u/{{USERNAME}}
|
|
</div>
|
|
<div tabindex="5" onclick="window.location.href = '/logout'" class="home-container">
|
|
<p>Log out</p>
|
|
You can always log back in
|
|
</div>
|
|
<div tabindex="6" onclick="window.location.href = '/settings'" class="home-container">
|
|
<p>User Settings</p>
|
|
Change password, delete acc, etc.
|
|
</div>
|
|
|
|
<script>
|
|
[...document.querySelectorAll("[onclick][tabindex]")].forEach(function(val, index) {
|
|
val.addEventListener("keyup", function(event) {
|
|
event.preventDefault();
|
|
if (event.keyCode === 13 || event.keyCode === 32) {
|
|
val.click();
|
|
}
|
|
});
|
|
})
|
|
|
|
dom("public-thing").innerText = public ? "" : "Not "
|
|
|
|
function toggleVisibility() {
|
|
public = !public;
|
|
dom("public-thing").innerText = public ? "" : "Not ";
|
|
dom("total").innerText = +dom("total").innerText + (public ? 1 : -1);
|
|
|
|
fetch( "/api/save", {
|
|
"method": "PATCH",
|
|
"body": JSON.stringify({
|
|
"public": public
|
|
})
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|