-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bacon_Space
authored
Nov 18, 2023
1 parent
dfcd4f0
commit 37b534b
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |