mirror of
https://github.com/DeNNiiInc/Advanced-Raid-Calculator.git
synced 2026-04-17 12:45:59 +00:00
Add git commit info to UI and update deployment script
This commit is contained in:
38
script.js
38
script.js
@@ -715,4 +715,42 @@ class RAIDCalculator {
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
new RAIDCalculator();
|
||||
initVersionDisplay();
|
||||
});
|
||||
|
||||
/* ===================================
|
||||
Version Display Logic
|
||||
=================================== */
|
||||
function initVersionDisplay() {
|
||||
const versionDisplay = document.getElementById('version-display');
|
||||
if (!versionDisplay) return;
|
||||
|
||||
// Add cache buster to ensure fresh version info
|
||||
fetch(`version.json?t=${new Date().getTime()}`)
|
||||
.then(response => {
|
||||
if (!response.ok) throw new Error('Version info not found');
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (!data.commit || !data.date) return;
|
||||
|
||||
versionDisplay.innerHTML = `
|
||||
<a href="https://github.com/DeNNiiInc/Advanced-Raid-Calculator/commit/${data.commit}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="version-tag"
|
||||
title="View commit on GitHub">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="width: 14px; height: 14px; opacity: 0.7;">
|
||||
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path>
|
||||
</svg>
|
||||
<span class="version-commit">${data.commit}</span>
|
||||
<span class="version-divider"></span>
|
||||
<span class="version-date">${data.date}</span>
|
||||
</a>
|
||||
`;
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('Version info unavailable:', error);
|
||||
versionDisplay.style.display = 'none';
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user