No Articles Found

Try a different search term or select another category.

`; const inFeedAdScript2 = ``; articles.forEach((article, index) => { const title = article.title || "No Title Provided"; const description = (article.description || "No description available.").substring(0, 150); const url = article.url; const imageUrl = article.image || PLACEHOLDER_IMG; articlesHTML += `

${title}

${description}...

Read More
`; // IN-FEED AD PLACEMENT LOGIC // After the 4th article (index 3), insert the first ad. if (index === 3) { articlesHTML += `
${inFeedAdScript1}
`; } // After the 10th article (index 9), insert the second ad. if (index === 9) { articlesHTML += `
${inFeedAdScript2}
`; } }); newsContainer.innerHTML = articlesHTML; }; // --- MODAL LOGIC --- const modalContent = { about: { title: "About Gnews Prime", body: `

Gnews Prime is a modern, responsive news aggregation platform dedicated to bringing you the most relevant and up-to-date stories from around the world. Our mission is to provide a clean, uncluttered, and premium reading experience.

We utilize the powerful GNews API to source articles across various categories, ensuring you have a comprehensive view of the global landscape, from technology and business to sports and entertainment.

` }, contact: { title: "Contact Us", body: `

We'd love to hear from you! For any inquiries, feedback, or support, please reach out to us through the following channels:

` }, privacy: { title: "Privacy Policy", body: `

1. Information We Collect

Gnews Prime does not collect any personal information from its users. Your theme preference (light/dark) is stored locally in your browser and is not transmitted to our servers.

2. GNews API

Our service uses the GNews API. We are not responsible for the data collection practices of GNews or the websites of the news articles we link to. We encourage you to review their respective privacy policies.

3. Cookies

We do not use tracking cookies. Only essential local storage is used for site functionality like the theme toggle.

` }, terms: { title: "Terms of Service", body: `

1. Acceptance of Terms

By using Gnews Prime, you agree to be bound by these Terms of Service. If you do not agree, please do not use this site.

2. Use of Content

All news content, including titles, descriptions, and images, are provided by the GNews API and belong to their respective publishers. Gnews Prime is a display service and does not claim ownership of the content.

3. Limitation of Liability

The service is provided "as is" without any warranties. We are not liable for any inaccuracies in the news content or for the content of external sites.

` } }; const openModal = (contentKey) => { const content = modalContent[contentKey]; if (content) { modalTitle.innerText = content.title; modalBody.innerHTML = content.body; modalOverlay.classList.add('visible'); } }; const closeModal = () => { modalOverlay.classList.remove('visible'); }; document.querySelectorAll('.modal-trigger').forEach(trigger => { trigger.addEventListener('click', (e) => { e.preventDefault(); openModal(e.target.dataset.content); }); }); modalCloseBtn.addEventListener('click', closeModal); modalOverlay.addEventListener('click', (e) => { if (e.target === modalOverlay) closeModal(); }); document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && modalOverlay.classList.contains('visible')) { closeModal(); } }); // --- EVENT LISTENERS --- searchForm.addEventListener('submit', (e) => { e.preventDefault(); const query = searchInput.value.trim(); if (query) { fetchNews(query); document.querySelectorAll('.category-btn').forEach(btn => btn.classList.remove('active')); } }); const handleCategoryClick = (category) => { document.querySelectorAll('.category-btn').forEach(btn => { btn.classList.toggle('active', btn.dataset.category === category); }); fetchNews(category); searchInput.value = ''; window.scrollTo(0, 0); }; categoryFilters.addEventListener('click', (e) => { if (e.target.classList.contains('category-btn')) { handleCategoryClick(e.target.dataset.category); } }); document.querySelectorAll('.category-link').forEach(link => { link.addEventListener('click', (e) => { e.preventDefault(); handleCategoryClick(e.target.dataset.category); }); }); // --- INITIAL LOAD --- fetchNews(DEFAULT_CATEGORY); });