Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
berlintay authored Aug 10, 2024
1 parent b456dd3 commit 8930f83
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
document.addEventListener("DOMContentLoaded", function() {
// Fetch the GitHub trending repositories feed and display it
fetch('/api/github-trending')
.then(response => response.json())
.then(data => {
const trendingContainer = document.getElementById('trending-repos');
trendingContainer.innerHTML = ''; // Clear existing content
data.forEach(repo => {
const repoElement = document.createElement('div');
repoElement.classList.add('repo');
repoElement.innerHTML = `
<h3>${repo.organization} / ${repo.repository}</h3>
<p>${repo.description}</p>
`;
trendingContainer.appendChild(repoElement);
});
})
.catch(error => console.error('Error fetching GitHub trending data:', error));

fetch('/api/github-trending')
.then(response => response.json())
.then(data => {
const trendingContainer = document.getElementById('trending-repos');
trendingContainer.innerHTML = ''; // Clear existing content
data.forEach(repo => {
const repoElement = document.createElement('div');
repoElement.classList.add('repo');
repoElement.innerHTML = `
<h3>${repo.organization} / ${repo.repository}</h3>
<p>${repo.description}</p>
`;
trendingContainer.appendChild(repoElement);
});
})
.catch(error => console.error('Error fetching GitHub trending data:', error));
// Function to update the current time display
function updateTime() {
const now = new Date();
Expand Down

0 comments on commit 8930f83

Please sign in to comment.