diff options
| Commit | eafd929a264bfc9891b011ed163b8bf59230179b (patch) | |
|---|---|---|
| Author | 2023-02-27 20:29:10 +0200 | |
| Committer | 2023-02-27 20:29:10 +0200 | |
| Files | ff1253d206be5654f2375b5baff7210b55b54a9b | |
| syndamia.com-eafd929a264bfc9891b011ed163b8bf59230179b.tar syndamia.com-eafd929a264bfc9891b011ed163b8bf59230179b.tar.gz syndamia.com-eafd929a264bfc9891b011ed163b8bf59230179b.zip | ||
| Parent | eaac14baa439227641cc5a240ac15123db95af0b (diff) | |
[presentation] Added id to each slide, which also influences slideIndex var, holding ctrl will not activate any key combination, fixed slide size on print
3 files changed, 20 insertions, 8 deletions
| -rw-r--r-- | awk-edits/Presentation.awk | 11 | ||||
| -rw-r--r-- | src/presentation.css | 4 | ||||
| -rw-r--r-- | src/scripts/presentation.js | 13 |
diff --git a/awk-edits/Presentation.awk b/awk-edits/Presentation.awk index 7fd6120..fb7bb1a 100644 --- a/awk-edits/Presentation.awk +++ b/awk-edits/Presentation.awk @@ -160,7 +160,7 @@ BEGIN { " <img id=\"presentBtn\" class=\"unzoomable btn setting-btn icon\" src=\"/img/presentation-tabler.svg\" alt=\"Present\">" ORS \ " <img id=\"printBtn\" class=\"unzoomable btn setting-btn icon\" src=\"/img/printer-tabler.svg\" alt=\"Print\">" ORS \ " </nav>" ORS \ -" <script type=\"text/javascript\" src=\"/scripts/presentation.js\" integrity=\"sha512-n0Ytq0qOvvVFG60eiszoj0eBH0ZDpLWeuf7Pq7XkNwvqDIdqgg5evpLfar40ksYXcsl/gj1YdmhAqw/oMwNAHw==\" crossorigin=\"anonymous\"></script>" +" <script type=\"text/javascript\" src=\"/scripts/presentation.js\" integrity=\"sha512-b9qsYTIYHQfkViNoo0tWKbfe2B+Lm1SFAPdPSi7AU0lqzU2KVV9w9ejqH91WE92+j2hHblSSdsGPEGVkp0epcg==\" crossorigin=\"anonymous\"></script>" for (i = 1; i <= length(names); i++) { pat[i] = "&&" names[i] @@ -185,11 +185,18 @@ BEGIN { rep[ 7] = "</div>" # &&/font presInsideCode = 0 + slideIndex = 0 } function presentationSubstitute(ind) { gsub(/(<p>|<\/p>)/, "") - gsub(pat[ind], rep[ind]) + if ((ind == 2 || ind == 3) && index($0, pat[ind]) != 0) { # &&slide or &&clide + gsub(pat[ind], "<div id=\"slide-" slideIndex "\"" substr(rep[ind], 5)) + slideIndex++ + } + else { + gsub(pat[ind], rep[ind]) + } if (ended[ind] == 1) gsub(cpat[ind], crep[ind]) } diff --git a/src/presentation.css b/src/presentation.css index e7c09af..afaa3ae 100644 --- a/src/presentation.css +++ b/src/presentation.css @@ -131,8 +131,8 @@ h2, h3, h4, h5, h6 { display: none !important; } .slide { - height: 209.5mm; - width: 296.99mm; + height: 210mm; + width: 297mm; } } diff --git a/src/scripts/presentation.js b/src/scripts/presentation.js index 10d3c59..d60e698 100644 --- a/src/scripts/presentation.js +++ b/src/scripts/presentation.js @@ -20,10 +20,14 @@ const prevSlideBtn = document.getElementById('prevSlideBtn'); const nextSlideBtn = document.getElementById('nextSlideBtn'); const slides = document.getElementsByClassName('slide'); -var slideIndex = 0; +var presenting = false; +var slideIndex = parseInt(document.URL.substr(document.URL.indexOf("#slide") + 7)); +if (isNaN(slideIndex)) slideIndex = 0; // Shows the "slideIndex + mod" numbered slide function showSlide(mod) { + if (!presenting) return; + slides[slideIndex].classList.remove('absolute-slide'); slideIndex = (slides.length + slideIndex + mod) % slides.length; slides[slideIndex].classList.add('absolute-slide'); @@ -43,7 +47,6 @@ const presentCont = document.getElementById('presentCont'); const presentBtn = document.getElementById('presentBtn'); const articleBtn = document.getElementById('articleBtn'); -var presenting = false; var pageY = 0; var pageX = 0; @@ -85,6 +88,8 @@ articleBtn.addEventListener('click', function() { /* Keyboard controls */ document.addEventListener('keydown', function (e) { + if (e.ctrlKey) return; + switch (e.code) { // Previous slide case 'Backspace': case 'PageUp': @@ -106,11 +111,11 @@ document.addEventListener('keydown', function (e) { break; // Go to first slide case 'Home': - if (presenting) showSlide(-slideIndex); + showSlide(-slideIndex); break; // Go to last slide case 'End': - if (presenting) showSlide(-slideIndex -1); + showSlide(-slideIndex -1); break; } }); |