diff --git a/LICENSE b/LICENSE index 91b74be..f727380 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Haoming +Copyright (c) 2025 Haoming Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 818e176..ccbb3e5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,2 @@ # ComfyUI Clear Screen -This is an Extension for [ComfyUI](https://github.com/comfyanonymous/ComfyUI), which adds a **CLS** button that clears the console window. - -### But Why ? -Useful for benchmarking, extension developing, or when you just want to clear the console ~~after it craps out tons of errors~~. +This is an Extension for [ComfyUI](https://github.com/comfyanonymous/ComfyUI), which adds a button, **CLS**, that clears both Python console and Browser console. diff --git a/js/cls.js b/js/cls.js index 3050cda..71d9b0b 100644 --- a/js/cls.js +++ b/js/cls.js @@ -6,7 +6,10 @@ function legacy() { const clsButton = document.createElement("button"); clsButton.textContent = "CLS"; - clsButton.addEventListener("click", () => api.fetchApi("/utils/cls")); + clsButton.addEventListener("click", () => { + api.fetchApi("/utils/cls"); + console.clear(); + }); const clearButton = document.getElementById("comfy-clear-button"); menu.insertBefore(clsButton, clearButton); @@ -16,27 +19,26 @@ async function frontend() { const btn = new (await import("../../scripts/ui/components/button.js")).ComfyButton({ icon: "backspace-outline", action: () => { - api.fetchApi("/utils/cls") + api.fetchApi("/utils/cls"); + console.clear(); }, tooltip: "Clear Console", content: "CLS", - classList: "comfyui-button comfyui-menu-mobile-collapse" + classList: "comfyui-button comfyui-menu-mobile-collapse", }).element; - app.menu?.actionsGroup.element.after(btn); + app.menu.actionsGroup.element.after(btn); } app.registerExtension({ - name: "Comfy.CLS", + name: "Comfy.ClearScreen", async setup() { - try { await frontend(); } catch { - // No Frontend? + // No Frontend } legacy(); - - } + }, }); diff --git a/pyproject.toml b/pyproject.toml index 3736ef5..e390699 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-clear-screen" description = "Add a button that clears the console" -version = "1.1.0" +version = "1.2.0" license = { text = "MIT License" } dependencies = []