From 7645be251c3c8dfc66226abcc9c753b64f25a280 Mon Sep 17 00:00:00 2001 From: Thomas Fritzsche Date: Mon, 25 Nov 2024 00:08:05 +0100 Subject: [PATCH] Add Rit --- config.js | 18 ++++++++++++++---- contest.js | 5 +++++ index.html | 29 ++++++++++++++++++++++------- style.css | 7 ++++++- view.js | 9 +++++++++ 5 files changed, 56 insertions(+), 12 deletions(-) diff --git a/config.js b/config.js index 3cee87d..f385254 100644 --- a/config.js +++ b/config.js @@ -10,10 +10,11 @@ export class Config { this._time = document.querySelector("#time") this._qsk = document.querySelector("#qsk") this._bandwidth = document.querySelector("#bandwidth") + this._rit = document.querySelector("#rit") this._callback = callback - this.all = document.querySelectorAll(".watch").forEach( + this.all = document.querySelectorAll(".watch").forEach( d => d.addEventListener('input', e => { this.update() })) @@ -26,14 +27,21 @@ export class Config { rx_bandwidth: 300, time: 10, qsk: false, + rit: 0, } this.load() } update() { - this.read_dom() - this.store() - this._callback(this._config) + this.read_dom() + this.store() + this._callback(this._config) + } + + updateRIT(x) { + let rit = Number(this._rit.value) + this._rit.value = String(rit + x) + this.update() } store() { @@ -55,6 +63,7 @@ export class Config { this._time.value = this._config.time this._qsk.checked = this._config.qsk this._bandwidth.value = this._config.rx_bandwidth + this._rit.value = this._config.rit } read_dom() { @@ -65,6 +74,7 @@ export class Config { this._config.time = this._time.value this._config.qsk = this._qsk.checked this._config.rx_bandwidth = this._bandwidth.value + this._config.rit = this._rit.value } diff --git a/contest.js b/contest.js index 2af5cc2..ad8c5bc 100644 --- a/contest.js +++ b/contest.js @@ -106,6 +106,11 @@ export class Contest { // Update volume this.Smg = Math.pow(10, (conf.volume - 0.75) * 4) + + // RIT + if (DEFAULT.RIT !== conf.rit) { + DEFAULT.RIT = conf.rit + } } onmessage = (message) => { diff --git a/index.html b/index.html index 73e7f6f..e580d67 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ - Morse Runner + Web Morse Runner @@ -47,7 +47,8 @@
- +
WPM
@@ -78,20 +79,34 @@ - - + +
- + +
+
+ + + + +
for
- +
+ + diff --git a/style.css b/style.css index 6d99c02..c24eac8 100644 --- a/style.css +++ b/style.css @@ -222,4 +222,9 @@ fieldset { .box { padding: 10px; -} \ No newline at end of file +} + +.slider { + width: 100%; +} + diff --git a/view.js b/view.js index aa9e6f2..cd4cf8e 100644 --- a/view.js +++ b/view.js @@ -176,6 +176,15 @@ export class View { switch (e.code) { case 'Enter': this.processEnter() + e.preventDefault() + break + case 'ArrowDown': + this._config.updateRIT(-50) + e.preventDefault() + break + case 'ArrowUp': + this._config.updateRIT(50) + e.preventDefault() break default: if (this.processFunctionKey(e.code)) e.preventDefault()