diff --git a/assets/js/insights.js b/assets/js/insights.js index 958c439..a5fbc0a 100644 --- a/assets/js/insights.js +++ b/assets/js/insights.js @@ -146,6 +146,7 @@ fetch( ) .then((response) => response.json()) .then((data) => { + console.log(data) const container = document.getElementById("fact-check-list"); data.articles.forEach((article) => { const listItem = document.createElement("li"); diff --git a/assets/js/load.js b/assets/js/load.js index 3de073c..3332633 100644 --- a/assets/js/load.js +++ b/assets/js/load.js @@ -92,19 +92,7 @@ fetch("https://vartapratikriya-api.vercel.app/articles/top_keywords", { fetch("https://vartapratikriya-api.vercel.app/config") .then((response) => response.json()) .then((data) => { - const outlets = Object.keys(data.outlets); - document.querySelectorAll(".channel h3").forEach((h3, index) => { - h3.textContent = outlets[index] || h3.textContent; - }); - }) - .catch((error) => { - console.error("Error:", error); - }); - -fetch("https://vartapratikriya-api.vercel.app/config") - .then((response) => response.json()) - .then((data) => { - const languages = Object.values(data.outlets); + const languages = Object.keys(data.outlets); const languageTitleContainer = document.getElementById("language_title"); if (languageTitleContainer) { @@ -130,3 +118,33 @@ fetch("https://vartapratikriya-api.vercel.app/config") .catch((error) => { console.error("Error:", error); }); + +fetch("https://vartapratikriya-api.vercel.app/config") + .then((response) => response.json()) + .then((data) => { + const channels = Object.values(data.outlets); + const channelTitleContainer = document.getElementById("channel_title"); + + if (channelTitleContainer) { + channels.forEach((channel) => { + const channelBlock = document.createElement("div"); + channelBlock.classList.add( + "d-flex", + "align-items-stretch", + "p-2", + "language-block" + ); + channelBlock.innerHTML = ` +