forked from umacabal/umaring
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hampton Moore
committed
Jan 21, 2024
1 parent
b280cf3
commit 7ef232b
Showing
4 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
document.addEventListener('DOMContentLoaded', async () => { | ||
const webringContainer = document.getElementById('umaring'); | ||
if (!webringContainer) { | ||
console.error('UMass Amherst webring container not found.'); | ||
return; | ||
} | ||
|
||
try { | ||
const scriptTag = document.getElementById('webring_js'); | ||
if (!scriptTag) { | ||
console.error('UMass Amherst webring script tag not found.'); | ||
return; | ||
} | ||
|
||
const memberId = new URL(scriptTag.src).searchParams.get('id'); | ||
if (!memberId) { | ||
console.error('Member ID not specified in script tag.'); | ||
return; | ||
} | ||
|
||
const response = await fetch(`https://umaring.hamy.cc/${memberId}`); | ||
if (!response.ok) { | ||
console.error('Failed to fetch UMass Amherst webring data.'); | ||
return; | ||
} | ||
|
||
const data = await response.json(); | ||
const { prev, member, next } = data; | ||
|
||
webringContainer.innerHTML = ` | ||
<a href="${prev.url}" id="umaring_prev">${prev.name}</a> <- | ||
<a href="https://github.com/umaring/umaring">UMass Ring</a> -> | ||
<a href="${next.url}" id="umaring_next">${next.name}</a> | ||
`; | ||
} catch (error) { | ||
console.error('Error fetching UMass Amherst webring data:', error); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters