"Updated last" logic
added the ability to see when the site was last updated
This commit is contained in:
@@ -343,7 +343,7 @@ html {
|
||||
padding: 10px 10px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
margin: auto auto auto auto;
|
||||
margin: auto auto auto 10px;
|
||||
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
|
||||
text-align: center;
|
||||
line-height: 1.5em;
|
||||
|
||||
@@ -125,3 +125,18 @@ fetch('/parts/footer.html')
|
||||
})
|
||||
.catch(error => console.error('Error loading footer:', error));
|
||||
|
||||
// Fetch the latest commit information from GitHub
|
||||
fetch('https://api.github.com/repos/btcforplebs/BTCforPlebs.com/commits/main')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const lastUpdate = new Date(data.commit.author.date); // Commit date
|
||||
const formattedDate = lastUpdate.toLocaleDateString();
|
||||
const formattedTime = lastUpdate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
||||
|
||||
// Update the text content of the last-updated-text element
|
||||
document.getElementById('last-updated-text').textContent = `Website laste updated: ${formattedDate} ${formattedTime}`;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching last update:', error);
|
||||
document.getElementById('last-updated-text').textContent = 'Last update: Error fetching data.';
|
||||
});
|
||||
@@ -74,7 +74,10 @@
|
||||
<a href="https://github.com/btcforplebs/BTCforPlebs.com" target="_blank" title="GitHub" class="prefetch">
|
||||
<i class="fa-solid fa-github"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="last-update">
|
||||
<small id="last-updated-text"></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer"></div>
|
||||
|
||||
Reference in New Issue
Block a user