Skip to content

Commit

Permalink
Create index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Bacon_Space authored Nov 18, 2023
1 parent dfcd4f0 commit 37b534b
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<title>Fortnite Shop Tracker</title>
</head>
<body>

<div class="container">
<h3>Fortnite Shop</h3>
<ul class="collection" id="shop-list"></ul>
</div>

<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
fetch('https://fortnite-api.com/v2/shop/br')
.then(response => response.json())
.then(data => {
const shopList = document.getElementById('shop-list');
data.data.entries.forEach(entry => {
const listItem = document.createElement('li');
listItem.className = 'collection-item';
const lastAppearance = entry.shopHistory && entry.shopHistory.length > 0
? new Date(entry.shopHistory[0]).toLocaleDateString()
: 'N/A';
const gameplayTags = entry.metaTags && entry.metaTags.gameplayTags
? entry.metaTags.gameplayTags.join(', ')
: 'N/A';
listItem.innerHTML = `<span class="title">${entry.name}</span>
<p>Regular Price: ${entry.regularPrice}</p>
<p>Final Price: ${entry.finalPrice}</p>
<p>Last in Shop: ${lastAppearance}</p>
<p>Gameplay Tags: ${gameplayTags}</p>`;
shopList.appendChild(listItem);
});
})
.catch(error => console.error('Error fetching data:', error));
});
</script>
</body>
</html>

0 comments on commit 37b534b

Please sign in to comment.