blob: 7b6022705b89f28e7c7000bdbcdb320d23ee4b0a (
plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
---
import type Thread from '../models/Thread';
import Post from './Post.astro';
import Image from './Image.astro';
export interface Props {
thread: Thread;
board: string;
}
const { thread, board } = Astro.props;
let replies: string[] = [];
const listReplies = (id: string, getReplies: boolean = false): any => {
if(getReplies) return replies;
replies = [];
thread.comments.forEach(comment => {
if(comment.content.includes(id))
replies.push(comment.id);
})
if(replies.length <= 0) return false;
return true;
}
---
{(thread.id != "rules") && ( <>
<Post id={thread.id} date={thread.timestamp} box="threadbox" board={(thread.comments == undefined) ? board : ''}>
{thread.comments != undefined && (listReplies(thread.id) && (
<span class="small-mono">
{listReplies(thread.id, true).map((id) => ( <>
<a href=`/board/${board}/${thread.id}#${id}` onmouseover=`onMouseOver('${id}')` onmouseleave=`onMouseLeave('${id}')`>>>{id}</a>
</> ))}
</span> <hr>
))}
<h3>{thread.title}</h3>
<Image image={thread.image} fileType={thread.imagetype} />
<p set:html={thread.content} />
{thread.comments != undefined && ( <>
{thread.comments.map((comment) => ( <>
<Post id={comment.id} date={comment.timestamp} box="commentbox">
{listReplies(comment.id) && (
<span class="small-mono">
{listReplies(comment.id, true).map((id) => ( <>
<a href=`/board/${board}/${thread.id}#${id}` onmouseover=`onMouseOver('${id}')` onmouseleave=`onMouseLeave('${id}')`>>>{id}</a>
</> ))}
</span> <hr>
)}
<Image image={comment.image} fileType={comment.imagetype} />
<p set:html={comment.content} />
</Post>
</> ))}
</> )}
</Post>
</> )}
{thread.comments != undefined && ( <>
<script is:inline>
function onMouseOver(id) {
document.getElementById(id).classList.add('targeted');
}
function onMouseLeave(id) {
document.getElementById(id).classList.remove('targeted');
}
</script>
<style is:inline>
.small-mono {
display:inline-block; line-height: 2ch; font-size: 0.8rem; font-family: monospace;
}
</style>
</> )}
|