aboutsummaryrefslogtreecommitdiff
path: root/static/posts.html
diff options
context:
space:
mode:
authorFChannel <>2021-06-19 18:26:14 -0700
committerFChannel <>2021-06-19 18:26:14 -0700
commit6b265b0a8c2e45422f4a4601e041d44e5cef1c1b (patch)
tree7480eb20d741caa0c0e0b9ae03dee8bfaa739c16 /static/posts.html
parenta257a631ad6c9d6bcb3ae91057ca74a5e1d9515c (diff)
added sensitive content checkbox for upload
Diffstat (limited to 'static/posts.html')
-rw-r--r--static/posts.html41
1 files changed, 34 insertions, 7 deletions
diff --git a/static/posts.html b/static/posts.html
index bfcc84b..a6cac44 100644
--- a/static/posts.html
+++ b/static/posts.html
@@ -14,14 +14,27 @@
{{ if .Attachment }}
{{ if eq $board.ModCred $board.Domain $board.Actor.Id }}
<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="{{ (index .Attachment 0).Href}}">{{ (index .Attachment 0).Name }}</a><span id="{{ .Id }}-size">({{ (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 style="float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px;" src="/static/sensitive.png"><div 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 }}"></div>
<script>
media = document.getElementById("media-{{ .Id }}")
+
+ if({{ .Sensitive }} && {{ $board.Actor.Restricted }}){
+ 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(getMIMEType({{ (index .Attachment 0).MediaType }}) == "image"){
var img = document.createElement("img");
- img.style = "float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px; cursor: pointer;"
+ img.style = "float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px;"
img.setAttribute("id", "img")
img.setAttribute("main", "1")
img.setAttribute("enlarge", "0")
@@ -80,21 +93,35 @@
{{ if .Attachment }}
{{ if eq $board.ModCred $board.Domain $board.Actor.Id }}
<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="{{ (index .Attachment 0).Href}}">{{ (index .Attachment 0).Name }}</a> <span id="{{ .Id }}-size">({{ (index .Attachment 0).Size }})</span></span>
- <div id="media-{{ .Id }}"></div>
+ <div id="hide-{{ .Id }}" style="display: none;">[Hide]</div>
+ <div id="sensitive-{{ .Id }}" style="display: none;"><div style="position: relative; text-align: center;"><img style="float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px;" src="/static/sensitive.png"><div 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 }}" sensitive="0"></div>
<script>
media = document.getElementById("media-{{ .Id }}")
+
+ if({{ .Sensitive }} && {{ $board.Actor.Restricted }}){
+ 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(getMIMEType({{ (index .Attachment 0).MediaType }}) == "image"){
var img = document.createElement("img");
- img.style = "float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px; cursor: pointer;"
+ img.style = "float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px;"
img.setAttribute("id", "img")
img.setAttribute("main", "1")
img.setAttribute("enlarge", "0")
img.setAttribute("attachment", "{{ (index .Attachment 0).Href }}")
- {{ if .Preview.Href }}
+ img.setAttribute("post", "{{ .Id }}")
+ {{ if and .Preview.Href . }}
img.setAttribute("src", "{{ .Preview.Href }}")
- img.setAttribute("preview", "{{ .Preview.Href }}")
+ img.setAttribute("preview", "{{ .Preview.Href }}")
{{ else }}
img.setAttribute("src", "{{ (index .Attachment 0).Href }}")
img.setAttribute("preview", "{{ (index .Attachment 0).Href }}")
@@ -107,7 +134,7 @@
audio.controls = 'controls'
audio.preload = 'metadata'
audio.src = '{{ (index .Attachment 0).Href }}'
- audio.type = '{{ (index .Attachment 0).MediaType }}'
+ audio.type = '{{ (index .Attachment 0).MediaType }}'
audio.style = "float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px;"
audio.innerText = 'Audio is not supported.'
media.appendChild(audio)
@@ -119,7 +146,7 @@
video.preload = 'metadata'
video.muted = 'muted'
video.src = '{{ (index .Attachment 0).Href }}'
- video.type = '{{ (index .Attachment 0).MediaType }}'
+ video.type = '{{ (index .Attachment 0).MediaType }}'
video.style = "float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px;"
video.innerText = 'Video is not supported.'
media.appendChild(video)