Skip to content

Commit

Permalink
added in text
Browse files Browse the repository at this point in the history
  • Loading branch information
jessewoo committed Sep 25, 2024
1 parent 7e6af8a commit 17ab68c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 6 additions & 0 deletions core/components/com_forum/site/assets/css/like.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
margin-top: 5px;
}

.comment-body .likesStat:hover {
cursor: pointer;
color: black;
text-decoration: underline;
}

.elementInline {
display: inline-flex;
float: right;
Expand Down
11 changes: 4 additions & 7 deletions core/components/com_forum/site/assets/js/like.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
window.addEventListener('DOMContentLoaded', (domEvent) => {
// Find all the "like" button
const commentSections = document.querySelectorAll('.comment-body')
// Find all the "like" / stat button
const commentSections = document.querySelectorAll('.comment-content')
if (commentSections.length) {
for(let i = 0; i < commentSections.length;i++) {
let likeButton = commentSections[i].querySelector('.like');
let likeStatsLink = commentSections[i].querySelector('.likesStat');
let whoLikedPostDiv = commentSections[i].querySelector('.whoLikedPost');

console.log(whoLikedPostDiv.scrollHeight);

likeStatsLink.onclick = (e) => {
this.__toggle = !this.__toggle;
console.log(this.__toggle)
if(this.__toggle) {
whoLikedPostDiv.style.height = `${whoLikedPostDiv.scrollHeight}px`;
} else {
Expand Down Expand Up @@ -59,7 +56,7 @@ window.addEventListener('DOMContentLoaded', (domEvent) => {
whoLikedArray.push(`<a href=${userProfileUrl} target='_blank'>${userName}</a>`);
}

whoLikedPostDiv.innerHTML = "<div class='names'>" + whoLikedArray.join(', ') + "</div>";
whoLikedPostDiv.innerHTML = "<div class='names'>" + whoLikedArray.join(', ') + " liked this</div>";

console.warn(`Like removed for forum thread '${threadId}' of post '${postId}' for user ${userId}`);
}
Expand All @@ -86,7 +83,7 @@ window.addEventListener('DOMContentLoaded', (domEvent) => {
whoLikedArray.push(`<a href=${userProfileUrl} target='_blank'>${userName}</a>`);
}

whoLikedPostDiv.innerHTML = "<div class='names'>" + whoLikedArray.join(', ') + "</div>";
whoLikedPostDiv.innerHTML = "<div class='names'>" + whoLikedArray.join(', ') + " liked this</div>";

console.log(`Like recorded for forum thread '${threadId}' of post '${postId}' for user ${userId}`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@

$links[] = "<a href=$userProfileUrl target='_blank'>$userName</a>";
}
echo join(", ", $links);
echo join(", ", $links) . " liked this";
?>
</div>
</div>
Expand Down

0 comments on commit 17ab68c

Please sign in to comment.