Skip to content

Commit bb3c783

Browse files
committed
Auto-fit Appless usecase heading width on load
Signed-off-by: Codex (GPT 5) <codex@openai.com>
1 parent ea332dd commit bb3c783

1 file changed

Lines changed: 39 additions & 1 deletion

File tree

www/index.html

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ <h3>Bring Your Own AI</h3>
7373
</ul>
7474
</article>
7575
<article class="placeholder">
76-
<h3>The Future is App<i style="opacity: 0.617">less</i></h3>
76+
<h3 id="usecase-appless-heading">The Future is App<i style="opacity: 0.617">less</i></h3>
7777
<p>
7878
Claw-only Services are single-page websites with a BYOClaw button.
7979
They expose functionality only through Claw APIs, and your Claw
@@ -373,6 +373,44 @@ <h2>Creator / Maintainer</h2>
373373
<p><a href="https://byoclaw.dev">byoclaw.dev</a></p>
374374
</footer>
375375
</main>
376+
<script>
377+
function fitApplessHeadingToWidth() {
378+
const heading = document.getElementById('usecase-appless-heading');
379+
if (!heading) return;
380+
381+
const containerWidth = heading.clientWidth;
382+
if (!containerWidth) return;
383+
384+
heading.style.whiteSpace = 'nowrap';
385+
386+
let low = 12;
387+
let high = 120;
388+
let best = 12;
389+
390+
while (low <= high) {
391+
const mid = (low + high) / 2;
392+
heading.style.fontSize = `${mid}px`;
393+
394+
if (heading.scrollWidth <= containerWidth) {
395+
best = mid;
396+
low = mid + 0.25;
397+
} else {
398+
high = mid - 0.25;
399+
}
400+
}
401+
402+
heading.style.fontSize = `${best.toFixed(2)}px`;
403+
}
404+
405+
window.addEventListener('load', () => {
406+
if (document.fonts && document.fonts.ready) {
407+
document.fonts.ready.then(fitApplessHeadingToWidth);
408+
return;
409+
}
410+
411+
fitApplessHeadingToWidth();
412+
});
413+
</script>
376414
</body>
377415
</html>
378416

0 commit comments

Comments
 (0)