Update index.html

This commit is contained in:
TheErrorExe 2025-01-10 20:38:04 +01:00 committed by GitHub
parent 51ebe112a6
commit 86336a9d4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,15 +62,13 @@ This Website was developed by TheErrorExe for Blockattack. TheErrorExe is and wi
<p><em>Jetzt die neuesten Features wie das Claimen von Gebieten ausprobieren!</em></p> <p><em>Jetzt die neuesten Features wie das Claimen von Gebieten ausprobieren!</em></p>
</section> </section>
<script> <script>
async function loadNews() { async function loadNews() {
try { try {
const response = await fetch('https://api.errexe.xyz/blockattack-api/news/get'); const response = await fetch('https://api.errexe.xyz/blockattack-api/news/get');
const data = await response.json(); const data = await response.json();
const newsContainer = document.getElementById('news-container'); const newsContainer = document.getElementById('news-container');
newsContainer.innerHTML = ''; newsContainer.innerHTML = '';
const latestNews = data.slice(0, 2); const latestNews = data.slice(0, 2);
if (latestNews.length === 0) { if (latestNews.length === 0) {
@ -78,7 +76,11 @@ This Website was developed by TheErrorExe for Blockattack. TheErrorExe is and wi
} else { } else {
latestNews.forEach(newsItem => { latestNews.forEach(newsItem => {
const newsElement = document.createElement('div'); const newsElement = document.createElement('div');
newsElement.innerHTML = `<h3>${newsItem.title}</h3><p>${newsItem.content}</p>`; newsElement.classList.add('news-item');
newsElement.innerHTML = `
<h3>${newsItem.title}</h3>
<p>${newsItem.content}</p>
`;
newsContainer.appendChild(newsElement); newsContainer.appendChild(newsElement);
}); });
} }
@ -88,6 +90,8 @@ This Website was developed by TheErrorExe for Blockattack. TheErrorExe is and wi
} }
} }
loadNews();
</script> </script>
<section id="news-section" style="margin-bottom: 50px; border-bottom: 2px solid #ccc; padding-bottom: 20px;"> <section id="news-section" style="margin-bottom: 50px; border-bottom: 2px solid #ccc; padding-bottom: 20px;">
<main style="padding: 20px;"> <main style="padding: 20px;">