Compare commits

..

No commits in common. "5b9bc0302ef161bf4904b7e00d984c80a7b10121" and "f8b5cf22afc69062f67e6855b0f848e01664113e" have entirely different histories.

3 changed files with 12 additions and 83 deletions

View File

@ -42,35 +42,6 @@
</div>
</nav>
<div class="modal is-active init">
<div class="modal-content">
<div class="notification is-info">
<h1 class="title has-text-centered">
Loading...
</h1>
<p>
If you can read this,
it could mean
your browser has disabled JavaScript,
a browser extension is interfering with JavaScript,
or your browser is too old to run Vail.
</p>
<p>
Please post a screen shot in a new
<a href="https://github.com/nealey/vail/discussions">Vail Discussions</a>
thread,
or in our
<a href="https://discord.gg/GBzj8cBat7">Discord instance</a>,
so we can help you out!
</p>
<ul>
<li>Starting JavaScript application...</li>
</ul>
</div>
</div>
</div>
</div>
<section class="section">
<div class="columns is-multiline">
<div class="column">

View File

@ -16,21 +16,6 @@ const globalAudioContext = new AudioContext({
latencyHint: "interactive",
})
function initLog(message) {
for (let modal of document.querySelectorAll(".modal.init")) {
if (!message) {
modal.remove()
} else {
let ul = modal.querySelector("ul")
while (ul.childNodes.length > 5) {
ul.firstChild.remove()
}
let li = ul.appendChild(document.createElement("li"))
li.textContent = message
}
}
}
/**
* Pop up a message, using an notification.
*
@ -59,34 +44,34 @@ class VailClient {
this.rxDelay = 0 * time.Millisecond // Time to add to incoming timestamps
this.beginTxTime = null // Time when we began transmitting
initLog("Initializing outputs")
// Outputs
this.outputs = new Outputs.Collection(globalAudioContext)
this.outputs.connect(globalAudioContext.destination)
initLog("Starting up noise")
// Noise
this.noise = new Noise.Noise(globalAudioContext)
this.noise.connect(globalAudioContext.destination)
initLog("Setting app icon name")
// App icon
this.icon = new Icon.Icon()
initLog("Initializing keyers")
// Keyers
this.straightKeyer = new Keyers.Keyers.straight(this)
this.keyer = new Keyers.Keyers.straight(this)
this.roboKeyer = new Keyers.Keyers.robo(() => this.Buzz(), () => this.Silence())
// Set up various input methods
// Send this as the keyer so we can intercept dit and dah events for charts
initLog("Setting up input methods")
this.inputs = new Inputs.Collection(this)
initLog("Listening on AudioContext")
// If the user clicks anything, try immediately to resume the audio context
document.body.addEventListener(
"click",
e => globalAudioContext.resume(),
true,
)
initLog('Setting up maximize button')
// Maximize button
for (let e of document.querySelectorAll("button.maximize")) {
e.addEventListener("click", e => this.maximize(e))
}
@ -94,7 +79,7 @@ class VailClient {
e.addEventListener("click", e => this.reset())
}
initLog("Initializing knobs")
// Set up inputs
this.inputInit("#keyer-mode", e => this.setKeyer(e.target.value))
this.inputInit("#keyer-rate", e => {
let rate = e.target.value
@ -137,15 +122,14 @@ class VailClient {
})
this.inputInit("#notes")
initLog("Filling in repeater name")
// Fill in the name of our repeater
document.querySelector("#repeater").addEventListener("change", e => this.setRepeater(e.target.value.trim()))
window.addEventListener("hashchange", () => this.hashchange())
this.hashchange()
initLog("Starting timing charts")
this.setTimingCharts(true)
initLog("Setting up mute icon")
// Turn off the "muted" symbol when we can start making noise
globalAudioContext.resume()
.then(() => {
for (let e of document.querySelectorAll(".muted")) {
@ -499,23 +483,17 @@ class VailClient {
}
}
async function init() {
initLog("Starting service worker")
function init() {
if (navigator.serviceWorker) {
navigator.serviceWorker.register("scripts/sw.js")
}
initLog("Setting up internationalization")
await I18n.Setup()
initLog("Creating client")
I18n.Setup()
try {
window.app = new VailClient()
} catch (err) {
console.log(err)
toast(err)
}
initLog(false)
}

View File

@ -94,23 +94,3 @@ code {
height: 0.5em;
width: 100%;
}
.loader {
width: 48px;
height: 48px;
border: 5px solid #FFF;
border-bottom-color: transparent;
border-radius: 50%;
display: inline-block;
box-sizing: border-box;
animation: rotation 1s linear infinite;
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}