Skip to content

Commit 416ce30

Browse files
committed
updates reveal api calls
1 parent 388f929 commit 416ce30

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

exampleSite/content/home/configuration.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ In `home/reveal-hugo/body.html`:
142142

143143
```html
144144
<script type="text/javascript">
145-
Reveal.addEventListener('slidechanged', function(event) {
145+
Reveal.on('slidechanged', function(event) {
146146
console.log("🎞️ Slide is now " + event.indexh);
147147
});
148148
</script>
149149
```
150150

151151
---
152152

153-
### Extending the layout
153+
### Extending the layout
154154
#### (alternative)
155155

156156
You can declare a custom CSS or javascript in your configuration.
@@ -163,7 +163,7 @@ custom_js = "js/custom.js"
163163

164164
<small>
165165

166-
These files can be located in `static/css`, `static/js` folder
166+
These files can be located in `static/css`, `static/js` folder
167167

168168
💡 See the [extending layout example](/extending-layout-example/#) for more details.
169169

exampleSite/layouts/partials/home/reveal-hugo/body.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- The Reveal.js JavaScript API is located at https://github.com/hakimel/reveal.js/#api -->
44
<script type="text/javascript">
55
// Log the current slide to the console when it changes
6-
Reveal.addEventListener('slidechanged', function(event) {
6+
Reveal.on('slidechanged', function(event) {
77
console.log("🎞️ Slide is now " + event.indexh);
88
});
99
</script>

exampleSite/static/plugin/gallery/gallery.plugin.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
(function(Gallery) {
22
var galleryTimer, galleryMode;
33

4+
Gallery.id = 'gallery';
5+
46
Gallery.step = function (items, iterations) {
57
var length = items.length,
68
ptr = 0,
@@ -31,7 +33,7 @@
3133
// FIXME remove dependency on Reveal, have a callback? function
3234
// that will get a root node to move full screen slides to (ie. slidesNode)
3335

34-
// for full screen mode we need to:
36+
// for full screen mode we need to:
3537
// - take the gallery out of the flow and insert it before "slides"
3638
// - hide slides
3739
// - make it full screen
@@ -94,15 +96,15 @@
9496
})(window.Gallery = window.Gallery || {});(function() {
9597
if( typeof window.addEventListener === 'function' ) {
9698
var slidesNode = document.querySelector(".slides");
97-
Reveal.addEventListener("slidechanged", function (event) {
99+
Reveal.on("slidechanged", function (event) {
98100
console.log(event)
99-
var galleryNode = event.previousSlide.querySelector('.gallery') || document.querySelector('.reveal > .gallery');
101+
var galleryNode = event.previousSlide?.querySelector('.gallery') || document.querySelector('.reveal > .gallery');
100102
if (galleryNode) {
101103
Gallery.stop(galleryNode, slidesNode);
102104
}
103105

104106
galleryNode = event.currentSlide.querySelector('.gallery');
105-
if (galleryNode) {
107+
if (galleryNode) {
106108
Gallery.start(galleryNode, slidesNode);
107109
}
108110

@@ -116,4 +118,4 @@
116118
}
117119
}
118120
}
119-
})();
121+
})();

layouts/partials/layout/javascript.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
// support current page reload with possible mermaid element
8585
render({currentSlide: Reveal.getCurrentSlide()});
8686

87-
Reveal.addEventListener('slidechanged', render);
88-
Reveal.addEventListener('ready', render);
87+
Reveal.on('slidechanged', render);
88+
Reveal.on('ready', render);
8989
</script>
9090
{{ end }}
9191

0 commit comments

Comments
 (0)