This commit is contained in:
justumen
2024-12-17 14:38:57 +01:00
parent eabe9f2e10
commit 50ee5779c0
1695 changed files with 20285 additions and 18 deletions

29
web/js/API_civitai.js Normal file
View File

@@ -0,0 +1,29 @@
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;
};
});
}
}
});