diff --git a/static/inputs.mjs b/static/inputs.mjs index 83fc26f..0d6c42a 100644 --- a/static/inputs.mjs +++ b/static/inputs.mjs @@ -13,6 +13,9 @@ export class HTML extends Input{ // Listen to HTML buttons for (let e of document.querySelectorAll("button.key")) { + // Chrome is going to suggest you use passive events here. + // I tried that and it screws up Safari mobile, + // making it so that hitting the button selects text on the page. e.addEventListener("contextmenu", e => { e.preventDefault(); return false }, {passive: false}) e.addEventListener("touchstart", e => this.keyButton(e), {passive: false}) e.addEventListener("touchend", e => this.keyButton(e), {passive: false}) diff --git a/static/repeaters.mjs b/static/repeaters.mjs index 6d8622f..107913e 100644 --- a/static/repeaters.mjs +++ b/static/repeaters.mjs @@ -10,6 +10,7 @@ export class Vail { this.name = name this.lagDurations = [] this.sent = [] + this.wantConnected = true this.wsUrl = new URL("chat", window.location) this.wsUrl.protocol = this.wsUrl.protocol.replace("http", "ws") @@ -20,6 +21,9 @@ export class Vail { } reopen() { + if (!this.wantConnected) { + return + } console.info("Attempting to reconnect", this.wsUrl.href) this.clockOffset = 0 this.socket = new WebSocket(this.wsUrl) @@ -67,7 +71,7 @@ export class Vail { return } - console.debug("Vail.wsMessage()", msg) + console.debug("Vail.wsMessage()", this.socket, msg) // The very first packet is the server telling us the current time if (durations.length == 0) { @@ -108,7 +112,7 @@ export class Vail { console.error("Not connected, dropping", jmsg) return } - console.debug("Transmit", msg) + console.debug("Transmit", this.socket, msg) this.socket.send(jmsg) if (squelch) { this.sent.push(jmsg) @@ -116,6 +120,7 @@ export class Vail { } Close() { + this.wantConnected = false this.socket.close() } } diff --git a/static/vail.mjs b/static/vail.mjs index 4e1e67e..4ed288f 100644 --- a/static/vail.mjs +++ b/static/vail.mjs @@ -14,9 +14,9 @@ const Second = 1000 * Millisecond * @param {string} msg Message to display */ function toast(msg) { + console.info(msg) let el = document.querySelector("#snackbar") if (!el || !el.MaterialSnackbar) { - console.info(msg) return } el.MaterialSnackbar.showSnackbar({