full site update

This commit is contained in:
2025-07-24 18:46:24 +02:00
parent bfe2b90d8d
commit 37a6e0ab31
6912 changed files with 540482 additions and 361712 deletions

View File

@@ -1,26 +1,30 @@
const PERSIST_ATTR = "data-astro-transition-persist";
const NON_OVERRIDABLE_ASTRO_ATTRS = ["data-astro-transition", "data-astro-transition-fallback"];
const scriptsAlreadyRan = /* @__PURE__ */ new Set();
function detectScriptExecuted(script) {
const key = script.src ? new URL(script.src, location.href).href : script.textContent;
if (scriptsAlreadyRan.has(key)) return true;
scriptsAlreadyRan.add(key);
return false;
}
function deselectScripts(doc) {
for (const s1 of document.scripts) {
for (const s2 of doc.scripts) {
if (
// Check if the script should be rerun regardless of it being the same
!s2.hasAttribute("data-astro-rerun") && // Inline
(!s1.src && s1.textContent === s2.textContent || // External
s1.src && s1.type === s2.type && s1.src === s2.src)
) {
s2.dataset.astroExec = "";
break;
}
for (const s2 of doc.scripts) {
if (
// Check if the script should be rerun regardless of it being the same
!s2.hasAttribute("data-astro-rerun") && // Check if the script has already been executed
detectScriptExecuted(s2)
) {
s2.dataset.astroExec = "";
}
}
}
function swapRootAttributes(doc) {
const html = document.documentElement;
const astroAttributes = [...html.attributes].filter(
({ name }) => (html.removeAttribute(name), name.startsWith("data-astro-"))
function swapRootAttributes(newDoc) {
const currentRoot = document.documentElement;
const nonOverridableAstroAttributes = [...currentRoot.attributes].filter(
({ name }) => (currentRoot.removeAttribute(name), NON_OVERRIDABLE_ASTRO_ATTRS.includes(name))
);
[...doc.documentElement.attributes, ...astroAttributes].forEach(
({ name, value }) => html.setAttribute(name, value)
[...newDoc.documentElement.attributes, ...nonOverridableAstroAttributes].forEach(
({ name, value }) => currentRoot.setAttribute(name, value)
);
}
function swapHeadElements(doc) {
@@ -106,6 +110,7 @@ const swap = (doc) => {
};
export {
deselectScripts,
detectScriptExecuted,
restoreFocus,
saveFocus,
swap,