mirror of
https://github.com/justUmen/Bjornulf_custom_nodes.git
synced 2026-03-21 20:52:11 -03:00
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
import { app } from "../../../scripts/app.js";
|
|
|
|
app.registerExtension({
|
|
name: "Bjornulf.CivitAIModelSelector",
|
|
async nodeCreated(node) {
|
|
if (node.comfyClass === "Bjornulf_CivitAIModelSelector") {
|
|
// Find all upload widgets
|
|
const uploadWidgets = node.widgets.filter(w => w.type === "file");
|
|
|
|
uploadWidgets.forEach(widget => {
|
|
// Store the original draw function
|
|
const originalDraw = widget.draw;
|
|
|
|
// Override the draw function
|
|
widget.draw = function(ctx, node, width, pos, height) {
|
|
const result = originalDraw.call(this, ctx, node, width, pos, height);
|
|
|
|
// Hide all file inputs for this widget
|
|
const fileInputs = document.querySelectorAll(`input[type="file"][data-widget="${this.name}"]`);
|
|
fileInputs.forEach(input => {
|
|
input.style.display = 'none';
|
|
});
|
|
|
|
return result;
|
|
};
|
|
});
|
|
}
|
|
}
|
|
}); |