-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.hbs
45 lines (37 loc) · 1.31 KB
/
index.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{{!< default}}
<div class="gh-page">
<div class="gh-container">
<div class="gh-postfeed">
{{#foreach posts}}
{{> "card" page=../pagination.page }} {{!-- partials/card.hbs --}}
{{/foreach}}
</div>
{{!-- If JS isn't enabled, fallback to standard pagination --}}
<noscript>
<div class="gh-pagination">
{{pagination}}
</div>
</noscript>
</div>
</div>
{{!-- support gif feature images --}}
<script>
document.addEventListener('DOMContentLoaded', () => {
// Select all cards and process each one independently
const cards = document.querySelectorAll('.gh-card');
cards.forEach(card => {
const tags = [...card.querySelectorAll('.post-tags li')];
const gifTag = tags.find(tag => tag.textContent.startsWith('gif-url:'));
if (gifTag) {
const gifUrl = gifTag.textContent.replace('gif-url:', '').trim();
const gifImage = document.createElement('img');
gifImage.src = gifUrl;
gifImage.alt = 'Post GIF';
gifImage.className = 'gh-card-image';
const imageWrapper = card.querySelector('.gh-card-image-wrapper');
imageWrapper.innerHTML = ''; // Clear existing content
imageWrapper.appendChild(gifImage);
}
});
});
</script>