mirror of
https://github.com/astefanutti/decktape.git
synced 2024-09-11 22:27:11 +03:00
BREAKING CHANGE: Please run node 12.20 or higher BREAKING CHANGE: This package is now a pure esm, please [read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
42 lines
965 B
JavaScript
42 lines
965 B
JavaScript
export const create = page => new Slidy(page);
|
|
|
|
class Slidy {
|
|
|
|
constructor(page) {
|
|
this.page = page;
|
|
}
|
|
|
|
getName() {
|
|
return 'Slidy';
|
|
}
|
|
|
|
isActive() {
|
|
return this.page.evaluate(_ => typeof w3c_slidy === 'object');
|
|
}
|
|
|
|
configure() {
|
|
return this.page.evaluate(_ => {
|
|
w3c_slidy.hide_toolbar();
|
|
w3c_slidy.initial_prompt.style.visibility = 'hidden';
|
|
});
|
|
}
|
|
|
|
slideCount() {
|
|
return this.page.evaluate(_ => w3c_slidy.slides.length + Array.prototype.slice
|
|
.call(document.querySelectorAll('.incremental'))
|
|
.reduce((incrementals, parent) => incrementals + parent.querySelectorAll('*').length || 1, 0));
|
|
}
|
|
|
|
hasNextSlide() {
|
|
return this.page.evaluate(_ => w3c_slidy.slide_number + 1 < w3c_slidy.slides.length);
|
|
}
|
|
|
|
nextSlide() {
|
|
return this.page.evaluate(_ => w3c_slidy.next_slide(true));
|
|
}
|
|
|
|
currentSlideIndex() {
|
|
return this.page.evaluate(_ => '(' + (w3c_slidy.slide_number + 1) + ')');
|
|
}
|
|
}
|