aboutsummaryrefslogtreecommitdiff
path: root/views/partials
diff options
context:
space:
mode:
Diffstat (limited to 'views/partials')
-rw-r--r--views/partials/bottom.html48
-rw-r--r--views/partials/footer.html13
-rw-r--r--views/partials/posts.html122
-rw-r--r--views/partials/postscripts.html3
-rw-r--r--views/partials/top.html128
5 files changed, 314 insertions, 0 deletions
diff --git a/views/partials/bottom.html b/views/partials/bottom.html
new file mode 100644
index 0000000..35e8c4a
--- /dev/null
+++ b/views/partials/bottom.html
@@ -0,0 +1,48 @@
+<div id="reply-box" class="popup-box" style="display: none;">
+ <div id="reply-header">
+ <span id="reply-header-text">...</span>
+ <div id="reply-close" style="display: inline-block; float: right;"><a href="javascript:closeReply()">[X]</a></div>
+ </div>
+ <form onsubmit="sessionStorage.setItem('element-closed-reply', true)" id="reply-post" action="/post" method="post" enctype="multipart/form-data">
+ <input id="reply-name" name="name" type="text" placeholder="Name" maxlength="100">
+ <input id="reply-options" name="options" type="text" placeholder="Options" maxlength="100">
+ <textarea id="reply-comment" name="comment" maxlength="2000" oninput="sessionStorage.setItem('element-reply-comment', document.getElementById('reply-comment').value)"></textarea>
+ <input id="reply-file" name="file" type="file">
+ <input id="reply-submit" type="submit" value="Reply" style="float: right;">
+ <input type="hidden" id="inReplyTo-box" name="inReplyTo" value="{{ .Board.InReplyTo }}">
+ <input type="hidden" id="sendTo" name="sendTo" value="{{ .Board.To }}">
+ <input type="hidden" id="boardName" name="boardName" value="{{ .Board.Name }}">
+ <input type="hidden" id="captchaCode" name="captchaCode" value="{{ .Board.CaptchaCode }}">
+ <input type="hidden" id="returnTo" name="returnTo" value="{{ .ReturnTo }}"><br>
+ <input type="checkbox" name="sensitive"><span>Mark attachment as sensitive</span><br>
+ <div style="width: 202px; margin: 0 auto; padding-top: 12px;">
+ <label for="captcha">Captcha:</label><br>
+ <input style="display: inline-block;" type="text" id="captcha" name="captcha" autocomplete="off"><br>
+ </div>
+ <div style="width: 230px; margin: 0 auto;">
+ <img src="{{ .Board.Captcha }}">
+ </div>
+ </form>
+</div>
+
+<div id="report-box" class="popup-box" style="display: none;">
+ <div id="report-header" style="text-align: center; display: inline-block; z-index: 0; cursor: move;"></div><div id="report-close" style="display: inline-block; float: right;"><a href="javascript:closeReport()">[X]</a></div>
+ <form onsubmit="sessionStorage.setItem('element-closed-report', true)" id="report-post" action="/report" method="post">
+ <label for="comment">Reason:</label><br>
+ <textarea id="report-comment" name="comment" rows="12" cols="54" style="width: 396px;" maxlength="100" oninput="sessionStorage.setItem('element-report-comment', document.getElementById('report-comment').value)"></textarea>
+ <br>
+ <input id="report-submit" type="submit" value="Report" style="float: right;">
+ <input type="hidden" id="report-inReplyTo-box" name="id" value="{{ .Board.InReplyTo }}">
+ <input type="hidden" id="sendTo" name="sendTo" value="{{ .Board.To }}">
+ <input type="hidden" id="boardName" name="board" value="{{ .Board.Name }}">
+ <input type="hidden" name="close" value="0">
+ <input type="hidden" id="captchaCode" name="captchaCode" value="{{ .Board.CaptchaCode }}">
+ <div style="width: 202px; margin: 0 auto; padding-top: 12px;">
+ <label for="captcha">Captcha:</label><br>
+ <input style="display: inline-block;" type="text" id="captcha" name="captcha" autocomplete="off"><br>
+ </div>
+ <div style="width: 230px; margin: 0 auto;">
+ <img src="{{ .Board.Captcha }}">
+ </div>
+ </form>
+</div>
diff --git a/views/partials/footer.html b/views/partials/footer.html
new file mode 100644
index 0000000..efbde4f
--- /dev/null
+++ b/views/partials/footer.html
@@ -0,0 +1,13 @@
+<div align="center" style="width: 500px; margin:0 auto; margin-top: 50px;">
+ [<a href="/">Home</a>] [<a href="/static/rules.html">Rules</a>] [<a href="/static/faq.html">FAQ</a>]
+ <p>All trademarks and copyrights on this page are owned by their respective parties.</p>
+</div>
+
+<div style="float: right; margin-bottom: 25px;">
+ Theme:
+ <select id="themeSwitcher" onchange="setTheme(this.options[this.selectedIndex].value)">
+ {{ range .Themes }}
+ <option value="{{.}}">{{.}}</option>
+ {{ end }}
+ </select>
+</div>
diff --git a/views/partials/posts.html b/views/partials/posts.html
new file mode 100644
index 0000000..f82d2d5
--- /dev/null
+++ b/views/partials/posts.html
@@ -0,0 +1,122 @@
+{{ $board := .Board }}
+{{ $len := len .Posts }}
+{{ range .Posts }}
+{{ $thread := . }}
+{{ $opId := .Id }}
+{{ if eq $board.InReplyTo "" }}
+<hr>
+{{ end }}
+<div style="overflow: auto;">
+ <div id="{{ short $board.Actor.Outbox .Id }}" style="overflow: visible; margin-bottom: 12px;">
+ {{ if eq $board.ModCred $board.Domain $board.Actor.Id }}
+ [<a href="/delete?id={{ .Id }}&board={{ $board.Actor.Name }}">Delete Post</a>]
+ {{ end }}
+ {{ if .Attachment }}
+ {{ if eq $board.ModCred $board.Domain $board.Actor.Id }}
+ [<a href="/banmedia?id={{ .Id }}&board={{ $board.Actor.Name }}">Ban Media</a>]
+ [<a href="/deleteattach?id={{ .Id }}&board={{ $board.Actor.Name }}">Delete Attachment</a>]
+ [<a href="/marksensitive?id={{ .Id }}&board={{ $board.Actor.Name }}">Mark Sensitive</a>]
+ {{ end }}
+ <span style="display: block;">File: <a id="{{ .Id }}-img" href="{{ proxy (index .Attachment 0).Href}}">{{ shortImg (index .Attachment 0).Name }}</a><span id="{{ .Id }}-size"> ({{ convertSize (index .Attachment 0).Size }})</span></span>
+ <div id="hide-{{ .Id }}" style="display: none;">[Hide]</div>
+ <div id="sensitive-{{ .Id }}" style="display: none;"><div style="position: relative; text-align: center;"><img id="sensitive-img-{{ .Id }}" style="float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px;" src="/static/sensitive.png"><div id="sensitive-text-{{ .Id }}" style="width: 240px; position: absolute; margin-top: 110px; padding: 5px; background-color: black; color: white; cursor: default; ">NSFW Content</div></div></div>
+ <div id="media-{{ .Id }}">{{ parseAttachment . false }}</div>
+ <script>
+ media = document.getElementById("media-{{ .Id }}")
+ if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || ({{ isOnion .Id }} && !{{ isOnion $board.Domain }})){
+ sensitive = document.getElementById("sensitive-{{ .Id }}")
+ hide = document.getElementById("hide-{{ .Id }}")
+ sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"}
+ hide.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: none;"; document.getElementById("sensitive-{{ .Id }}").style="display: block;"; document.getElementById("hide-{{ .Id }}").style="display: none;"}
+ sensitive.style = "display: block"
+ media.style = "display: none;"
+ }
+
+ if({{ isOnion .Id }} && !{{ isOnion $board.Domain }}) {
+ sensitive = document.getElementById("sensitive-{{ .Id }}")
+ document.getElementById("sensitive-img-{{ .Id }}").src = "/static/onion.png"
+ document.getElementById("sensitive-text-{{ .Id }}").innerText = "Tor Instance"
+ hide = document.getElementById("hide-{{ .Id }}")
+ sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"}
+ hide.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: none;"; document.getElementById("sensitive-{{ .Id }}").style="display: block;"; document.getElementById("hide-{{ .Id }}").style="display: none;"}
+ sensitive.style = "display: block"
+ media.style = "display: none;"
+ }
+ </script>
+ {{ end }}
+ <span class="subject"><b>{{ .Name }}</b></span>
+ <span class="name"><b>{{ if .AttributedTo }} {{.AttributedTo }} {{ else }} Anonymous {{ end }}</b></span>
+ <span class="tripcode"> {{ .TripCode }} </span>
+ <span class="timestamp" data-utc="{{.Published | timeToUnix}}">{{ .Published | timeToReadableLong }} <a id="{{ .Id }}-anchor" href="/{{ $board.Name }}/{{ short $board.Actor.Outbox $opId }}#{{ short $board.Actor.Outbox .Id }}">No.</a> <a id="{{ .Id }}-link" title="{{ .Id }}" {{ if eq .Type "Note" }} href="javascript:quote('{{ $board.Actor.Id }}', '{{ $opId }}', '{{ .Id }}')" {{ end }}>{{ short $board.Actor.Outbox .Id }}</a> {{ if ne .Type "Tombstone" }}[<a href="javascript:report('{{ $board.Actor.Id }}', '{{ .Id }}')">Report</a>]{{ end }}</span>
+ <p id="{{ .Id }}-content" style="white-space: pre-wrap; margin: 10px 30px 10px 30px;">{{ parseContent $board.Actor $opId .Content $thread }}</p>
+ {{ if .Replies }}
+ {{ $replies := .Replies }}
+ {{ if gt $replies.TotalItems 5 }}
+ {{ if gt $len 1 }}
+ <span>{{ $replies.TotalItems }} replies{{ if gt $replies.TotalImgs 0}} and {{ $replies.TotalImgs }} images{{ end }}, Click <a id="view" post="{{.Id}}" href="/{{ $board.Name }}/{{ short $board.Actor.Outbox .Id }}">here</a> to view all.</span>
+ {{ end }}
+ {{ end }}
+ {{ range $replies.OrderedItems }}
+ <div id="{{ short $board.Actor.Outbox .Id }}">
+ <div style="display: inline-block; overflow: auto;">
+ <div style="float: left; display: block; margin-right: 5px;">&gt;&gt;</div>
+ <div class="post" style="overflow: auto; padding: 5px; margin-bottom: 2px;">
+ {{ if eq $board.ModCred $board.Domain $board.Actor.Id }}
+ [<a href="/delete?id={{ .Id }}&board={{ $board.Actor.Name }}">Delete Post</a>]
+ {{ end }}
+ {{ if .Attachment }}
+ {{ if eq $board.ModCred $board.Domain $board.Actor.Id }}
+ [<a href="/banmedia?id={{ .Id }}&board={{ $board.Actor.Name }}">Ban Media</a>]
+ [<a href="/deleteattach?id={{ .Id }}&board={{ $board.Actor.Name }}">Delete Attachment</a>]
+ [<a href="/marksensitive?id={{ .Id }}&board={{ $board.Actor.Name }}">Mark Sensitive</a>]
+ {{ end }}
+ <span style="display: block;">File <a id="{{ .Id }}-img" href="{{ proxy (index .Attachment 0).Href}}">{{ shortImg (index .Attachment 0).Name }}</a> <span id="{{ .Id }}-size">({{ convertSize (index .Attachment 0).Size }})</span></span>
+ <div id="hide-{{ .Id }}" style="display: none;">[Hide]</div>
+ <div id="sensitive-{{ .Id }}" style="display: none;"><div style="position: relative; text-align: center;"><img id="sensitive-img-{{ .Id }}" style="float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px;" src="/static/sensitive.png"><div id="sensitive-text-{{ .Id }}" style="width: 240px; position: absolute; margin-top: 110px; padding: 5px; background-color: black; color: white; cursor: default; ">NSFW Content</div></div></div>
+ <div> </div>
+ <div id="media-{{ .Id }}" sensitive="0">{{ parseAttachment . false }}</div>
+ <script>
+ media = document.getElementById("media-{{ .Id }}")
+
+ if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || {{ isOnion .Id }} && !{{ isOnion $board.Domain }}){
+ sensitive = document.getElementById("sensitive-{{ .Id }}")
+ hide = document.getElementById("hide-{{ .Id }}")
+ sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"}
+ hide.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: none;"; document.getElementById("sensitive-{{ .Id }}").style="display: block;"; document.getElementById("hide-{{ .Id }}").style="display: none;"}
+ sensitive.style = "display: block"
+ media.style = "display: none;"
+ }
+
+ if({{ isOnion .Id }} && !{{ isOnion $board.Domain }}) {
+ sensitive = document.getElementById("sensitive-{{ .Id }}")
+ document.getElementById("sensitive-img-{{ .Id }}").src = "/static/onion.png"
+ document.getElementById("sensitive-text-{{ .Id }}").innerText = "Tor Instance"
+ hide = document.getElementById("hide-{{ .Id }}")
+ sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"}
+ hide.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: none;"; document.getElementById("sensitive-{{ .Id }}").style="display: block;"; document.getElementById("hide-{{ .Id }}").style="display: none;"}
+ sensitive.style = "display: block"
+ media.style = "display: none;"
+ }
+ </script>
+ {{ end }}
+ <span class="subject"><b>{{ .Name }}</b></span>
+ <span class="name"><b>{{ if .AttributedTo }} {{.AttributedTo }} {{ else }} Anonymous {{ end }}</b></span>
+ <span class="tripcode"> {{ .TripCode }} </span>
+ <span class="timestamp" data-utc="{{ .Published | timeToUnix }}">{{ .Published | timeToReadableLong }} <a id="{{ .Id }}-anchor" href="/{{ $board.Name }}/{{ short $board.Actor.Outbox $opId }}#{{ short $board.Actor.Outbox .Id }}">No. </a><a id="{{ .Id }}-link" title="{{ .Id }}" {{ if eq .Type "Note" }} href="javascript:quote('{{ $board.Actor.Id }}', '{{ $opId }}', '{{ .Id }}')" {{ end }}>{{ short $board.Actor.Outbox .Id }}</a> {{ if ne .Type "Tombstone" }}[<a href="javascript:report('{{ $board.Actor.Id }}', '{{ .Id }}')">Report</a>]{{ end }}</span>
+ {{ $parentId := .Id }}
+ {{ if .Replies.OrderedItems }}
+ {{ range .Replies.OrderedItems }}
+
+ <!--TODO: fix parse reply link function with other routes mainly getactor-->
+ <span id="{{$parentId}}-replyto-{{.Id}}"><!-- fix \{\{ parseReplyLink $board.Actor.Id $opId .Id .Content }} --></span>
+ {{ end }}
+ {{ end }}
+ <p id="{{ .Id }}-content" style="white-space: pre-wrap; margin: 10px 30px 10px 30px;">{{ parseContent $board.Actor $opId .Content $thread }}</p>
+ </div>
+ </div>
+ </div>
+ {{ end }}
+ {{ end }}
+ </div>
+</div>
+{{ end }}
diff --git a/views/partials/postscripts.html b/views/partials/postscripts.html
new file mode 100644
index 0000000..f26e354
--- /dev/null
+++ b/views/partials/postscripts.html
@@ -0,0 +1,3 @@
+<script src="/static/js/posts.js"></script>
+<script src="/static/js/footerscript.js"></script>
+<script src="/static/js/timer.js"></script>
diff --git a/views/partials/top.html b/views/partials/top.html
new file mode 100644
index 0000000..7c03c36
--- /dev/null
+++ b/views/partials/top.html
@@ -0,0 +1,128 @@
+<div style="margin: 0 auto; width: 700px;">
+ <h1 style="text-align: center;">/{{ .Board.Name }}/ - {{ .Board.PrefName }}</h1>
+ <p style="text-align: center;">{{ .Board.Summary }}</p>
+ {{ $len := len .Posts }}
+ {{ if eq $len 0 }}
+ {{ if .Board.InReplyTo }}
+ <h3 id="newpostbtn" state="0" style="display: none; margin-bottom:100px;">[<a href="javascript:startNewPost()">Post a Reply</a>]</h3>
+ {{ else }}
+ <h3 id="newpostbtn" state="0" style="display: none; margin-bottom:100px;">[<a href="javascript:startNewPost()">Start a New Thread</a>]</h3>
+ {{ end }} <!-- end if inreplyto-->
+ <div id="newpost">
+ <form onsubmit="sessionStorage.setItem('element-closed-reply', true)" id="new-post" action="/post" method="post" enctype="multipart/form-data">
+ <table id="postForm">
+ <tr>
+ <tr>
+ <td><label for="name">Name:</label></td>
+ <td><input type="text" id="name" name="name" placeholder="Anonymous" maxlength="100">
+ <a id="stopTablePost" onclick="stopNewPost()">[X]</a>
+ </td>
+ </tr>
+ <tr>
+ <td><label for="options">Options:</label></td>
+ <td><input type="text" id="options" name="options" maxlength="100" style="margin-right:10px">{{ if .Board.InReplyTo }}<input type="submit" value="Post">{{ end }}</td>
+ </tr>
+ {{ if eq .Board.InReplyTo "" }}
+ <tr>
+ <td><label for="subject">Subject:</label></td>
+ <td><input type="text" id="subject" name="subject" maxlength="100" style="margin-right:10px"><input type="submit" value="Post"></td>
+ </tr>
+ {{ end }}
+ <tr>
+ <td><label for="comment">Comment:</label></td>
+ <td><textarea rows="10" cols="50" id="comment" name="comment" maxlength="2000"></textarea></td>
+ </tr>
+ <tr>
+ <td><label for="file">Image</label></td>
+ <td><input type="file" id="file" name="file" {{ if gt $len 1 }} required {{ else }} {{ if eq $len 0 }} required {{ end }} {{ end }} >
+ <br><input type="checkbox" name="sensitive">Mark sensitive</input></td>
+ </tr>
+ <tr>
+ <td><label for="captcha">Captcha:</label></td>
+ <td>
+ <div style="height: 65px; display: inline;">
+ <img src="{{ .Board.Captcha }}">
+ </div>
+ <input type="text" id="captcha" name="captcha" autocomplete="off">
+ </td>
+ </tr>
+ </table>
+
+ <input type="hidden" id="inReplyTo" name="inReplyTo" value="{{ .Board.InReplyTo }}">
+ <input type="hidden" id="sendTo" name="sendTo" value="{{ .Board.To }}">
+ <input type="hidden" id="boardName" name="boardName" value="{{ .Board.Name }}">
+ <input type="hidden" id="captchaCode" name="captchaCode" value="{{ .Board.CaptchaCode }}">
+ <input type="hidden" id="returnTo" name="returnTo" value="{{ .ReturnTo }}">
+ </form>
+ </div>
+
+ {{ else }} <!-- special case to distinquish Notes and Archived formatting -->
+
+ {{ if eq (index .Posts 0).Type "Note" }}
+ {{ if .Board.InReplyTo }}
+ <h3 id="newpostbtn" state="0" style="text-align: center; margin-top: 80px; display: none; margin-bottom:100px;">[<a href="javascript:startNewPost()">Post a Reply</a>]</h3>
+ {{ else }}
+ <h3 id="newpostbtn" state="0" style="text-align: center; margin-top: 80px; display: none; margin-bottom:100px;">[<a href="javascript:startNewPost()">Start a New Thread</a>]</h3>
+ {{ end }} <!-- end if inreplyto-->
+ {{ $len := len .Posts }}
+ <div id="newpost">
+ <form onsubmit="sessionStorage.setItem('element-closed-reply', true)" id="new-post" action="/post" method="post" enctype="multipart/form-data">
+ <table id="postForm">
+ <tr>
+ <tr>
+ <td><label for="name">Name:</label></td>
+ <td><input type="text" id="name" name="name" placeholder="Anonymous" maxlength="100">
+ <a id="stopTablePost" onclick="stopNewPost()">[X]</a>
+ </tr>
+ <tr>
+ <td><label for="options">Options:</label></td>
+ <td><input type="text" id="options" name="options" maxlength="100" style="margin-right:10px">{{ if .Board.InReplyTo }}<input type="submit" value="Post">{{ end }}</td>
+ </tr>
+ {{ if eq .Board.InReplyTo "" }}
+ <tr>
+ <td><label for="subject">Subject:</label></td>
+ <td><input type="text" id="subject" name="subject" maxlength="100" style="margin-right:10px"><input type="submit" value="Post"></td>
+ </tr>
+ {{ end }}
+ <tr>
+ <td><label for="comment">Comment:</label></td>
+ <td><textarea rows="10" cols="50" id="comment" name="comment" maxlength="2000"></textarea></td>
+ </tr>
+ <tr>
+ <td><label for="file">Image</label></td>
+ <td><input type="file" id="file" name="file" {{ if gt $len 1 }} required {{ else }} {{ if eq $len 0 }} required {{ end }} {{ end }} >
+ <br><input type="checkbox" name="sensitive">Mark sensitive</input></td>
+ </tr>
+ <tr>
+ <td><label for="captcha">Captcha:</label></td>
+ <td>
+ <div style="height: 65px; display: inline;">
+ <img src="{{ .Board.Captcha }}">
+ </div>
+ <input type="text" id="captcha" name="captcha" autocomplete="off">
+ </td>
+ </tr>
+ </table>
+
+ <input type="hidden" id="inReplyTo" name="inReplyTo" value="{{ .Board.InReplyTo }}">
+ <input type="hidden" id="sendTo" name="sendTo" value="{{ .Board.To }}">
+ <input type="hidden" id="boardName" name="boardName" value="{{ .Board.Name }}">
+ <input type="hidden" id="captchaCode" name="captchaCode" value="{{ .Board.CaptchaCode }}">
+ <input type="hidden" id="returnTo" name="returnTo" value="{{ .ReturnTo }}"> </form>
+ </div>
+
+ </div>
+ {{ else }}
+ <h1 style="text-align: center;">Archived Post</h1>
+ {{ end }}
+ {{ end }} <!-- end of len eq 0-->
+</div>
+<script>
+ newpostbtn = document.getElementById("newpostbtn");
+ newpost = document.getElementById("newpost");
+
+ if(newpostbtn)
+ newpostbtn.style.display = "block";
+ if(newpost)
+ newpost.style.display = "none";
+</script>