Skip to content

Commit

Permalink
Clean Up
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofzerbe committed Oct 8, 2024
1 parent cb57f06 commit fe053dd
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 685 deletions.
72 changes: 2 additions & 70 deletions themes/landscape/layout/_partial/after-footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -40,74 +40,6 @@
}
</script>

<script>
//HEADER
var header = {
height: 0,
top: 0,
offset: 55,
photoLinkOpacity: 0,
titleFontSize: 0
};
function initHeader() {
$("#header").css("height", ""); //reset inline css
$("#header-title").css("top", "");
$("#header-photo-link").css("opacity", "");
$("#title-wrap").css("font-size", "");
header.height = $("#header").height(); //set from given css
header.top = parseFloat($("#header-title").css("top"));
header.photoLinkOpacity = parseFloat($("#header-photo-link").css("opacity"));
header.titleFontSize = parseFloat($("#title-wrap").css("font-size"));
scrollHeader();
}
function scrollHeader() {
var h = header.height - header.offset,
st = $(document).scrollTop(),
d = (h - st),
p = (d / h),
hfs = header.titleFontSize / 5 * 3,
jSide = $("aside");
if (d > 0) {
$("#header").css("height", d + header.offset + "px");
$("#header-photo-link").css("opacity", header.photoLinkOpacity * p);
$("#banner").css("opacity", p);
$("#title-wrap").css("font-size", header.titleFontSize - ( header.titleFontSize / 3) * (1 - p) );
$("#header-title").css("top", header.top - (hfs * (1 - p)) + "px");
$("#subtitle").css("opacity", p);
jSide.css("max-width", "").css("position", "").css("top", "");
} else {
$("#header").css("height", header.offset + "px");
$("#header-photo-link").css("opacity", 0);
$("#banner").css("opacity", 0);
$("#title-wrap").css("font-size", header.titleFontSize - ( header.titleFontSize / 3) * (1) );
$("#header-title").css("top", header.top - (hfs * (1)) + "px");
$("#subtitle").css("opacity", 0);
if (window.matchMedia("screen and (min-width: 768px)").matches & window.innerHeight > (jSide.height() + 50)) {
jSide.css("max-width", $("aside").width()).css("position", "fixed").css("top", "50px");
}
}
}
function ensureIconLinkText() {
let linksWithoutText = document.querySelectorAll("a[href^='http']:empty");
linksWithoutText.forEach(e => {
if (window.getComputedStyle(e).display !== "none") {
if (e.title) {
let eText = document.createElement("span");
eText.innerText = e.title;
eText.classList.add("visually-hidden");
e.append(eText);
} else {
console.error("Link without Text and Title: " + e.outerHTML);
}
}
});
}
</script>

<script>
/*** EVENTS */
Expand All @@ -124,11 +56,11 @@
/*** INITS */
// $(document).ready(function() {
initHeader();
initScrollProgress();
// });
initImageViewportVisibility();
initNavMenuScroll();
initScrollProgress();
ensureIconLinkText();
// });
// BACK-TO-TOP
addBackToTop({ diameter: 30 });
Expand Down
309 changes: 0 additions & 309 deletions themes/landscape/layout/_partial/after-footer.ejs.NEW

This file was deleted.

Loading

0 comments on commit fe053dd

Please sign in to comment.