From 46d681c6b825d21b3f698d793c4e630c687d90ad Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 21 May 2026 21:41:53 +0000
Subject: [PATCH] =Major CustomBlocks.php overhaul, expanding block support and customization from the editor. theme.json should now be updated on new themes to set brand colours, etc. Also note: major change to .col vs .row alignment: simplifying it to .top .bottom vs the confusion of the differences for .col/.row .start and .a-start
---
assets/js/concise/UtilityFunctions.js | 63 +++++++++++++++++++++++++++++++
1 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/assets/js/concise/UtilityFunctions.js b/assets/js/concise/UtilityFunctions.js
index ca5944e..d11cdbc 100644
--- a/assets/js/concise/UtilityFunctions.js
+++ b/assets/js/concise/UtilityFunctions.js
@@ -992,12 +992,75 @@
{ passive: true }
);
+
+window.previousBGSize = 'Small';
+window.bgSizes = {
+ Small: 500,
+ Med: 768,
+ Large: 1024
+};
+
+window.bgObserver = new IntersectionObserver((entries) => {
+ entries.forEach(entry => {
+ if (entry.isIntersecting) {
+ let newSize = entry.target.dataset[`bg${window.previousBGSize}`];
+ entry.target.style.backgroundImage = `url(${newSize})`;
+ entry.target.dataset.bgImg = window.previousBGSize;
+ window.bgObserver.unobserve(entry.target);
+ }
+ })
+ },
+ {
+ root: null,
+ rootMargin: '0px 0px -100px 0px',
+ threshold: 0
+ });
+
+function updateBG() {
+ let current = window.innerWidth;
+ let newWidth = getBGWidth(current);
+
+ if (newWidth) {
+ window.previousBGSize = newWidth;
+ document.querySelectorAll('[data-bg-img]:not([data-bg-img="'+window.previousBGSize+'"])').forEach(img => {
+ window.bgObserver.observe(img);
+ });
+ }
+
+}
+function getBGWidth(width) {
+ let prev = window.previousBGSize;
+
+ let check = {
+ Small: ['Med','Large'],
+ Med: ['Large'],
+ Large: false
+ };
+
+ if (!check[prev]) {
+ return false;
+ }
+ let next = 'Small';
+
+ check[prev].forEach(w => {
+ if (width => window.bgSizes[w]) {
+ next = w;
+ }
+ });
+ return next;
+}
+
+updateBG();
+
// Debounced resize to recalc scrollable height
window.addEventListener('resize', () => {
window.debouncer.schedule('recalc-max-scroll', () => {
updateMaxScroll();
updateScrollProgress(window.scrollY || docEl.scrollTop || 0);
}, 20);
+ window.debouncer.schedule('bg-resize', () => {
+ updateBG();
+ });
});
// Initial setup
--
Gitblit v1.10.0