Files
documentation/presentations/less-prompting-more-shipping/runtime.js
T

28 lines
1.6 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');
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:true, 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, keyboard: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?.();
});