Download comfyui-custom-scripts/web/js/stringFunction.js from MarkLilly/mis-custom-nodes: direct link, hf CLI and curl.
- Browser
- Download file 965 Bytes
-
https://huggingface.co/MarkLilly/mis-custom-nodes/resolve/main/comfyui-custom-scripts/web/js/stringFunction.js
- Command line
-
hf download hf://MarkLilly/mis-custom-nodes/comfyui-custom-scripts/web/js/stringFunction.js
-
curl -L -o stringFunction.js https://huggingface.co/MarkLilly/mis-custom-nodes/resolve/main/comfyui-custom-scripts/web/js/stringFunction.js
965 Bytes
| import { app } from "../../../scripts/app.js"; | |
| import { ComfyWidgets } from "../../../scripts/widgets.js"; | |
| // Displays input text on a node | |
| app.registerExtension({ | |
| name: "pysssss.StringFunction", | |
| async beforeRegisterNodeDef(nodeType, nodeData, app) { | |
| if (nodeData.name === "StringFunction|pysssss") { | |
| const onExecuted = nodeType.prototype.onExecuted; | |
| nodeType.prototype.onExecuted = function (message) { | |
| onExecuted?.apply(this, arguments); | |
| if (this.widgets) { | |
| const pos = this.widgets.findIndex((w) => w.name === "result"); | |
| if (pos !== -1) { | |
| for (let i = pos; i < this.widgets.length; i++) { | |
| this.widgets[i].onRemove?.(); | |
| } | |
| this.widgets.length = pos; | |
| } | |
| } | |
| const w = ComfyWidgets["STRING"](this, "result", ["STRING", { multiline: true }], app).widget; | |
| w.inputEl.readOnly = true; | |
| w.inputEl.style.opacity = 0.6; | |
| w.value = message.text; | |
| this.onResize?.(this.size); | |
| }; | |
| } | |
| }, | |
| }); | |