mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-16 00:04:35 +08:00
Some js optimization
This commit is contained in:
parent
8c5d9ae4ad
commit
0298e965d2
@ -45,6 +45,7 @@ loadScript('/kjweb_async/purify.min.js').catch((e) => {
|
|||||||
console.log(e)
|
console.log(e)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const categories = ["KJNodes", "SUPIR", "VoiceCraft", "Marigold"];
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "KJNodes.HelpPopup",
|
name: "KJNodes.HelpPopup",
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData) {
|
async beforeRegisterNodeDef(nodeType, nodeData) {
|
||||||
@ -52,13 +53,12 @@ app.registerExtension({
|
|||||||
if (app.ui.settings.getSettingValue("KJNodes.helpPopup") === false) {
|
if (app.ui.settings.getSettingValue("KJNodes.helpPopup") === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const categories = ["KJNodes", "SUPIR", "VoiceCraft", "Marigold"];
|
|
||||||
try {
|
try {
|
||||||
categories.forEach(category => {
|
categories.forEach(category => {
|
||||||
if (nodeData?.category?.startsWith(category)) {
|
if (nodeData?.category?.startsWith(category)) {
|
||||||
addDocumentation(nodeData, nodeType);
|
addDocumentation(nodeData, nodeType);
|
||||||
}
|
}
|
||||||
|
else return
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error in registering KJNodes.HelpPopup", error);
|
console.error("Error in registering KJNodes.HelpPopup", error);
|
||||||
|
|||||||
@ -3,6 +3,9 @@ import { app } from "../../../scripts/app.js";
|
|||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "KJNodes.jsnodes",
|
name: "KJNodes.jsnodes",
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||||
|
if(!nodeData?.category?.startsWith("KJNodes")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch (nodeData.name) {
|
switch (nodeData.name) {
|
||||||
case "ConditioningMultiCombine":
|
case "ConditioningMultiCombine":
|
||||||
nodeType.prototype.onNodeCreated = function () {
|
nodeType.prototype.onNodeCreated = function () {
|
||||||
|
|||||||
@ -101,7 +101,7 @@ app.registerExtension({
|
|||||||
name: 'KJNodes.SplineEditor',
|
name: 'KJNodes.SplineEditor',
|
||||||
|
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData) {
|
async beforeRegisterNodeDef(nodeType, nodeData) {
|
||||||
if (nodeData?.name == 'SplineEditor') {
|
if (nodeData?.name === 'SplineEditor') {
|
||||||
chainCallback(nodeType.prototype, "onNodeCreated", function () {
|
chainCallback(nodeType.prototype, "onNodeCreated", function () {
|
||||||
hideWidgetForGood(this, this.widgets.find(w => w.name === "coordinates"))
|
hideWidgetForGood(this, this.widgets.find(w => w.name === "coordinates"))
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ app.registerExtension({
|
|||||||
createSplineEditor(this, true)
|
createSplineEditor(this, true)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.setSize([550, 850])
|
this.setSize([550, 840])
|
||||||
this.splineEditor.parentEl = document.createElement("div");
|
this.splineEditor.parentEl = document.createElement("div");
|
||||||
this.splineEditor.parentEl.className = "spline-editor";
|
this.splineEditor.parentEl.className = "spline-editor";
|
||||||
this.splineEditor.parentEl.id = `spline-editor-${this.uuid}`
|
this.splineEditor.parentEl.id = `spline-editor-${this.uuid}`
|
||||||
@ -138,12 +138,11 @@ app.registerExtension({
|
|||||||
})
|
})
|
||||||
chainCallback(this, "onGraphConfigured", function() {
|
chainCallback(this, "onGraphConfigured", function() {
|
||||||
createSplineEditor(this)
|
createSplineEditor(this)
|
||||||
this.setSize([550, 800])
|
this.setSize([550, 840])
|
||||||
});
|
});
|
||||||
|
|
||||||
}); // onAfterGraphConfigured
|
}); // onAfterGraphConfigured
|
||||||
}//node created
|
}//node created
|
||||||
|
|
||||||
} //before register
|
} //before register
|
||||||
})//register
|
})//register
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user