mirror of
https://github.com/TheErrorExe/blockattack
synced 2025-09-06 05:20:59 +02:00
Update index.html
This commit is contained in:
parent
51ebe112a6
commit
86336a9d4a
12
index.html
12
index.html
@ -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;">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user