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 0000000..865d265 Binary files /dev/null and b/py/__pycache__/workflow_timer.cpython-313.pyc differ diff --git a/pyproject.toml b/pyproject.toml index e84dee6..3ad379e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "ComfyUI_Workflow_Timer" description = "A simple workflow timer node for ComfyUI." -version = "1.0.1" +version = "1.0.2" license = {file = "LICENSE"} [project.urls] @@ -12,5 +12,5 @@ Repository = "https://github.com/mike420/ComfyUI_Workflow_Timer" [tool.comfy] PublisherId = "mike420" DisplayName = "ComfyUI_Workflow_Timer" -Icon = "https://thumbs2.imgbox.com/1b/68/FGxogerm_t.jpg" +Icon = "https://raw.githubusercontent.com/mike420/ComfyUI_Workflow_Timer/refs/heads/main/img/magic_mike.jpg" includes = [] \ No newline at end of file