-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (28 loc) · 954 Bytes
/
index.js
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
fetch('status.md')
.then(response => response.text())
.then(text => {
const statuses = text.split('\n\n');
const displayStatuses = statuses.slice(0, 5);
let statusHTML = "";
for (let status of displayStatuses) {
const [date, ...content] = status.split(": ");
const htmlContent = marked.parse(content.join(": "));
statusHTML += `
<div class="status">
<div class="status-item status-avatar">
<img src="img/avatar.jpg" alt="profile picture">
</div>
<div class="status-item status-name">
<span><strong>Ben Whitfield-Heap</strong></span> | <span>${date}</span>
</div>
<div class="status-item status-content">
${htmlContent}
</div>
</div>
`;
}
document.getElementById('status-list').innerHTML = statusHTML;
})
.catch(error => {
console.error('Error fetching status:', error);
});