Skip to content

Commit 0870861

Browse files
Add latest update to footer
1 parent 25639b2 commit 0870861

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

web/static/js/contributors.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,20 @@ document.addEventListener("DOMContentLoaded", function () {
2626
contributorsRequest.onerror = function () {
2727
document.querySelector("#contributors").innerHTML = "multiple";
2828
};
29+
30+
var repoRequest = new XMLHttpRequest();
31+
repoRequest.open(
32+
"GET",
33+
"https://api.github.com/repos/codethesaurus/codethesaur.us"
34+
);
35+
repoRequest.send();
36+
37+
repoRequest.onload = function () {
38+
if (repoRequest.status === 200) {
39+
let repoData = JSON.parse(repoRequest.responseText);
40+
let lastUpdate = new Date(repoData.pushed_at);
41+
let options = { year: 'numeric', month: 'long', day: 'numeric' };
42+
document.querySelector("#last-update").innerHTML = lastUpdate.toLocaleDateString(undefined, options);
43+
}
44+
};
2945
});

web/templates/base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
<div class="row">
8080
<div class="col-8 justify-content-start">
8181
<p>Made with &#x2764; by Sarah Withee and <a href="https://github.com/codethesaurus/codethesaur.us/graphs/contributors" target="_blank" rel="noreferrer"><span id="contributors"></span> contributors</a>.</p> <!-- x2764 the heart emoji code -->
82+
<p>Last GitHub update: <span id="last-update"></span></p>
8283
<p>Want to help out? Check the project out on <a href="http://github.com/codethesaurus/" target="_blank" rel="noopener">GitHub</a>.</p>
8384
</div>
8485
<div class="col-4 order-sm-2 d-flex justify-content-end align-self-center">

0 commit comments

Comments
 (0)