From b4f7d00ad9d13f96323366ded2eb7702e37f6e52 Mon Sep 17 00:00:00 2001
From: FChannel <>
Date: Sat, 19 Jun 2021 19:04:43 -0700
Subject: admin can mark objects as senstive

---
 static/ncatalog.html | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

(limited to 'static/ncatalog.html')

diff --git a/static/ncatalog.html b/static/ncatalog.html
index 027a938..deb8e27 100644
--- a/static/ncatalog.html
+++ b/static/ncatalog.html
@@ -33,15 +33,31 @@
     {{ 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 }}        
-    <a id="{{ .Id }}-anchor" href="/{{ $board.Name }}/">
+
+      {{ if and .Sensitive $board.Actor.Restricted }}
+      <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: 180px; max-height: 180px;" src="/static/sensitive.png"><div style="width: 170px; position: absolute; margin-top: 75px; padding: 5px; background-color: black; color: white; cursor: default; ">NSFW Content</div></div></div>
+      {{ end }}
+    <a id="{{ .Id }}-anchor" href="/{{ $board.Name }}/">      
       <div id="media-{{ .Id }}" style="width:180px;"></div>
     </a>
       <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 = "max-width: 180px; max-height: 180px; cursor: move;"
+            img.style = "max-width: 180px; max-height: 180px;"
             img.setAttribute("id", "img")
             img.setAttribute("main", "1")
             img.setAttribute("src", "{{ (index .Attachment 0).Href }}")
-- 
cgit v1.2.3