Skip to content

Instantly share code, notes, and snippets.

@curiousercreative
Created December 10, 2025 15:17
Show Gist options
  • Select an option

  • Save curiousercreative/cc08b50f9a5063d43d0b058eb5d96751 to your computer and use it in GitHub Desktop.

Select an option

Save curiousercreative/cc08b50f9a5063d43d0b058eb5d96751 to your computer and use it in GitHub Desktop.
For a given Immich (v1.120.1) album with the "activity panel" open, run this in web console to see which photos received likes and comments
(() => {
// cleanup and init
try {
document.querySelector('#virtual-timeline').parentNode.removeChild(document.querySelector('#selects'))
} catch {}
document.querySelector('#virtual-timeline').insertAdjacentHTML('beforebegin', '<div class="flex flex-wrap" id="selects"></div>')
const commentCountMap = new Map()
const commentThumbs = Array.from(document.querySelectorAll('#activity-panel img[alt*=commented]'))
const likeCountMap = new Map()
const likeThumbs = Array.from(document.querySelectorAll('#activity-panel img[alt*=liked]'))
const selects = document.querySelector('#selects')
const srcSet = new Set()
// count comments per img
commentThumbs.forEach(img => {
const count = commentCountMap.get(img.src) || 0
commentCountMap.set(img.src, count + 1)
srcSet.add(img.src)
})
// count likes per img
likeThumbs.forEach(img => {
const count = likeCountMap.get(img.src) || 0
likeCountMap.set(img.src, count + 1)
srcSet.add(img.src)
})
// map each img src to a tuple [ src, commentCount, likeCount ]
Array.from(srcSet)
.map(src => [
src,
commentCountMap.get(src) || 0,
likeCountMap.get(src) || 0,
])
// sort on likes, then comments DESC
.sort((a, b) => {
if (a[2] > b[2]) return -1
else if (a[2] < b[2]) return 1
else {
if (a[1] > b[1]) return -1
else if (a[1] < b[1]) return 1
}
return 0
})
// insert thumb into DOM with counts
.forEach(([ src, comments, likes ]) => {
selects.insertAdjacentHTML('beforeend', `<div style="flex: 0 0 50%;">
<img src="${src}" />
<span>${likes} likes</span>
<span>${comments} comments</span>
</div>`)
})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment