diff options
| author | Kai Gunger <kgunger12@gmail.com> | 2025-12-20 17:41:40 -0500 |
|---|---|---|
| committer | Kai Gunger <kgunger12@gmail.com> | 2025-12-20 17:41:40 -0500 |
| commit | b86113fcba3c27635ae0ce31f139a1bc11b8a786 (patch) | |
| tree | 93f380971493f4afda707d5795fbc8606a1c86f0 | |
| parent | 0e1d2882487451cb69b31b0a5a09940ea6b6aa2a (diff) | |
| -rw-r--r-- | index.html | 3 | ||||
| -rw-r--r-- | scripts/gui-common/log.js | 38 | ||||
| -rw-r--r-- | scripts/gui-common/widgets.js | 28 | ||||
| -rw-r--r-- | scripts/main.js | 3 | ||||
| -rw-r--r-- | styles/main.css | 22 |
5 files changed, 4 insertions, 90 deletions
@@ -34,9 +34,6 @@ <content></content> - <log></log> - - <script src="scripts/gui-common/log.js"></script> <script src="scripts/gui-common/color.js"></script> <script src="scripts/gui-common/temperature.js"></script> <script src="scripts/gui-common/widgets.js"></script> diff --git a/scripts/gui-common/log.js b/scripts/gui-common/log.js deleted file mode 100644 index bc93546..0000000 --- a/scripts/gui-common/log.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - - -const LOG_EL = document.getElementsByTagName("log")[0]; -let LAST_LOG_TYPE = ""; - -function at_bot(el) { - return (el.scrollTop + 10) >= (el.scrollHeight - el.clientHeight) -} - -function addLogEntry(object) { - - let do_scroll = at_bot(LOG_EL); - - let out = { - type: object.type, - target: object.target - }; - - if (LAST_LOG_TYPE == "mousemove" || LAST_LOG_TYPE == "touchmove") { - if (LAST_LOG_TYPE == out.type) - return; - } - - LAST_LOG_TYPE = out.type; - - let entry = document.createElement("entry"); - entry.innerText = JSON.stringify(out); - - LOG_EL.appendChild(entry); - - if (do_scroll) { - LOG_EL.scroll({ - top: LOG_EL.scrollHeight, - behavior: "instant", - }); - } -}
\ No newline at end of file diff --git a/scripts/gui-common/widgets.js b/scripts/gui-common/widgets.js index c99c3b1..627119f 100644 --- a/scripts/gui-common/widgets.js +++ b/scripts/gui-common/widgets.js @@ -1,7 +1,5 @@ 'use strict'; -var WIDGETS_DEBUG = false; - /** * The base Widget class. Represents an interactible * value-producing object in the browser, like an input. @@ -108,10 +106,6 @@ class Widget extends EventTarget{ /** @param {MouseEvent} event */ #emitMouseEvent(event) { - if (WIDGETS_DEBUG) { - addLogEntry(event); - } - if (this.#inactive) this.dispatchEvent(new CustomEvent("inactive", {detail: {widget: this, event: new MouseEvent(event.type, event)}})); else @@ -121,10 +115,6 @@ class Widget extends EventTarget{ /** @param {TouchEvent} event */ #emitTouchEvent(event) { - if (WIDGETS_DEBUG) { - addLogEntry(event); - } - if (event.type == "touchstart") this.element.classList.add("touch"); else if (event.type == "touchend" || event.type == "touchcancel") @@ -139,11 +129,8 @@ class Widget extends EventTarget{ } /** @param {KeyboardEvent} event */ - #emitKeyboardEvent(event) { - if (WIDGETS_DEBUG) { - addLogEntry(event); - } - + #emitKeyboardEvent(event) + { if (this.#inactive) this.dispatchEvent(new CustomEvent("inactive", {detail: {widget: this, event: new KeyboardEvent(event.type, event)}})); else @@ -154,11 +141,8 @@ class Widget extends EventTarget{ } /** @param {FocusEvent} event */ - #emitFocusEvent(event) { - if (WIDGETS_DEBUG) { - addLogEntry(event); - } - + #emitFocusEvent(event) + { if (this.#inactive) this.dispatchEvent(new CustomEvent("inactive", {detail: {widget: this, event: new FocusEvent(event.type, event)}})); else @@ -171,10 +155,6 @@ class Widget extends EventTarget{ /** @param {Event} event */ #emitContextEvent(event) { - if (WIDGETS_DEBUG) { - addLogEntry(event); - } - if (this.#inactive) this.dispatchEvent(new CustomEvent("inactive", {detail: {widget: this, event: new Event(event.type, event)}})); else diff --git a/scripts/main.js b/scripts/main.js index bda7798..271dbe3 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -32,9 +32,6 @@ class Client { { if (e.detail.name == "scb" && e.detail.changed == "value") this.set.widgets["thm"].set(Temperature.from_celcius(e.detail.value)); - - if (e.detail.name == "cb" && e.detail.changed == "value") - WIDGETS_DEBUG = !(!(e.detail.value)) } } diff --git a/styles/main.css b/styles/main.css index cd73155..b37552e 100644 --- a/styles/main.css +++ b/styles/main.css @@ -70,25 +70,3 @@ content { margin-right: 50px; margin-bottom:50px; } - -log { - padding: 5px; - display: flex; - flex-direction: column; - align-items: center; - position: absolute; - width: 90%; - height: 20vh; - left: 5%; - bottom: 5vw; - border-radius: 3px; - background-color: white; - overflow: scroll; -} - -log entry { - display: block; - width: 90%; - border: 2px solid gray; - border-radius: 5px; -}
\ No newline at end of file |