diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/bottom.html | 3 | ||||
-rw-r--r-- | static/js/footerscript.js | 4 | ||||
-rw-r--r-- | static/posts.html | 41 | ||||
-rw-r--r-- | static/sensitive.png (renamed from static/sensative.png) | bin | 3737 -> 3737 bytes | |||
-rw-r--r-- | static/top.html | 1 |
5 files changed, 41 insertions, 8 deletions
diff --git a/static/bottom.html b/static/bottom.html index 8774419..19c82c6 100644 --- a/static/bottom.html +++ b/static/bottom.html @@ -6,11 +6,12 @@ <input id="reply-options" name="options" size="43" type="text" placeholder="Options" maxlength="100"> <textarea id="reply-comment" name="comment" rows="12" cols="54" style="width: 396px;" maxlength="2000"></textarea> <input id="reply-file" name="file" type="file"> - <input id="reply-submit" type="submit" value="Reply" style="float: right;"> + <input id="reply-submit" type="submit" value="Reply" style="float: right;"><br><br> <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="checkbox" name="sensitive"><span>Mark attachment as sensitive</span><br><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> diff --git a/static/js/footerscript.js b/static/js/footerscript.js index b68c3b4..a63f422 100644 --- a/static/js/footerscript.js +++ b/static/js/footerscript.js @@ -3,6 +3,10 @@ var imgArray = [].slice.call(imgs); imgArray.forEach(function(img, i){ img.addEventListener("click", function(e){ + var id = img.getAttribute("id") + var media = document.getElementById("media-" + id) + var sensitive = document.getElementById("sensitive-" + id) + if(img.getAttribute("enlarge") == "0") { var attachment = img.getAttribute("attachment") 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) diff --git a/static/sensative.png b/static/sensitive.png Binary files differindex ea706c8..ea706c8 100644 --- a/static/sensative.png +++ b/static/sensitive.png diff --git a/static/top.html b/static/top.html index b891e14..e2612e8 100644 --- a/static/top.html +++ b/static/top.html @@ -25,6 +25,7 @@ <input type="hidden" id="boardName" name="boardName" value="{{ .Board.Name }}"> <input type="hidden" id="captchaCode" name="captchaCode" value="{{ .Board.CaptchaCode }}"> <input type="file" id="file" name="file" {{ if gt $len 1 }} required {{ else }} {{ if eq $len 0 }} required {{ end }} {{ end }} ><br><br> + <input type="checkbox" name="sensitive"><span>Mark attachment as sensitive</span><br><br> <label stye="display: inline-block;" for="captcha">Captcha:</label> <br> <input style="display: inline-block;" type="text" id="captcha" name="captcha" autocomplete="off"><br> |