calckey/packages/client/index.html

118 lines
2.8 KiB
HTML
Raw Permalink Normal View History

2023-02-07 17:02:50 +00:00
<html>
<head>
<meta charset="utf-8">
<meta name="application-name" content="Calckey">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calckey Cli</title>
<style>
html {
background: #191724
}
main {
background: #1f1d2e;
border-radius: 10px
}
#tl>div {
padding: 16px;
border-bottom: 1px solid #908caa
}
#tl>div>header {
font-weight: 700
}
* {
font-family: BIZ UDGothic, Roboto, HelveticaNeue, Arial, sans-serif
}
#calckey_app {
display: none !important
}
body,
html {
background-color: #191724;
color: #e0def4;
justify-content: center;
margin: auto;
padding: 10px;
text-align: center
}
button {
border-radius: 999px;
padding: 0 40px;
margin-top: 1rem;
border: none;
cursor: pointer;
margin-bottom: 12px;
background: linear-gradient(90deg, #9ccfd8, #31748f);
line-height: 50px;
color: #191724;
font-weight: 700;
font-size: 20px
}
button:hover {
background: #9ccfd8
}
a {
color: #9ccfd8;
text-decoration: none
}
li,
p {
font-size: 16px
}
h1 {
font-size: 32px
}
code {
font-family: Fira, FiraCode, monospace
}
#text {
background-color: #444;
border: solid #aaa;
border-radius: 10px;
color: #e0def4;
margin-top: 3rem;
width: 20rem;
height: 5rem;
padding: .5rem
}
#text:focus {
border: solid #eee
}
@media screen and (max-width:500px) {
#text {
width: 80%
}
}
</style>
<script>"use strict"; window.onload = async () => { const e = JSON.parse(localStorage.getItem("account")).token, t = (t, n = {}) => new Promise(((o, c) => { e && (n.i = e), fetch(t.indexOf("://") > -1 ? t : `/api/${t}`, { method: "POST", body: JSON.stringify(n), credentials: "omit", cache: "no-cache" }).then((async e => { const t = 204 === e.status ? null : await e.json(); 200 === e.status ? o(t) : 204 === e.status ? o() : c(t.error) })).catch(c) })); document.getElementById("submit").addEventListener("click", (() => { t("notes/create", { text: document.getElementById("text").value }).then((() => { location.reload() })) })), t("notes/timeline").then((e => { const t = document.getElementById("tl"); for (const n of e) { const e = document.createElement("div"), o = document.createElement("header"); o.textContent = `${n.user.name} @${n.user.username}`; const c = document.createElement("div"); c.textContent = `${n.text}`, e.appendChild(o), e.appendChild(c), t.appendChild(e) } })) };</script>
</head>
<body>
<header>
<h1>Calckey Simple Client v13.1.1</h1>
</header>
<main>
<div id="form"><textarea id="text"></textarea><br><button id="submit">Post</button></div>
<div id="tl"></div>
</main>
<div id="app"></div>
<script type="module" src="/src/init.ts"></script>
</body>
</html>