This repository has been archived by the owner on Oct 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
/
board.html
152 lines (149 loc) · 4.93 KB
/
board.html
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
{% import "strconv" %}
{% import "github.com/bakape/meguca/config" %}
{% import "github.com/bakape/meguca/common" %}
{% import "github.com/bakape/meguca/lang" %}
{% import "github.com/bakape/meguca/imager/assets" %}
{% func renderBoard(threadHTML []byte, id, title string, conf config.BoardConfContainer, ln lang.Pack) %}{% stripspace %}
{% comment %}
Not implemented yet
<h1 class="image-banner">
<img src="/assets/banners/{%s conf.Banner %}">
</h1>
{% endcomment %}
<h1 id="page-title">
{%s= title %}
</h1>
<span class="aside-container">
<aside id="thread-form-container" class="glass">
<span class="act">
<a class="new-thread-button">
{%s= ln.UI["newThread"] %}
</a>
</span>
<form id="new-thread-form" action="/createThread" class="hidden">
{% if id == "all" %}
<select name="board" required>
{% for _, b := range config.GetBoardTitles() %}
<option value="{%s= b.ID %}">
{%= formatTitle(b.ID, b.Title) %}
</option>
{% endfor %}
</select>
<br>
{% endif %}
<input name="subject" placeholder="{%s= ln.UI["subject"] %}" required type="text" maxlength="100">
<br>
<noscript>
{% for _, s := range specs["noscriptPostCreation"] %}
{%= input(s, ln) %}
<br>
{% endfor %}
</noscript>
{% if id == "all" || !conf.TextOnly %}
<span class="upload-container">
<span data-id="spoiler">
<label>
<input type="checkbox" name="spoiler">
{%s= ln.Common.Posts["spoiler"] %}
</label>
</span>
<strong class="upload-status"></strong>
<br>
<input type="file" name="image" accept="image/png, image/gif, image/jpeg, video/webm, video/ogg, audio/ogg, application/ogg, video/mp4, audio/mp4, audio/mp3, application/zip, application/x-7z-compressed, application/x-xz, application/x-gzip">
<br>
</span>
{% endif %}
{%= captcha("new-thread", ln.UI) %}
<input type="submit" value="{%s= ln.UI["submit"] %}">
<input type="button" name="cancel" value="{%s= ln.UI["cancel"] %}">
</form>
</aside>
<aside id="refresh" class="act glass">
<a>
{%s= ln.Common.UI["refresh"] %}
</a>
</aside>
{%= hoverReveal(conf.Notice, ln.UI["showNotice"]) %}
{%= hoverReveal(conf.Rules, ln.UI["rules"]) %}
<span id="catalog-controls" class="margin-spaced">
<input type="text" name="search" placeholder="{%s= ln.UI["search"] %}" title="{%s= ln.UI["searchTooltip"] %}">
<select name="sortMode">
{% for i, s := range [...]string{"lastReply", "creation", "replyCount", "fileCount"} %}
<option value="{%s= s %}">
{%s= ln.SortModes[i] %}
</option>
{% endfor %}
</select>
</span>
</span>
<noscript>TODO: Noscript thread creation</noscript>
<hr>
<div id="catalog">
{%z= threadHTML %}
<script id="board-configs" type="application/json">
{%z= conf.JSON %}
</script>
</div>
<hr>
{% endstripspace %}{% endfunc %}
CatalogThreads renders thread content for a catalog page. Separate function to
allow caching of generated posts.
{% func CatalogThreads(b common.Board) %}{% stripspace %}
{% for _, t := range b %}
{% code idStr:= strconv.FormatUint(t.ID, 10) %}
{% code postCtr := strconv.FormatUint(uint64(t.PostCtr), 10) %}
{% code imgCtr := strconv.FormatUint(uint64(t.ImageCtr), 10) %}
<article id="p{%s= idStr %}" class="glass" data-replyTime="{%s= strconv.FormatInt(t.ReplyTime, 10) %}" data-time="{%s= strconv.FormatInt(t.Time, 10) %}" data-postCtr="{%s= postCtr %}" data-imageCtr="{%s= imgCtr %}">
{% if t.Image != nil %}
<figure>
{% code img := *t.Image %}
<a class="history" href="/{%s= t.Board %}/{%s= idStr %}">
{% if img.Spoiler %}
<img src="/assets/spoil/default.jpg" width="150" height="150" class="expanded">
{% else %}
<img width="{%s= strconv.FormatUint(uint64(img.Dims[2]), 10) %}" height="{%s= strconv.FormatUint(uint64(img.Dims[3]), 10) %}" class="expanded" src="{%s= assets.ThumbPath(img.FileType, img.ThumbType, img.SHA1) %}">
{% endif %}
</a>
</figure>
{% endif %}
<span class="spaced thread-links">
<b class="board">
/{%s= t.Board %}/
</b>
<span class="counters">
{%s= postCtr %}/{%s= imgCtr %}
</span>
{% if t.Image == nil %}
<span class="act">
<a class="history expand-link" href="/{%s= t.Board %}/{%s= idStr %}">
Expand
</a>
</span>
{% endif %}
<span class="act">
<a class="history lastN-link" href="/{%s= t.Board %}/{%s= idStr %}?last=100">
Last 100
</a>
</span>
</span>
<br>
<h3>
「{%s t.Subject %}」
</h3>
</article>
{% endfor %}
{% endstripspace %}{% endfunc %}
Notice widget, that reveals text on hover
{% func hoverReveal(text, label string) %}{% stripspace %}
{% if text == "" %}
{% return %}
{% endif %}
<aside class="glass hover-reveal">
<span class="act">
{%s= label %}
</span>
<span class="popup-menu glass">
{%s text %}
</span>
</aside>
{% endstripspace %}{% endfunc %}