Some js optimization

This commit is contained in:
kijai 2024-04-26 01:38:40 +03:00
parent 8c5d9ae4ad
commit 0298e965d2
3 changed files with 48 additions and 46 deletions

View File

@ -45,6 +45,7 @@ loadScript('/kjweb_async/purify.min.js').catch((e) => {
console.log(e)
})
const categories = ["KJNodes", "SUPIR", "VoiceCraft", "Marigold"];
app.registerExtension({
name: "KJNodes.HelpPopup",
async beforeRegisterNodeDef(nodeType, nodeData) {
@ -52,13 +53,12 @@ app.registerExtension({
if (app.ui.settings.getSettingValue("KJNodes.helpPopup") === false) {
return;
}
const categories = ["KJNodes", "SUPIR", "VoiceCraft", "Marigold"];
try {
categories.forEach(category => {
if (nodeData?.category?.startsWith(category)) {
addDocumentation(nodeData, nodeType);
}
else return
});
} catch (error) {
console.error("Error in registering KJNodes.HelpPopup", error);

View File

@ -3,6 +3,9 @@ import { app } from "../../../scripts/app.js";
app.registerExtension({
name: "KJNodes.jsnodes",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
if(!nodeData?.category?.startsWith("KJNodes")) {
return;
}
switch (nodeData.name) {
case "ConditioningMultiCombine":
nodeType.prototype.onNodeCreated = function () {

View File

@ -101,7 +101,7 @@ app.registerExtension({
name: 'KJNodes.SplineEditor',
async beforeRegisterNodeDef(nodeType, nodeData) {
if (nodeData?.name == 'SplineEditor') {
if (nodeData?.name === 'SplineEditor') {
chainCallback(nodeType.prototype, "onNodeCreated", function () {
hideWidgetForGood(this, this.widgets.find(w => w.name === "coordinates"))
@ -123,7 +123,7 @@ app.registerExtension({
createSplineEditor(this, true)
}
});
this.setSize([550, 850])
this.setSize([550, 840])
this.splineEditor.parentEl = document.createElement("div");
this.splineEditor.parentEl.className = "spline-editor";
this.splineEditor.parentEl.id = `spline-editor-${this.uuid}`
@ -138,12 +138,11 @@ app.registerExtension({
})
chainCallback(this, "onGraphConfigured", function() {
createSplineEditor(this)
this.setSize([550, 800])
this.setSize([550, 840])
});
}); // onAfterGraphConfigured
}//node created
} //before register
})//register