]> git.cworth.org Git - zombocom-ai/blobdiff - index.html
Hide images with a censored attribute
[zombocom-ai] / index.html
index ea4f0abc41913047ac138c883ee3ed50649040ff..27035a180506b124661ef9efd3992c11b1e6f6b6 100644 (file)
@@ -174,24 +174,30 @@ mute.addEventListener("click", () => {
         const figure = document.createElement('figure');
         figure.id = "image_" + image.id;
 
+        if (image.censored) {
+            figure.style.display = "none";
+        }
+
         const img = document.createElement('img');
         img.src = image.filename;
         figure.appendChild(img);
 
-        const figcaption = document.createElement('figcaption');
-        const caption_text = document.createTextNode(`${image.prompt} (${image.code}) `);
-        figcaption.appendChild(caption_text);
+        if (image.prompt && image.code) {
+            const figcaption = document.createElement('figcaption');
+            const caption_text = document.createTextNode(`${image.prompt} (${image.code}) `);
+            figcaption.appendChild(caption_text);
 
-        const reuse_button = document.createElement('button');
-        reuse_button.appendChild(document.createTextNode("Reuse"));
-        figcaption.appendChild(reuse_button);
+            const reuse_button = document.createElement('button');
+            reuse_button.appendChild(document.createTextNode("Reuse"));
+            figcaption.appendChild(reuse_button);
 
-        reuse_button.addEventListener('click', () => {
-            prompt.value = image.prompt;
-            window.scrollTo(0,0);
-        });
+            reuse_button.addEventListener('click', () => {
+                prompt.value = image.prompt;
+                window.scrollTo(0,0);
+            });
 
-        figure.appendChild(figcaption);
+            figure.appendChild(figcaption);
+        }
 
         const dl_comments = document.createElement('dl');
         dl_comments.className = "comments";