update template
This commit is contained in:
@@ -5,9 +5,45 @@ const headroomChanged = new CustomEvent("quarto-hrChanged", {
|
||||
composed: false,
|
||||
});
|
||||
|
||||
const announceDismiss = () => {
|
||||
const annEl = window.document.getElementById("quarto-announcement");
|
||||
if (annEl) {
|
||||
annEl.remove();
|
||||
|
||||
const annId = annEl.getAttribute("data-announcement-id");
|
||||
window.localStorage.setItem(`quarto-announce-${annId}`, "true");
|
||||
}
|
||||
};
|
||||
|
||||
const announceRegister = () => {
|
||||
const annEl = window.document.getElementById("quarto-announcement");
|
||||
if (annEl) {
|
||||
const annId = annEl.getAttribute("data-announcement-id");
|
||||
const isDismissed =
|
||||
window.localStorage.getItem(`quarto-announce-${annId}`) || false;
|
||||
if (isDismissed) {
|
||||
announceDismiss();
|
||||
return;
|
||||
} else {
|
||||
annEl.classList.remove("hidden");
|
||||
}
|
||||
|
||||
const actionEl = annEl.querySelector(".quarto-announcement-action");
|
||||
if (actionEl) {
|
||||
actionEl.addEventListener("click", function (e) {
|
||||
e.preventDefault();
|
||||
// Hide the bar immediately
|
||||
announceDismiss();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.document.addEventListener("DOMContentLoaded", function () {
|
||||
let init = false;
|
||||
|
||||
announceRegister();
|
||||
|
||||
// Manage the back to top button, if one is present.
|
||||
let lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
||||
const scrollDownBuffer = 5;
|
||||
@@ -85,6 +121,17 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
||||
}
|
||||
}
|
||||
|
||||
function dashboardOffset() {
|
||||
const dashboardNavEl = window.document.getElementById(
|
||||
"quarto-dashboard-header"
|
||||
);
|
||||
if (dashboardNavEl !== null) {
|
||||
return dashboardNavEl.clientHeight;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function updateDocumentOffsetWithoutAnimation() {
|
||||
updateDocumentOffset(false);
|
||||
}
|
||||
@@ -92,7 +139,7 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
||||
function updateDocumentOffset(animated) {
|
||||
// set body offset
|
||||
const topOffset = headerOffset();
|
||||
const bodyOffset = topOffset + footerOffset();
|
||||
const bodyOffset = topOffset + footerOffset() + dashboardOffset();
|
||||
const bodyEl = window.document.body;
|
||||
bodyEl.setAttribute("data-bs-offset", topOffset);
|
||||
bodyEl.style.paddingTop = topOffset + "px";
|
||||
@@ -226,6 +273,7 @@ window.document.addEventListener("DOMContentLoaded", function () {
|
||||
const links = window.document.querySelectorAll("a");
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
if (links[i].href) {
|
||||
links[i].dataset.originalHref = links[i].href;
|
||||
links[i].href = links[i].href.replace(/\/index\.html/, "/");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user