|
162 | 162 | if (el) el.textContent = (state.idx + 1) + ' / ' + state.slides.length; |
163 | 163 | } |
164 | 164 |
|
| 165 | + /* ── detect hero slides (image/video-dominant) ────────── */ |
| 166 | + function detectHero(slideEl) { |
| 167 | + var media = slideEl.querySelectorAll('.block-content img, .block-content video'); |
| 168 | + if (!media.length) { slideEl.classList.remove('ls-pres-hero'); return; } |
| 169 | + /* count text-heavy blocks (>60 chars, no heading/media) */ |
| 170 | + var heavy = 0; |
| 171 | + slideEl.querySelectorAll('.block-content').forEach(function (bc) { |
| 172 | + if (bc.querySelector('h1, h2, h3, img, video, table, iframe')) return; |
| 173 | + if (bc.textContent.trim().length > 60) heavy++; |
| 174 | + }); |
| 175 | + if (heavy <= 1) { |
| 176 | + slideEl.classList.add('ls-pres-hero'); |
| 177 | + } else { |
| 178 | + slideEl.classList.remove('ls-pres-hero'); |
| 179 | + } |
| 180 | + } |
| 181 | + |
165 | 182 | /* ── navigation ────────────────────────────────────────── */ |
166 | 183 | function showSlide(n) { |
167 | 184 | n = Math.max(0, Math.min(n, state.slides.length - 1)); |
|
171 | 188 | updateCounter(); |
172 | 189 | state.slides[n].scrollTop = 0; |
173 | 190 | hideCollapsedBlocks(state.slides[n]); |
| 191 | + detectHero(state.slides[n]); |
174 | 192 | } |
175 | 193 |
|
176 | 194 | function next() { showSlide(state.idx + 1); } |
|
196 | 214 | document.documentElement.classList.remove('ls-pres-blackout'); |
197 | 215 | state.slides.forEach(function (s) { |
198 | 216 | s.classList.remove('ls-pres-active'); |
| 217 | + s.classList.remove('ls-pres-hero'); |
199 | 218 | /* clean up hidden markers */ |
200 | 219 | s.querySelectorAll('.ls-pres-hidden').forEach(function (h) { |
201 | 220 | h.classList.remove('ls-pres-hidden'); |
|
0 commit comments