Files
documentation/presentations/less-prompting-more-shipping/runtime.js
T
jarvis-at-skic 8a9363ccb2
Build and publish Eldorado documentation / build (pull_request) Successful in 42s
feat: embed canonical presentation on homepage
2026-10-08 18:33:31 +00:00

38 lines
2.1 KiB
JavaScript

/* Reveal 5.2.1, fully local runtime; this document is isolated from Docusaurus CSS. */
const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
const portrait = window.matchMedia('(max-width: 700px) and (orientation: portrait)');
const printing = new URLSearchParams(location.search).has('print-pdf');
const embedded = new URLSearchParams(location.search).has('embed') && !printing;
document.documentElement.classList.toggle('embedded', embedded);
if (embedded) {
document.querySelector('.toolbar').hidden = true;
// Never load the portal inside the stage when following the reference appendix.
document.querySelectorAll('.slides a').forEach(link => { link.target = '_top'; });
}
function layoutSize(){
const narrow=portrait.matches&&!printing;
document.documentElement.classList.toggle('portrait',narrow);
return narrow?{width:600,height:1000}:{width:1200,height:660};
}
Reveal.initialize({
...layoutSize(), margin:0.04, minScale:0.1, maxScale:2,
hash:!embedded, embedded, keyboardCondition:embedded ? () => document.hasFocus() : null,
hashOneBasedIndex:false, controls:true, progress:true,
slideNumber:'c/t', showSlideNumber:'all', center:false,
transition:reducedMotion.matches?'none':'fade', transitionSpeed:'fast',
backgroundTransition:'none', autoSlide:0, touch:true,
// The host owns fullscreen; speaker tools remain available in the standalone deck.
keyboard:embedded ? {70:null,83:null} : true,
// Keep deliberate slides on phones rather than Reveal's automatic scroll view.
scrollActivationWidth:null, pdfMaxPagesPerSlide:1, pdfSeparateFragments:false,
plugins:[RevealNotes]
});
portrait.addEventListener('change',()=>Reveal.configure(layoutSize()));
reducedMotion.addEventListener('change',event=>Reveal.configure({transition:event.matches?'none':'fade'}));
document.getElementById('overview').addEventListener('click',()=>Reveal.toggleOverview());
document.getElementById('notes').addEventListener('click',()=>Reveal.getPlugin('notes').open());
document.getElementById('fullscreen').addEventListener('click',()=>{
if(document.fullscreenElement) document.exitFullscreen();
else document.documentElement.requestFullscreen?.();
});