Adjust contributors to not just from Reddit

This commit is contained in:
Hans5958 2023-06-16 17:40:56 +07:00
parent 6eafcefac6
commit 5dca84020e
2 changed files with 28 additions and 10 deletions

View file

@ -5,17 +5,35 @@
* Licensed under AGPL-3.0 (https://place-atlas.stefanocoding.me/license.txt)
*/
const redditWrapperEl = document.querySelector('#reddit-contributors-wrapper')
const contributorsEl = document.querySelector('#contributors-wrapper')
// <i aria-label="GitHub" class="bi bi-github"></i>
const gitHubEl = document.createElement("i")
gitHubEl.ariaLabel = "GitHub:"
gitHubEl.className = "bi bi-github"
fetch('all-authors.txt')
.then(response => response.text())
.then(text => text.trim().split('\n').sort())
.then(text => text.trim().split('\n').sort((a, b) => {
const aSplit = a.split(':')
const bSplit = b.split(':')
return aSplit[aSplit.length - 1] > bSplit[bSplit.length - 1]
}))
.then(contributors => {
document.querySelector('#reddit-contributors-count').textContent = contributors.length
document.querySelector('#contributors-count').textContent = contributors.length
for (const contributor of contributors) {
const userEl = document.createElement('a')
userEl.href = 'https://reddit.com/user/' + contributor
userEl.textContent = contributor
redditWrapperEl.appendChild(userEl)
redditWrapperEl.appendChild(document.createTextNode(' '))
const contributorSplit = contributor.split(':')
if (contributorSplit[0] === "gh") {
const contributor1 = contributorSplit[1]
userEl.href = 'https://github.com/' + contributor1
userEl.appendChild(gitHubEl.cloneNode())
userEl.appendChild(document.createTextNode(' ' + contributor1))
} else {
userEl.href = 'https://reddit.com/user/' + contributor
userEl.textContent = contributor
}
contributorsEl.appendChild(userEl)
contributorsEl.appendChild(document.createTextNode(' '))
}
})

View file

@ -180,10 +180,10 @@ <h3>Project Contributors</h3>
</ul>
</li>
</ul>
<h3>Reddit Contributors</h3>
<p>The 2022 Atlas would not have been possible without the help of our <span id="reddit-contributors-count"></span> Reddit contributors.</p>
<h3>Contributors</h3>
<p>The 2022 Atlas would not have been possible without the help of our <span id="contributors-count"></span> contributors.</p>
<p>Thank you to everyone who submitted new entries, amended existing ones, reported bugs and just supported the project in general.</p>
<div id="reddit-contributors-wrapper" style="text-align: justify;"></div>
<div id="contributors-wrapper" style="text-align: justify;"></div>
</div>
</div>
<div class="col-md-5 col-xl-4">