Refactor showViewMoreButton to insert button after posts container

This commit is contained in:
2025-10-03 05:31:43 +10:00
parent 5cdb914e76
commit 021c93f5d0

View File

@@ -531,7 +531,6 @@ function hideLoadingIndicator() {
function showViewMoreButton() {
const postsContainer = document.getElementById("posts");
const containerDiv = postsContainer.parentElement; // Get the main container
// Check if button already exists
if (document.getElementById("view-more-button")) {
@@ -549,7 +548,9 @@ function showViewMoreButton() {
<small>Follow @lit.mates.dev for more posts</small>
</div>
`;
containerDiv.appendChild(viewMoreDiv); // Add to main container, not posts container
// Insert after the posts container but before footer
postsContainer.insertAdjacentElement('afterend', viewMoreDiv);
}
async function fetchPosts() {