Some bugfixes

This commit is contained in:
Neale Pickett 2020-05-05 20:10:16 -06:00
parent 7cdafb0dbb
commit cd965e73d8
5 changed files with 54 additions and 15 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
go.sum

3
publish.sh Executable file
View File

@ -0,0 +1,3 @@
#! /bin/sh
rsync -va static fozzie.woozle.org:/srv/vail/

View File

@ -15,6 +15,11 @@
<link rel="stylesheet" href="vail.css"> <link rel="stylesheet" href="vail.css">
</head> </head>
<body> <body>
<div id="snackbar" class="mdl-js-snackbar mdl-snackbar">
<div class="mdl-snackbar__text"></div>
<button class="mdl-snackbar__action" type="button"></button>
</div>
<div class="mdl-layout mdl-js-layout"> <div class="mdl-layout mdl-js-layout">
<header class="mdl-layout__header mdl-layout__header--scroll"> <header class="mdl-layout__header mdl-layout__header--scroll">
<div class="mdl-layout__header-row"> <div class="mdl-layout__header-row">
@ -35,9 +40,9 @@
<span class="mdl-layout-title">Repeaters</span> <span class="mdl-layout-title">Repeaters</span>
<nav class="mdl-navigation"> <nav class="mdl-navigation">
<a class="mdl-navigation__link" href="?repeater=">General Chaos</a> <a class="mdl-navigation__link" href="?repeater=">General Chaos</a>
<a class="mdl-navigation__link" href="?repeater=beg">1-15 WPM</a> <a class="mdl-navigation__link" href="?repeater=1-15+WPM">1-15 WPM</a>
<a class="mdl-navigation__link" href="?repeater=int">16-20 WPM</a> <a class="mdl-navigation__link" href="?repeater=16-20+WPM">16-20 WPM</a>
<a class="mdl-navigation__link" href="?repeater=adv">21-99 WPM</a> <a class="mdl-navigation__link" href="?repeater=21-99+WPM">21-99 WPM</a>
</nav> </nav>
<hr> <hr>
<nav class="mdl-navigation"> <nav class="mdl-navigation">
@ -90,13 +95,16 @@
<tr> <tr>
<td> <td>
<kbd>.</kbd> or <kbd>z</kbd> <kbd>.</kbd> or <kbd>z</kbd>
<br>
right-click for Dah
</td> </td>
<td> <td>
<kbd>/</kbd> or <kbd>x</kbd> <kbd>/</kbd> or <kbd>x</kbd>
</td> </td>
</tr> </tr>
<tr>
<td colspan="2">
Right-click on Dit = Dah
</td>
</tr>
</table> </table>
</div> </div>
<div class="mdl-tabs__panel" id="tools"> <div class="mdl-tabs__panel" id="tools">
@ -114,6 +122,9 @@
</table> </table>
</div> </div>
</div> </div>
<div class="mdl-card__actions right">
<button class="maximize" title="maximize"></button>
</div>
</div> </div>
<div class="mdl-card mdl-shadow--4dp"> <div class="mdl-card mdl-shadow--4dp">
@ -143,7 +154,7 @@
max="9999" max="9999"
value="4000"> value="4000">
</p> </p>
<hr> <hr>
<table> <table>
<tbody> <tbody>
<tr> <tr>
@ -180,9 +191,6 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<hr>
<p>Errors</p>
<div id="errors"></div>
</div> </div>
</div> </div>

View File

@ -18,6 +18,13 @@
text-align: center; text-align: center;
} }
.right {
text-align: right;
}
.maximized .key {
height: 100vh;
}
.wide { .wide {
width: 100%; width: 100%;
} }

View File

@ -240,6 +240,9 @@ class Vail {
e.addEventListener("mousedown", e => this.keyButton(e)) e.addEventListener("mousedown", e => this.keyButton(e))
e.addEventListener("mouseup", e => this.keyButton(e)) e.addEventListener("mouseup", e => this.keyButton(e))
} }
for (let e of document.querySelectorAll("button.maximize")) {
e.addEventListener("click", e => this.maximize(e))
}
// Listen for keystrokes // Listen for keystrokes
document.addEventListener("keydown", e => this.key(e)) document.addEventListener("keydown", e => this.key(e))
@ -254,7 +257,7 @@ class Vail {
this.inputInit("#rx-delay", e => {this.rxDelay = Number(e.target.value)}) this.inputInit("#rx-delay", e => {this.rxDelay = Number(e.target.value)})
// Show what repeater we're on // Show what repeater we're on
let repeater = (new URL(location)).searchParams.get("repeater") || "Default" let repeater = (new URL(location)).searchParams.get("repeater") || "General Chaos"
document.querySelector("#repeater").textContent = repeater document.querySelector("#repeater").textContent = repeater
// Request MIDI access // Request MIDI access
@ -264,6 +267,19 @@ class Vail {
} }
} }
maximize(e) {
let element = e.target
while (! element.classList.contains("mdl-card")) {
element = element.parentElement
if (! element) {
console.log("Maximize button: couldn't find parent card")
return
}
}
element.classList.toggle("maximized")
console.log(element)
}
openSocket() { openSocket() {
// Set up WebSocket // Set up WebSocket
let wsUrl = new URL(window.location) let wsUrl = new URL(window.location)
@ -338,12 +354,13 @@ class Vail {
error(msg) { error(msg) {
let now = new Date() let now = new Date()
let e = document.querySelector("#errors") let el = document.querySelector("#snackbar")
if (e) { let data = {
let p = e.appendChild(document.createElement("p"))
p.innerText = "[" + now.toLocaleTimeString() + "] " + msg
e.scrollTop = e.scrollHeight
} }
el.MaterialSnackbar.showSnackbar({
message: msg,
timeout: 2000
})
this.buzzer.ErrorTone() this.buzzer.ErrorTone()
} }
@ -474,6 +491,9 @@ class Vail {
this.beginTx() this.beginTx()
} else { } else {
this.endTx() this.endTx()
if (this.buzzer.ac.state != "running") {
this.error("Browser won't let me play sound yet. Try pressing a button first.")
}
} }
} }
} }