Patches
This commit is contained in:
@@ -69,6 +69,48 @@ const Toast = (() => {
|
||||
return { show };
|
||||
})();
|
||||
|
||||
/* Equalize steps+image pattern column heights */
|
||||
(() => {
|
||||
const collectColumns = (layout) => {
|
||||
const inner = layout.querySelector(":scope > .wp-block-group__inner-container");
|
||||
if (inner) return Array.from(inner.children);
|
||||
return Array.from(layout.children);
|
||||
};
|
||||
|
||||
const hasTiles = (el) => !!el.querySelector(".grid.grid--4, .wp-block-group.grid.grid--4");
|
||||
const hasImage = (el) => !!el.querySelector(".wp-block-image img, img");
|
||||
|
||||
const equalize = () => {
|
||||
const layouts = $$(".section .grid.grid--2, .wp-block-group.section .wp-block-group.grid.grid--2");
|
||||
layouts.forEach((layout) => {
|
||||
const columns = collectColumns(layout).filter((el) => el.nodeType === 1);
|
||||
if (columns.length < 2) return;
|
||||
|
||||
const tilesCol = columns.find(hasTiles);
|
||||
const imageCol = columns.find((el) => el !== tilesCol && hasImage(el));
|
||||
if (!tilesCol || !imageCol) return;
|
||||
|
||||
tilesCol.style.minHeight = "";
|
||||
imageCol.style.minHeight = "";
|
||||
|
||||
const h = Math.max(tilesCol.offsetHeight, imageCol.offsetHeight);
|
||||
if (!h) return;
|
||||
tilesCol.style.minHeight = `${h}px`;
|
||||
imageCol.style.minHeight = `${h}px`;
|
||||
});
|
||||
};
|
||||
|
||||
let raf = 0;
|
||||
const schedule = () => {
|
||||
if (raf) cancelAnimationFrame(raf);
|
||||
raf = requestAnimationFrame(equalize);
|
||||
};
|
||||
|
||||
window.addEventListener("load", schedule);
|
||||
window.addEventListener("resize", schedule);
|
||||
schedule();
|
||||
})();
|
||||
|
||||
/* Clipboard copy helper */
|
||||
async function copyText(text, label="Kopiert.") {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user