Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit7153ef6f122a66bc74d95ebe04810e022e1ed5f1 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-03-03 11:46:51 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-03-03 11:46:51 +0200
Filesfa7766de54a3a9465a8813d0649165fed4b3001b /src
syndamia.com-7153ef6f122a66bc74d95ebe04810e022e1ed5f1.tar
syndamia.com-7153ef6f122a66bc74d95ebe04810e022e1ed5f1.tar.gz
syndamia.com-7153ef6f122a66bc74d95ebe04810e022e1ed5f1.zip
Parented6f6af8dbb0da9018a5ed471394d4fb2d04d7c9 (diff)
[presentation] Added an anchor to the current slide, which also shows slide index, in controls
3 files changed, 14 insertions, 1 deletions
-rw-r--r--src/presentation.css5
-rw-r--r--src/regarding-js.md2
-rw-r--r--src/scripts/presentation.js8
diff --git a/src/presentation.css b/src/presentation.css
index e790a2c..0f6d287 100644
--- a/src/presentation.css
+++ b/src/presentation.css
@@ -113,6 +113,11 @@ absolute-slide {...} */
visibility: visible;
z-index: 10;
}
+ #slideIndex {
+ border: none;
+ font-size: 1.4em;
+ vertical-align: middle;
+ }
/* Media specific stylings */
diff --git a/src/regarding-js.md b/src/regarding-js.md
index 6511428..f36b532 100644
--- a/src/regarding-js.md
+++ b/src/regarding-js.md
@@ -15,7 +15,7 @@ Any user data that might be saved isn't, and never will be, used for purposes no
|[js-styling-preload.js](/scripts/js-styling-preload.js)|Show hidden elements (used solely by scripts) as soon as possible|[Link](https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/js-styling-preload.js)|81B|3|
|[page-width.js](/scripts/page-width.js)|Change whether text covers the whole width of the page or only the middle (applicable to wide screens)|[Link](https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/page-width.js)|597B|20|
|[expand-navbar.js](/scripts/expand-navbar.js)|Button to shrink and expand the sidebar|[Link](https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/expand-navbar.js)|734B|20|
-|[presentation.js](/scripts/presentation.js)|Adds presentation styles and is used for presentation navbar|[Link](https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/presentation.js)|3.1KB|121|
+|[presentation.js](/scripts/presentation.js)|Adds presentation styles and is used for presentation navbar|[Link](https://gitlab.com/Syndamia/syndamiadotcom/-/tree/master/src/scripts/presentation.js)|3.7KB|137|
## Data in browser storage
diff --git a/src/scripts/presentation.js b/src/scripts/presentation.js
index 8c78ed8..930c7b0 100644
--- a/src/scripts/presentation.js
+++ b/src/scripts/presentation.js
@@ -17,6 +17,7 @@ printBtn.addEventListener('click', function() {
/* Next and previous buttons */
const prevSlideBtn = document.getElementById('prevSlideBtn');
+const slideIndexShow = document.getElementById('slideIndex');
const nextSlideBtn = document.getElementById('nextSlideBtn');
const slides = document.getElementsByClassName('slide');
@@ -24,6 +25,9 @@ var presenting = false;
var slideIndex = parseInt(document.URL.substr(document.URL.indexOf("#slide") + 7));
if (isNaN(slideIndex)) slideIndex = 0;
+slideIndexShow.innerText = slideIndex;
+slideIndexShow.href = '#slide-' + slideIndex;
+
// Shows the "slideIndex + mod" numbered slide
function showSlide(mod) {
if (!presenting) return;
@@ -31,6 +35,9 @@ function showSlide(mod) {
slides[slideIndex].classList.remove('absolute-slide');
slideIndex = (slides.length + slideIndex + mod) % slides.length;
slides[slideIndex].classList.add('absolute-slide');
+
+ slideIndexShow.innerText = slideIndex;
+ slideIndexShow.href = '#slide-' + slideIndex;
}
prevSlideBtn.addEventListener('click', function() {
@@ -59,6 +66,7 @@ presentBtn.addEventListener('click', function() {
// Show the slide controller
presentCont.classList.toggle('absolute-cont');
prevSlideBtn.classList.toggle('nodisplay');
+ slideIndexShow.classList.toggle('nodisplay');
nextSlideBtn.classList.toggle('nodisplay');
articleBtn.classList.toggle('nodisplay');
printBtn.classList.toggle('nodisplay');