Skip to content

Commit

Permalink
Added Status, fixed header showing status
Browse files Browse the repository at this point in the history
Added Status
  • Loading branch information
SIDDHU123M authored Aug 29, 2024
1 parent 0c02228 commit 1e911ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function checkLinkStatus(link, statusId) {

fetch(link.href, {mode: "no-cors"})
.then((response) => {
// Since we are using no-cors mode, we cannot check the response status
console.log(`Response for ${link.href}:`, response);
statusCircle.classList.add("online");
})
Expand All @@ -75,7 +76,8 @@ function checkLinkStatus(link, statusId) {
}

document.addEventListener("DOMContentLoaded", function () {
const links = document.querySelectorAll("ul a");
// Add status circles to each link within the <main> <ul> element and check their status
const links = document.querySelectorAll("main ul a");
links.forEach((link, index) => {
const statusCircle = document.createElement("span");
statusCircle.classList.add("status-circle");
Expand Down

0 comments on commit 1e911ea

Please sign in to comment.