Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Set current date
+ const dateElement = document.getElementById('currentDate');
+ const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
+ dateElement.textContent = new Date().toLocaleDateString(undefined, options);
+
+ // Simulate loading news data (in a real application, this would fetch from an API)
+ const mockNews = [
+ {
+ category: 'World',
+ title: 'Historic Climate Agreement Reached at Global Summit',
+ summary: 'World leaders have unanimously agreed to ambitious new targets for reducing carbon emissions in a groundbreaking climate accord.',
+ timestamp: '2 hours ago',
+ image: 'linear-gradient(45deg, #43cea2, #185a9d)'
+ },
+ {
+ category: 'Technology',
+ title: 'Breakthrough in Quantum Computing Achieves New Milestone',
+ summary: 'Scientists announce successful demonstration of quantum supremacy with a new 1000-qubit processor.',
+ timestamp: '4 hours ago',
+ image: 'linear-gradient(45deg, #904e95, #e96443)'
+ },
+ {
+ category: 'Health',
+ title: 'Novel Treatment Shows Promise in Cancer Research',
+ summary: 'Researchers reveal promising results from clinical trials of an innovative immunotherapy treatment.',
+ timestamp: '6 hours ago',
+ image: 'linear-gradient(45deg, #56ccf2, #2f80ed)'
+ }
+ ];
+
+ // Update the DOM with news data
+ mockNews.forEach((story, index) => {
+ const article = document.getElementById(`story${index + 1}`);
+ const image = article.querySelector('.placeholder-image');
+ const category = article.querySelector('.category');
+ const title = article.querySelector('h2');
+ const summary = article.querySelector('.summary');
+ const timestamp = article.querySelector('.timestamp');
+
+ image.style.background = story.image;
+ category.textContent = story.category;
+ title.textContent = story.title;
+ summary.textContent = story.summary;
+ timestamp.textContent = story.timestamp;
+ });
+ });