This commit is contained in:
Chris Wanstrath 2025-09-19 14:47:00 -07:00
parent 25b0ead8b1
commit d7a96baa4b
5 changed files with 22 additions and 12 deletions

View File

@ -1,5 +1,10 @@
import { cmdTextbox } from "./dom.js" import { cmdTextbox } from "./dom.js"
export function initFocus() {
window.addEventListener("click", focusHandler)
focusTextbox()
}
export function focusTextbox() { export function focusTextbox() {
cmdTextbox.focus() cmdTextbox.focus()
} }
@ -29,4 +34,4 @@ export function focusHandler(e: MouseEvent) {
e.preventDefault() e.preventDefault()
return true return true
} }
} }

View File

@ -1,11 +1,10 @@
import { resize } from "./resize.js" import { initResize } from "./resize.js"
import { focusTextbox, focusHandler } from "./focus.js" import { initFocus } from "./focus.js"
import { startVramCounter } from "./vram.js" import { startVramCounter } from "./vram.js"
import { startConnection } from "./websocket.js"
window.addEventListener("click", focusHandler) initFocus()
focusTextbox() initResize()
window.addEventListener("resize", resize)
resize()
startConnection()
startVramCounter() startVramCounter()

View File

@ -1,5 +1,10 @@
const content = document.getElementById("content")! const content = document.getElementById("content")!
export function initResize() {
window.addEventListener("resize", resize)
resize()
}
export function resize() { export function resize() {
if (document.body.dataset.mode === "tall") { if (document.body.dataset.mode === "tall") {
resizeTall() resizeTall()

View File

@ -11,15 +11,13 @@ export const startVramCounter = () => {
const count = parseInt(vramCounter.textContent!) + 1 const count = parseInt(vramCounter.textContent!) + 1
let val = count + "KB" let val = count + "KB"
if (count < 10) if (count < 10)
val = "00" + val
else if (count < 100)
val = "0" + val val = "0" + val
vramCounter.textContent = val vramCounter.textContent = val
if (count >= 640) { if (count >= 64) {
vramCounter.textContent += " OK" vramCounter.textContent += " OK"
clearInterval(timer) clearInterval(timer)
} }
}, 5) }, 15)
} }

3
src/js/websocket.ts Normal file
View File

@ -0,0 +1,3 @@
export function startConnection() {
console.log("whee")
}