Skip to content

Commit

Permalink
Games load now
Browse files Browse the repository at this point in the history
with recent changes of 8/7/24 Games were not loading, my previous bug fix was not working anymore because gameData.json was not correctly refered to with new update of main project but after new changes it works
  • Loading branch information
mohitgedar committed Jul 8, 2024
1 parent 194ee65 commit 40d0ea4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions assets/js/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Generate <li> tags dynamically

const generateLiTags = (gamesData, searchText = "") => {
console.log(gamesData);
const liTags = [];
searchText = searchText.trim().toLowerCase(); // Trim whitespace and convert to lowercase

for (let tagNumber = 1; tagNumber <= 417; tagNumber++) {
for (let tagNumber = 1; tagNumber <= 424; tagNumber++) {
const gameData = gamesData[tagNumber.toString()];

if (gameData) {
Expand Down Expand Up @@ -52,7 +53,7 @@ const generateLiTags = (gamesData, searchText = "") => {
};

// Fetch the game data from the JSON file
fetch("gamesData.json")
fetch("assets/js/gamesData.json")
.then((response) => response.json())
.then((gamesData) => {
const projectListContainer = document.querySelector(".project-list");
Expand Down
2 changes: 1 addition & 1 deletion assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ document.addEventListener("DOMContentLoaded", () => {
let gamesData = {};

function fetchGamesData() {
fetch("gamesData.json") // Assuming gamesData.json is in the same directory
fetch("assets/js/gamesData.json") // Assuming gamesData.json is in the same directory
.then((response) => response.json())
.then((data) => {
gamesData = data;
Expand Down
12 changes: 6 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@
</div>
<script>
window.addEventListener("load", () => {
const loader = document.querySelector(".preloader");
const loader = document.querySelector(".preloader");

loader.classList.add("preloader--hidden");
loader.classList.add("preloader--hidden");

loader.addEventListener("transitionend", () => {
document.body.removeChild(loader);
});
});
loader.addEventListener("transitionend", () => {
document.body.removeChild(loader);
});
});
</script>
<div class="cursor"></div>
<div class="progress-bar">
Expand Down

0 comments on commit 40d0ea4

Please sign in to comment.