move hide replies to better place and new icon

This commit is contained in:
rimu 2024-01-15 20:46:37 +13:00
parent 22e4caf548
commit 12de59da9b
6 changed files with 51 additions and 31 deletions

View file

@ -249,29 +249,29 @@ function setupPostTypeTabs() {
function setupHideButtons() {
const hideEls = document.querySelectorAll('.hide_button');
hideEls.forEach(hideEl => {
const hideEls2 = document.querySelectorAll('.hide_button a');
hideEls2.forEach(hideEl => {
let isHidden = false;
hideEl.addEventListener('click', event => {
event.preventDefault();
const parentElement = hideEl.parentElement;
const parentElement = hideEl.parentElement.parentElement;
const hidables = parentElement.querySelectorAll('.hidable');
hidables.forEach(hidable => {
hidable.style.display = isHidden ? 'block' : 'none';
});
const moreHidables = parentElement.parentElement.querySelectorAll('.hidable');
const moreHidables = parentElement.parentElement.parentElement.querySelectorAll('.hidable');
moreHidables.forEach(hidable => {
hidable.style.display = isHidden ? 'block' : 'none';
});
// Toggle the content of hideEl
if (isHidden) {
hideEl.innerHTML = "<a href='#'>[-] hide</a>";
hideEl.innerHTML = "<a href='#'><span class='fe fe-collapse'></span></a>";
} else {
hideEl.innerHTML = "<a href='#'>[+] show</a>";
hideEl.innerHTML = "<a href='#'><span class='fe fe-expand'></span></a>";
}
isHidden = !isHidden; // Toggle the state
@ -288,11 +288,11 @@ function setupHideButtons() {
if (commentDiv) {
// Access the inner div with class "hide_button" inside the outer div
const hideButton = commentDiv.getElementsByClassName("hide_button")[0];
const hideButton = commentDiv.querySelectorAll(".hide_button a");
if (hideButton) {
// Programmatically trigger a click event on the "hide_button" div
hideButton.click();
// Programmatically trigger a click event on the "hide_button" anchor
hideButton[0].click();
} else {
console.log(`"hide_button" not found in ${divId}`);
}

View file

@ -230,6 +230,14 @@
content: "\e99a";
}
.fe-collapse::before {
content: "\e995";
}
.fe-expand::before {
content: "\e98e";
}
h1 {
.fe-bell, .fe-no-bell {
font-size: 18px;

View file

@ -258,6 +258,14 @@ nav, etc which are used site-wide */
content: "\e99a";
}
.fe-collapse::before {
content: "\e995";
}
.fe-expand::before {
content: "\e98e";
}
h1 .fe-bell, h1 .fe-no-bell {
font-size: 18px;
top: -5px;
@ -763,14 +771,12 @@ fieldset legend {
border-radius: 50%;
vertical-align: bottom;
}
.comment .hide_button {
float: right;
display: block;
width: 68px;
padding: 5px;
.comment .comment_author .hide_button {
display: inline-block;
}
.comment .hide_button a {
.comment .comment_author .hide_button a {
text-decoration: none;
padding: 5px;
}
.comment .comment_actions {
margin-top: -10px;

View file

@ -425,16 +425,14 @@ nav, etc which are used site-wide */
border-radius: 50%;
vertical-align: bottom;
}
}
.hide_button {
float: right;
display: block;
width: 68px;
padding: 5px;
.hide_button {
display: inline-block;
a {
text-decoration: none;
a {
text-decoration: none;
padding: 5px;
}
}
}

View file

@ -257,6 +257,14 @@
content: "\e99a";
}
.fe-collapse::before {
content: "\e995";
}
.fe-expand::before {
content: "\e98e";
}
h1 .fe-bell, h1 .fe-no-bell {
font-size: 18px;
top: -5px;

View file

@ -64,18 +64,11 @@
<div id="comment_{{ comment['comment'].id }}" class="comment {% if comment['comment'].score <= -10 %}low_score{% endif %}
{% if comment['comment'].author.id == post.author.id %}original_poster{% endif %}">
<div class="limit_height">
<div class="voting_buttons">
<div class="voting_buttons hidable">
{% with comment=comment['comment'] %}
{% include "post/_voting_buttons.html" %}
{% endwith %}
</div>
<div class="hide_button">
{% if comment['comment'].score <= -10 %}
<a href='#'>[+] show</a>
{% else %}
<a href='#'>[-] hide</a>
{% endif %}
</div>
<div class="comment_author">
{% if comment['comment'].author.deleted %}
[deleted]
@ -100,6 +93,13 @@
{% endif %}
{% if comment['comment'].author.id == post.author.id %}<span title="Submitter of original post" aria-label="submitter" class="small">[OP]</span>{% endif %}
<span class="text-muted small">{{ moment(comment['comment'].posted_at).fromNow(refresh=True) }}{% if comment['comment'].edited_at %}, edited {{ moment(comment['comment'].edited_at).fromNow(refresh=True) }} {% endif %}</span>
<div class="hide_button">
{% if comment['comment'].score <= -10 %}
<a href='#'><span class="fe fe-expand"></span></a>
{% else %}
<a href='#'><span class="fe fe-collapse"></span></a>
{% endif %}
</div>
{% if comment['comment'].reports and current_user.is_authenticated and post.community.is_moderator(current_user)%}
<span class="red fe fe-report" title="{{ _('Reported. Check comment for issues.') }}"></span>
{% endif %}