-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
135 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
--- | ||
<p>work in progress<span id="wip">...</span></p> | ||
|
||
<script> | ||
const element = document.getElementById("wip"); | ||
let iteration = 3; | ||
|
||
setInterval(() => { | ||
if (!element) { | ||
return; | ||
} else if (iteration > 5) { | ||
iteration = 0; | ||
} | ||
|
||
element.textContent = ".".repeat(iteration > 3 ? 3 : iteration); | ||
iteration++; | ||
}, 250); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,102 @@ | ||
--- | ||
--- | ||
<div id="chat"> | ||
<p> | ||
<b>chat</b> | ||
<noscript> | ||
<span id="noscript">javascript required sorry :(</span> | ||
</noscript> | ||
</p> | ||
|
||
<ul id="history"></ul> | ||
<input type="text" placeholder="send a message..." autofocus> | ||
</div> | ||
|
||
<script> | ||
const input = document.querySelector(`#chat input[type="text"]`) as HTMLInputElement; | ||
const history = document.querySelector("#history") as HTMLUListElement; | ||
const username = "mudkip"; | ||
|
||
if (!input || !history) { | ||
console.error("could not find chat elements"); | ||
} | ||
|
||
input.addEventListener("keydown", (event: KeyboardEvent) => { | ||
if (event.key === "Enter") { | ||
event.preventDefault(); | ||
const value = input.value.trim(); | ||
|
||
if (!value) { | ||
return; | ||
} | ||
|
||
const element = document.createElement("li"); | ||
|
||
const usernameElement = document.createElement("span"); | ||
usernameElement.textContent = "<" + username + ">"; | ||
usernameElement.style.color = "var(--ctp-macchiato-green)"; | ||
usernameElement.style.fontSize = "inherit"; | ||
element.appendChild(usernameElement); | ||
|
||
const messageElement = document.createTextNode(" " + value); | ||
element.appendChild(messageElement); | ||
|
||
history.appendChild(element); | ||
input.value = ""; | ||
} | ||
}); | ||
</script> | ||
|
||
<style> | ||
@keyframes blink { | ||
0% { | ||
opacity: 1; | ||
} | ||
|
||
50% { | ||
opacity: 0; | ||
} | ||
|
||
100% { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
#chat { | ||
border: 2px solid var(--surface-3); | ||
padding: 1em; | ||
} | ||
|
||
#noscript { | ||
font-size: inherit; | ||
color: var(--ctp-macchiato-red); | ||
animation: blink 1.5s infinite; | ||
} | ||
|
||
#history { | ||
margin: 2em 0; | ||
list-style: none; | ||
word-wrap: break-word; | ||
overflow-y: auto; | ||
max-height: 20em; | ||
} | ||
|
||
input { | ||
padding: 0.5em; | ||
box-sizing: border-box; | ||
width: 100%; | ||
|
||
font-family: Terminus, monospace; | ||
font-size: 1.2em; | ||
|
||
border: none; | ||
outline: none; | ||
|
||
background: var(--surface-3); | ||
color: var(--text); | ||
} | ||
|
||
input::placeholder { | ||
color: var(--ctp-macchiato-overlay1); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,7 @@ | ||
--- | ||
import Page from "@layouts/Page.astro"; | ||
import WorkInProgress from "@components/WorkInProgress.astro"; | ||
--- | ||
<Page title="about"> | ||
<p>work in progress<span id="wip">...</span></p> | ||
</Page> | ||
|
||
<script> | ||
const element = document.getElementById("wip"); | ||
let iteration = 3; | ||
|
||
setInterval(() => { | ||
if (!element) { | ||
return; | ||
} else if (iteration > 5) { | ||
iteration = 0; | ||
} | ||
|
||
element.textContent = ".".repeat(iteration > 3 ? 3 : iteration); | ||
iteration++; | ||
}, 250); | ||
</script> | ||
<WorkInProgress /> | ||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
import Chat from "@components/chat/Chat.astro" | ||
import WorkInProgress from "@components/WorkInProgress.astro" | ||
import Page from "@layouts/Page.astro" | ||
--- | ||
<Page title="random"> | ||
<WorkInProgress /> | ||
<div style="margin: 1em 0"></div> | ||
<Chat /> | ||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters