-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: fixes to the asciicast infrastructure
- Loading branch information
Showing
6 changed files
with
61 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
var slideshow = remark.create({ | ||
highlightStyle: 'monokai', | ||
highlightLanguage: 'remark', | ||
highlightLines: true, | ||
countIncrementalSlides: false, | ||
highlightSpans: true, | ||
ratio: '16:9' | ||
}); | ||
|
||
// Now retrieve all IDs of asciinema casts | ||
const allcasts = new Map(); | ||
|
||
slideshow.on('afterShowSlide', function (slide) { | ||
// Slide is the slide being navigated | ||
var slideNumber = slide.getSlideIndex(); | ||
var element = document.getElementsByClassName("remark-visible")[0].getElementsByClassName('asciicast') | ||
if (element.length == 0 ) { | ||
return; | ||
} | ||
|
||
if (allcasts.has(slideNumber)) { | ||
allcasts.get(slideNumber).play(); | ||
return; | ||
} | ||
|
||
var castid = element[0].attributes["id"].value; | ||
var castsrc = element[0].attributes["data-src"].value; | ||
allcasts.set(slideNumber, AsciinemaPlayer.create( | ||
castsrc, | ||
document.getElementById(castid), | ||
{ autoPlay: true, speed: 2, idle_time_limit: 8, rows: 23 } | ||
)); | ||
}); | ||
|
||
slideshow.on('beforeHideSlide', function (slide) { | ||
// Slide is the slide being navigated | ||
var slideNumber = slide.getSlideIndex(); | ||
if (allcasts.has(slideNumber)) { | ||
allcasts.get(slideNumber).pause(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters