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 8930f83 commit ecf55a0
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
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 All @@ -27,7 +28,6 @@ fetch('/api/github-trending')

// Update the time every second
setInterval(updateTime, 1000);
});

// Function to process terminal commands
function processCommand(command) {
Expand Down Expand Up @@ -84,4 +84,3 @@ function clearTerminal() {
const terminal = document.getElementById('terminal');
terminal.innerHTML = ''; // Clear all terminal content
}

0 comments on commit ecf55a0

Please sign in to comment.