Skip to content

Commit ba22ba1

Browse files
committed
Format
1 parent ba0003c commit ba22ba1

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

web/js/imageFeed.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ app.registerExtension({
286286
imageFeed.className = `pysssss-image-feed pysssss-image-feed--${feedLocation.value}`;
287287
updateMenuParent(feedLocation.value);
288288
saveVal("Location", feedLocation.value);
289-
window.dispatchEvent(new Event("resize"));
289+
window.dispatchEvent(new Event("resize"));
290290
},
291291
},
292292
["left", "top", "right", "bottom", "hidden"].map((m) =>
@@ -365,13 +365,12 @@ Recommended: "enabled (max performance)" uness images are erroneously deduplicat
365365
defaultValue: 0,
366366
type: "combo",
367367
options: (value) => {
368-
let dedupeOptions = {"disabled": 0, "enabled (slow)": 1, "enabled (performance)": 0.5, "enabled (max performance)": 0.25};
368+
let dedupeOptions = { disabled: 0, "enabled (slow)": 1, "enabled (performance)": 0.5, "enabled (max performance)": 0.25 };
369369
return Object.entries(dedupeOptions).map(([k, v]) => ({
370-
value: v,
371-
text: k,
372-
selected: k === value,
373-
})
374-
)
370+
value: v,
371+
text: k,
372+
selected: k === value,
373+
}));
375374
},
376375
});
377376

@@ -384,11 +383,11 @@ Recommended: "enabled (max performance)" uness images are erroneously deduplicat
384383
});
385384

386385
const saveNodeOnly = app.ui.settings.addSetting({
387-
id: "pysssss.ImageFeed.SaveNodeOnly",
388-
name: "🐍 Image Feed Display 'SaveImage' Only",
389-
tooltip: `Only show images from 'SaveImage' nodes. This prevents 'PreviewImage' node outputs from appearing in the feed.`,
390-
defaultValue: false,
391-
type: "boolean",
386+
id: "pysssss.ImageFeed.SaveNodeOnly",
387+
name: "🐍 Image Feed Display 'SaveImage' Only",
388+
tooltip: `Only show images from 'SaveImage' nodes. This prevents 'PreviewImage' node outputs from appearing in the feed.`,
389+
defaultValue: false,
390+
type: "boolean",
392391
});
393392

394393
const clearButton = $el("button.pysssss-image-feed-btn.clear-btn", {
@@ -541,12 +540,14 @@ Recommended: "enabled (max performance)" uness images are erroneously deduplicat
541540
const n = app.graph.getNodeById(detail.node.split(":")[0]);
542541
if (n?.getInnerNodes) return;
543542
}
544-
543+
545544
// Apply "Display Save Image Node Only" filter if setting is enabled
546-
const nodeName = detail.node?.split(":")?.[0];
545+
const nodeName = detail.node?.split(":")?.[0];
546+
if (nodeName) {
547547
const node = app.graph.getNodeById(nodeName);
548-
549-
if (saveNodeOnly.value && node?.type !== "SaveImage") return;
548+
549+
if (saveNodeOnly.value && node?.type !== "SaveImage") return;
550+
}
550551

551552
for (const src of detail.output.images) {
552553
const href = `./view?filename=${encodeURIComponent(src.filename)}&type=${src.type}&
@@ -561,11 +562,11 @@ Recommended: "enabled (max performance)" uness images are erroneously deduplicat
561562
// NOOP: image is a duplicate
562563
} else {
563564
seenImages.set(fingerprint, true);
564-
let img = $el("img", { src: href })
565+
let img = $el("img", { src: href });
565566
img.onerror = () => {
566567
// fall back to default behavior
567568
addImageToFeed(href);
568-
}
569+
};
569570
img.onload = () => {
570571
// redraw the image onto a canvas to strip metadata (resize if performance mode)
571572
let imgCanvas = document.createElement("canvas");
@@ -580,7 +581,7 @@ Recommended: "enabled (max performance)" uness images are erroneously deduplicat
580581
// calculate fast hash of the image data
581582
let hash = 0;
582583
for (const b of data.data) {
583-
hash = ((hash << 5) - hash) + b;
584+
hash = (hash << 5) - hash + b;
584585
}
585586

586587
// add image to feed if we've never seen the hash before
@@ -591,7 +592,7 @@ Recommended: "enabled (max performance)" uness images are erroneously deduplicat
591592
seenImages.set(hash, true);
592593
addImageToFeed(href);
593594
}
594-
}
595+
};
595596
}
596597
} else {
597598
addImageToFeed(href);

0 commit comments

Comments
 (0)