From 5dca84020e301b957b0f9410419be325e1a3c472 Mon Sep 17 00:00:00 2001 From: Hans5958 Date: Fri, 16 Jun 2023 17:40:56 +0700 Subject: [PATCH] Adjust contributors to not just from Reddit --- web/_js/about.js | 32 +++++++++++++++++++++++++------- web/about.html | 6 +++--- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/web/_js/about.js b/web/_js/about.js index 7b444d3a..1dad15c7 100644 --- a/web/_js/about.js +++ b/web/_js/about.js @@ -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') + +// +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(' ')) } }) \ No newline at end of file diff --git a/web/about.html b/web/about.html index 44ef6319..da1d4821 100644 --- a/web/about.html +++ b/web/about.html @@ -180,10 +180,10 @@

Project Contributors

-

Reddit Contributors

-

The 2022 Atlas would not have been possible without the help of our Reddit contributors.

+

Contributors

+

The 2022 Atlas would not have been possible without the help of our contributors.

Thank you to everyone who submitted new entries, amended existing ones, reported bugs and just supported the project in general.

-
+