Apex Wealth Network

Recent Articles

    © 2026 Apex Wealth Network. All Rights Reserved.
    `; adContainer.appendChild(iframe); // Sisipkan iklan setelah elemen paragraf tengah blocks[middleIndex].after(adContainer); } targetElement.innerHTML = rootDiv.innerHTML; } // 7. Membuka isi lengkap artikel function readFullArticle(id, shouldPushState = true) { currentArticleIndex = allArticles.findIndex(a => a.id === id); const article = allArticles[currentArticleIndex]; if (!article) return; if (shouldPushState) { window.location.hash = `#article-${id}`; } document.getElementById("article-list-section").style.display = "none"; document.getElementById("single-article-section").style.display = "block"; document.getElementById("single-title").innerText = article.judul; document.getElementById("single-meta").innerText = `${article.tanggal} • ${article.kategori}`; // Render artikel + iklan tengah tanpa merusak HTML renderArticleWithMiddleAd(article.konten, document.getElementById("single-content")); updateArticleNavButtons(); window.scrollTo(0, 0); } // 8. Kembali ke daftar artikel (Home) function backToArticles() { window.location.hash = ""; renderPage(1, false); } // 9. Update tombol Navigasi Next/Prev function updateArticleNavButtons() { const prevBtn = document.getElementById("prev-article-btn"); const nextBtn = document.getElementById("next-article-btn"); if (prevBtn) { if (currentArticleIndex > 0) { prevBtn.style.display = "inline-block"; prevBtn.onclick = () => readFullArticle(allArticles[currentArticleIndex - 1].id); } else { prevBtn.style.display = "none"; } } if (nextBtn) { if (currentArticleIndex < allArticles.length - 1) { nextBtn.style.display = "inline-block"; nextBtn.onclick = () => readFullArticle(allArticles[currentArticleIndex + 1].id); } else { nextBtn.style.display = "none"; } } } // 10. Recent Posts di Sidebar function renderRecentPosts() { const recentContainer = document.getElementById("recent-posts-list"); if (!recentContainer) return; const recentItems = allArticles.slice(0, 5); recentContainer.innerHTML = recentItems.map(item => `
  • ${item.judul}
  • `).join(''); } // 11. Filter Kategori function filterCategory(cat, btnEl) { if (btnEl) { document.querySelectorAll('.nav-cat').forEach(b => b.classList.remove('active')); btnEl.classList.add('active'); } if (cat === 'All') { filteredArticles = allArticles; } else { filteredArticles = allArticles.filter(a => a.kategori.toLowerCase() === cat.toLowerCase()); } changePage(1); } // Event listener perubahan URL hash & Tombol Back/Forward Browser window.addEventListener("hashchange", handleHashChange); window.addEventListener("popstate", handleHashChange);