From d23bc80827fd15aec80f6d537085765efe0e9c95 Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 5 Apr 2026 12:44:09 +0100 Subject: [PATCH] moved css --- js/workflow_timer.css | 15 ++++++++ js/workflow_timer.js | 35 ++++++------------ py/__pycache__/workflow_timer.cpython-313.pyc | Bin 0 -> 943 bytes pyproject.toml | 4 +- 4 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 js/workflow_timer.css create mode 100644 py/__pycache__/workflow_timer.cpython-313.pyc diff --git a/js/workflow_timer.css b/js/workflow_timer.css new file mode 100644 index 0000000..6df0fd5 --- /dev/null +++ b/js/workflow_timer.css @@ -0,0 +1,15 @@ +.workflow-timer-display { + font-size: 50px; + font-family: monospace; + font-weight:bold; + color: #fff; + white-space: nowrap; + letter-spacing: 0.05em; +} + +.workflow-timer-last-run { + font-family: sans-serif; + color: #888; + text-transform: uppercase; + letter-spacing: 1px; +} \ No newline at end of file diff --git a/js/workflow_timer.js b/js/workflow_timer.js index e88bd81..d71427c 100644 --- a/js/workflow_timer.js +++ b/js/workflow_timer.js @@ -73,6 +73,16 @@ const GlobalTimer = { unregisterNode(node) { this.activeNodes.delete(node); } }; +function loadStylesheet() { + const cssUrl = new URL("workflow_timer.css", import.meta.url); + if (!document.querySelector(`link[href="${cssUrl}"]`)) { + const link = document.createElement("link"); + link.rel = "stylesheet"; + link.href = cssUrl; + document.head.appendChild(link); + } +} + app.registerExtension({ name: "MagicTools.WorkflowTimer", @@ -101,7 +111,6 @@ app.registerExtension({ const display = document.createElement("div"); display.className = "workflow-timer-display"; display.textContent = this.properties.elapsed_time_str; - display.style.fontSize = "50px"; // Last Execution Label const lastTime = document.createElement("div"); @@ -132,28 +141,8 @@ app.registerExtension({ }; }, - setup() { - if (!document.getElementById("workflow-timer-style")) { - const style = document.createElement("style"); - style.id = "workflow-timer-style"; - style.textContent = ` - .workflow-timer-display { - font-family:'Courier New','Consolas','Monaco',monospace; - font-weight:bold; - color: #fff; - white-space: nowrap; - letter-spacing: 0.05em; - } - .workflow-timer-last-run { - font-family: sans-serif; - color: #888; - text-transform: uppercase; - letter-spacing: 1px; - } - `; - document.head.appendChild(style); - } - + setup() { + loadStylesheet(); api.addEventListener("execution_start", () => GlobalTimer.start()); api.addEventListener("executing", ({ detail }) => { if (!detail) GlobalTimer.stop(); diff --git a/py/__pycache__/workflow_timer.cpython-313.pyc b/py/__pycache__/workflow_timer.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..865d26546bd600d8eb7da6efb0599a000a74b8a4 GIT binary patch literal 943 zcmZuw&u`N(7^RTO@Dm#zX$+);~&db z$dhc7C6{0m>;MBafFbOP3j~8xQIp(dJs)!fWP9x664(F>2Ed{rV95}1!H}?Q6tH5* zxM-_}(g3^pYFsjk4S>t6s&cAoCAxlOzK-#mK@g8jKSWrMJ@lPX1fKvcqPNIR6J(|} zHZlA7`CaqKIrZJ98OH%}dDXIU5fbZJorO#Ah|xDhLu!dep(Wl2nygc$*Y6(nOj@$^ z&MT`8I|rIbl_8G9VM0r3HL0?D}X@Q_%Km|znRX3Zs$_C6U>DG00@|#*?1%&e%gK2f`LkaWi(6tq+ zLKrzAf{>OW3}Y`1c)kMRdFli?QiX8fW0C}Zgrblb