Add js/sharp_tooltips.js

This commit is contained in:
2026-01-18 14:33:20 +01:00
parent 90a0eb84b1
commit 6d6859b844

30
js/sharp_tooltips.js Normal file
View File

@@ -0,0 +1,30 @@
import { app } from "../../scripts/app.js";
app.registerExtension({
name: "SharpFrames.Tooltips",
async beforeRegisterNodeDef(nodeType, nodeData, app) {
if (nodeData.name === "SharpFrameSelector") {
// Define your tooltips here
const tooltips = {
"selection_method": "Strategy:\n'batched' = 1 best frame per time slot (Good for video).\n'best_n' = Top N sharpest frames globally.",
"batch_size": "For 'batched' mode only.\nHow many frames to analyze at once.\nExample: 24fps video + batch 24 = 1 output frame per second.",
"num_frames": "For 'best_n' mode only.\nTotal number of frames you want to keep."
};
// Hook into the node creation to apply them
const onNodeCreated = nodeType.prototype.onNodeCreated;
nodeType.prototype.onNodeCreated = function () {
onNodeCreated?.apply(this, arguments);
if (this.widgets) {
for (const w of this.widgets) {
if (tooltips[w.name]) {
w.tooltip = tooltips[w.name];
}
}
}
};
}
},
});