Add refresh button and license statement

Close #25, close #24
This commit is contained in:
2022-11-28 15:55:05 +01:00
parent 20810aa850
commit 5146305caf
4 changed files with 56 additions and 3 deletions

View File

@ -1018,6 +1018,45 @@ class CsvxmlPage {
}
renderFooter() {
const footer = document.createElement("footer");
const licenseStatement = document.createElement("p");
licenseStatement.textContent = "This work is licensed under the GNU Affero Public License Version 3.";
footer.appendChild(licenseStatement);
const footerOptions = document.createElement("div");
const codeLink = document.createElement("a");
codeLink.textContent = "Source code";
codeLink.href = "https://gitea.armuli.eu/museum-digital/csvxml";
footerOptions.appendChild(codeLink);
if ('serviceWorker' in navigator) {
const refreshB = document.createElement("span");
refreshB.textContent = "Reload application";
refreshB.setAttribute("tabindex", 1);
refreshB.addEventListener('click', function(e) {
Promise.all(['csvxml-cache-v1'].map(function(cache) {
caches.has(cache).then(function(hasCache) {
if (hasCache === true) {
caches.delete(cache).then(function(deletionStatus) {});
}
})
}))
location.reload()
}, {passive: true, once: true});
footerOptions.appendChild(refreshB);
}
footer.appendChild(footerOptions);
document.body.appendChild(footer);
}
}
(async function() {
@ -1056,6 +1095,7 @@ class CsvxmlPage {
page.renderHelpTexts();
page.renderUploader();
page.renderMain();
page.renderFooter();
}