More UI fixes

This commit is contained in:
Neale Pickett 2022-05-15 10:46:51 -06:00
parent dec3959b66
commit f970376f17
5 changed files with 59 additions and 58 deletions

View File

@ -1,5 +1,5 @@
const HIGH_FREQ = 666 const HIGH_FREQ = 555
const LOW_FREQ = 555 const LOW_FREQ = 444
/** /**

View File

@ -27,7 +27,8 @@
</div> </div>
<div class="navbar-menu"> <div class="navbar-menu">
<div class="navbar-end"> <div class="navbar-end">
<a class="navbar-item" href="https://github.com/nealey/vail/wiki" target="_blank">Help</a> <a class="navbar-item" href="https://discord.gg/GBzj8cBat7" target="_blank" title="Text/voice chat on Discord"><i class="mdi mdi-discord"></i></a>
<a class="navbar-item" href="https://github.com/nealey/vail/wiki" target="_blank" title="Vail Wiki">Help</a>
</div> </div>
</div> </div>
</nav> </nav>
@ -40,30 +41,29 @@
<div class="level"> <div class="level">
<div class="level-left"> <div class="level-left">
<div class="level-item"> <div class="level-item">
<div class="field is-horizontal">
<div class="field-label is-hidden">
<label class="label" for="repeater">Repeater</label>
</div>
<div class="field-body">
<div class="field">
<div class="control">
<input class="input" type="text" id="repeater" list="repeater-list"> <input class="input" type="text" id="repeater" list="repeater-list">
<datalist id="repeater-list"> <datalist id="repeater-list"></datalist>
<option>General</option> <div class="dropdown is-right is-hoverable">
<option value="1">Channel 1</option> <div class="dropdown-trigger">
<option value="2">Channel 2</option> <button class="button" aria-haspopup="true" aria-controls="stock-repeaters">
<option value="3">Channel 3</option> <span class="icon is-small">
<option value="Null">No transmit</option> <i class="mdi mdi-chevron-down" aria-hidden="true"></i>
<option>Echo</option> </span>
<option>Echo 5s</option> </button>
<option>Echo 10s</option>
<option>Fortunes</option>
<option>Fortunes: Pauses ×2</option>
<option>Fortunes: Pauses ×4</option>
<option>Fortunes: Pauses ×8</option>
</datalist>
</div> </div>
<div class="dropdown-menu" id="stock-repeaters" role="menu">
<div class="dropdown-content">
<a class="dropdown-item" data-value="">General</a>
<a class="dropdown-item" data-value="1">Channel 1</a>
<a class="dropdown-item" data-value="2">Channel 2</a>
<a class="dropdown-item" data-value="3">Channel 3</a>
<hr class="dropdown-divider">
<a class="dropdown-item" data-value="Null">Null (no transmit)</a>
<a class="dropdown-item">Echo</a>
<a class="dropdown-item">Fortunes</a>
<a class="dropdown-item">Fortunes: Pauses ×2</a>
<a class="dropdown-item">Fortunes: Pauses ×4</a>
<a class="dropdown-item">Fortunes: Pauses ×8</a>
</div> </div>
</div> </div>
</div> </div>
@ -245,7 +245,12 @@
<div class="box"> <div class="box">
<h2 class="title">Notes</h2> <h2 class="title">Notes</h2>
<textarea class="textarea" placeholder="Enter your own notes here" id="notes"></textarea> <textarea class="textarea" placeholder="Enter your own notes here" id="notes"></textarea>
<a href="https://github.com/nealey/vail/wiki" target="_blank">Vail Wiki</a> <nav class="breadcrumb has-bullet-separator">
<ul>
<li><a href="https://discord.gg/GBzj8cBat7" target="_blank" title="Text/voice chat on Discord"><i class="mdi mdi-discord"></i></a></li>
<li><a href="https://github.com/nealey/vail/wiki" target="_blank" title="Vail Wiki">Help</a></li>
</ul>
</nav>
</div> </div>
<div class="columns is-centered bottom"> <div class="columns is-centered bottom">

View File

@ -26,14 +26,14 @@ export class HTML extends Input{
} }
keyButton(event) { keyButton(event) {
let begin = event.type.endsWith("down") || event.type.endsWith("start") let down = event.type.endsWith("down") || event.type.endsWith("start")
let key = event.target.dataset.key let key = Number(event.target.dataset.key)
// Button 2 does the other key (assuming 2 keys) // Button 2 does the other key (assuming 2 keys)
if (event.button == 2) { if (event.button == 2) {
key = 1 - key key = 1 - key
} }
this.keyer.Key(key, begin) this.keyer.Key(key, down)
if (event.cancelable) { if (event.cancelable) {
event.preventDefault() event.preventDefault()

View File

@ -1,35 +1,34 @@
/** /**
* If the user clicked on the little down arrow, * Set up repeater autofill list, and make dropdown active
* clear the input field so all autocomplete options are shown.
* *
* This kludge may not work properly on every browser. * This fills the dataset from the dropdown, and make each dropdown element set
* * the value in the input field.
* @param event Triggering event
*/ */
function maybeDropdown(event) { function setRepeaterList() {
let el = event.target let input = document.querySelector("#repeater")
switch (event.type) { let datalist = document.querySelector("datalist#repeater-list")
case "click": let repeaterList = document.querySelector("#stock-repeaters .dropdown-content")
let offset = el.clientWidth + el.offsetLeft - event.clientX; for (let a of repeaterList.children) {
if (el.value) { if (a.tagName == "A") {
el.dataset.value = el.value let opt = datalist.appendChild(document.createElement("option"))
if (a.dataset.value != undefined) {
opt.value = a.dataset.value
} }
if (offset < 0) { opt.textContent = a.textContent
el.value = ""
a.addEventListener(
"click",
() => {
input.value = opt.value
input.dispatchEvent(new Event("change"))
},
)
} }
break
case "mouseleave":
if (!el.value) {
el.value = el.dataset.value
}
break;
} }
} }
function init() { function init() {
let rep = document.querySelector("#repeater") setRepeaterList()
rep.addEventListener("click", maybeDropdown)
rep.addEventListener("mouseleave", maybeDropdown)
} }
if (document.readyState === "loading") { if (document.readyState === "loading") {

View File

@ -285,9 +285,6 @@ class VailClient {
this.roboKeyer.SetPauseMultiplier(number || 1) this.roboKeyer.SetPauseMultiplier(number || 1)
this.repeater = new Repeaters.Fortune(rx, this.roboKeyer) this.repeater = new Repeaters.Fortune(rx, this.roboKeyer)
} else if (name.startsWith("Echo")) { } else if (name.startsWith("Echo")) {
let delayElement = document.querySelector("#rx-delay")
delayElement.value = (number || 2) * Second
delayElement.dispatchEvent(new Event("input"))
this.repeater = new Repeaters.Echo(rx) this.repeater = new Repeaters.Echo(rx)
} else if (name == "Null") { } else if (name == "Null") {
this.repeater = new Repeaters.Null(rx) this.repeater = new Repeaters.Null(rx)