From 961e60a2afb1e4db2b26c0ab4488e1568ab4f212 Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Wed, 13 Sep 2023 16:50:57 -0400 Subject: [PATCH] Add button for deleting post --- script.js | 16 ++++++++++++++-- style.css | 6 ++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/script.js b/script.js index 09e0115..0e7255a 100644 --- a/script.js +++ b/script.js @@ -611,7 +611,7 @@ function renderPostElem(post) { if (shouldDisplayMarkIllegalButton(post)) { const mark_illegal = span() - mark_illegal.classList.add('post--mark_illegal'); + mark_illegal.classList.add('post--header_action', 'post--mark_illegal'); const mark_illegal_a = document.createElement('a'); mark_illegal_a.appendChild(text('Mark Illegal')); @@ -633,10 +633,22 @@ function renderPostElem(post) { postHeader.appendChild(mark_illegal); } else if (isIllegal(post)) { const mark_illegal = span(text('illegal')) - mark_illegal.classList.add('post--is_illegal'); + mark_illegal.classList.add('post--header_action', 'post--is_illegal'); postHeader.appendChild(mark_illegal); } + // Delete post + const delete_post = span() + delete_post.classList.add('post--header_action', 'post--delete_post'); + const delete_post_a = document.createElement('a'); + delete_post_a.appendChild(text('delete')); + delete_post_a.setAttribute('href', '#' + identifier); + delete_post_a.setAttribute('title', 'Remove post from known spam and related tables. Post content will no longer be matched as illegal. Content can again end up in known spam posts if it keeps getting posted.'); + delete_post.appendChild(text('[')); + delete_post.appendChild(delete_post_a); + delete_post.appendChild(text(']')); + postHeader.appendChild(delete_post); + postContainer.appendChild(postHeader); const postElem = div(); diff --git a/style.css b/style.css index 18cb521..4cb8ad9 100644 --- a/style.css +++ b/style.css @@ -64,14 +64,12 @@ header { flex: 1; } -.post--header span.post--mark_illegal { +span.post--header_action { flex-basis: fit-content; flex-grow: 0; } -.post--header span.post--is_illegal { - flex-basis: fit-content; - flex-grow: 0; +span.post--is_illegal { color: orange; font-weight: bold; font-family: monospace;