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.link) {
+ const a = document.createElement('a');
+ a.href = image.link;
+ a.appendChild(img);
+ figure.appendChild(a);
+ } else {
+ figure.appendChild(img);
+ }
+
+ if (image.censored) {
+ img.style.display = "none";
+ }
- const reuse_button = document.createElement('button');
- reuse_button.appendChild(document.createTextNode("Reuse"));
- figcaption.appendChild(reuse_button);
+ if (image.prompt && image.code) {
+ const figcaption = document.createElement('figcaption');
+ const caption_text = document.createTextNode(`${image.prompt} (${image.code}) `);
+ figcaption.appendChild(caption_text);
- reuse_button.addEventListener('click', () => {
- prompt.value = image.prompt;
- window.scrollTo(0,0);
- });
+ const reuse_button = document.createElement('button');
+ reuse_button.appendChild(document.createTextNode("Reuse"));
+ figcaption.appendChild(reuse_button);
- figure.appendChild(figcaption);
+ reuse_button.addEventListener('click', () => {
+ prompt.value = image.prompt;
+ window.scrollTo(0,0);
+ });
+
+ if (image.censored) {
+ figcaption.style.display = "none";
+ }
+
+ figure.appendChild(figcaption);
+ }
const dl_comments = document.createElement('dl');
dl_comments.className = "comments";