Skip to content

Commit edb4ca7

Browse files
authored
Highlight current image in the history container (#1121)
1 parent 3c91555 commit edb4ca7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/wwwroot/js/genpage/gentab/currentimagehandler.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,21 @@ function setCurrentImage(src, metadata = '', batchId = '', previewGrow = false,
974974
}
975975
}
976976
}
977+
let historyContainer = document.getElementById('imagehistorybrowser-content');
978+
if (historyContainer) {
979+
let normalizedSrc = getImageFullSrc(src);
980+
for (let i of historyContainer.getElementsByClassName('image-block')) {
981+
// History browser images may have data-src (if clicked) or just data-name (if not clicked yet)
982+
let historyImgSrc = i.dataset.src || i.dataset.name;
983+
let normalizedHistorySrc = historyImgSrc ? getImageFullSrc(historyImgSrc) : null;
984+
if (normalizedHistorySrc && normalizedSrc == normalizedHistorySrc) {
985+
i.classList.add('image-block-current');
986+
}
987+
else {
988+
i.classList.remove('image-block-current');
989+
}
990+
}
991+
}
977992
}
978993

979994
/** Gets the container div element for a generated image to put into, in the batch output view. If Separate Batches is enabled, will use or create a per-batch container. */

0 commit comments

Comments
 (0)