-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
88 lines (75 loc) · 2.74 KB
/
Copy pathscript.js
File metadata and controls
88 lines (75 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
fetch('games.json')
.then(res => res.json())
.then(data => {
loadCategory(data.games, 'gameList');
loadCategory(data.xbla, 'xblaList');
loadCategory(data.dlcs, 'dlcList');
});
function loadCategory(gamePaths, containerId) {
const container = document.getElementById(containerId);
gamePaths.forEach((path, index) => {
fetch(path)
.then(res => res.json())
.then(game => {
const cover = game.front && game.front.trim() !== '' ? game.front : game.logo;
const tile = document.createElement('div');
tile.className = 'game-tile';
tile.style.animationDelay = `${index * 50}ms`;
tile.innerHTML = `
<img src="${cover}" alt="${game.name}">
<h3>${game.name}</h3>
<div class="platform">${game.titleid}</div>
`;
tile.addEventListener('click', () => showModal(game));
container.appendChild(tile);
});
});
}
function showModal(game) {
const modal = document.getElementById('gameModal');
document.getElementById('gameDescription').innerText = game.notes;
document.getElementById('gameLogo').src = game.logo;
const gallery = document.getElementById('gameScreenshots');
gallery.innerHTML = '';
if (Array.isArray(game.screenshots)) {
game.screenshots.forEach(screenshot => {
const img = document.createElement('img');
img.src = screenshot;
gallery.appendChild(img);
});
}
const downloadLink = document.getElementById('downloadLink');
downloadLink.href = game.download;
downloadLink.textContent = 'Download';
modal.classList.add('show');
modal.style.display = 'flex';
}
document.querySelector('.close').addEventListener('click', () => {
const modal = document.getElementById('gameModal');
modal.classList.remove('show');
modal.style.display = 'none';
});
const repoOwner = 'Nugetinc';
const repoName = '360-Revitalized';
async function fetchGitHubStats() {
const commitsApi = `https://api.github.com/repos/${repoOwner}/${repoName}/commits`;
try {
const response = await fetch(commitsApi);
const commits = await response.json();
const latestCommit = commits[0];
const latestMessage = latestCommit.commit.message;
const latestAuthor = latestCommit.commit.author.name;
const totalCommits = commits.length;
document.getElementById('githubStats').innerHTML = `
<p><strong>Latest Commit:</strong> ${latestMessage}</p>
<p><strong>Committer:</strong> ${latestAuthor}</p>
<p><strong>Total Commits:</strong> ${totalCommits}</p>
`;
} catch (error) {
console.error('Error fetching GitHub stats:', error);
document.getElementById('githubStats').innerHTML = `
<p>Failed to load GitHub stats. Nuget messed something up.</p>
`;
}
}
fetchGitHubStats();