Skip to content

Commit ea7932c

Browse files
committed
fix: Display shorts images normally.
1 parent d4baa19 commit ea7932c

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

.changeset/short-vans-hug.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"xlog": patch
3+
---
4+
5+
Display shorts images normally.

src/pages/PostDetails/javascript-content.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,15 @@ export const javaScriptContentLoaded = (
6161
6262
function handleImageClick(event) {
6363
event.preventDefault();
64-
const clickedImageUrl = event.target.dataset.src;
65-
const images = document.getElementsByTagName('img');
66-
const allImageUrls = Array.from(images).map(img => img.dataset.src);
64+
const isAvatar = img => img.width === 32 && img.height === 32;
65+
66+
if (isAvatar(event.target)) {
67+
return false;
68+
}
69+
70+
const clickedImageUrl = event.target.src || event.target.dataset.src;
71+
const images = Array.from(document.getElementsByTagName('img')).filter(img => !isAvatar(img));
72+
const allImageUrls = Array.from(images).map(img => img.src || img.dataset.src);
6773
const imageUrlSet = new Set([clickedImageUrl, ...allImageUrls]);
6874
const imageUrlArray = Array.from(imageUrlSet);
6975

0 commit comments

Comments
 (0)