decktape/plugins/dzslides.js

35 lines
715 B
JavaScript
Raw Normal View History

2017-08-21 01:43:32 +03:00
exports.create = page => new DZSlides(page);
class DZSlides {
constructor(page) {
this.page = page;
2017-08-21 01:43:32 +03:00
}
getName() {
return 'DZ Slides';
}
isActive() {
return this.page.evaluate(_ => typeof Dz !== 'undefined');
}
2015-05-28 17:38:43 +03:00
2017-08-21 01:43:32 +03:00
slideCount() {
return this.page.evaluate(_ =>
Dz.slides.reduce((count, slide) => count + slide.$$('.incremental > *').length + 1, 0));
}
hasNextSlide() {
return this.page.evaluate(_ => !(Dz.idx == Dz.slides.length
&& Dz.step == Dz.slides[Dz.idx - 1].$$('.incremental > *').length));
}
nextSlide() {
return this.page.evaluate(_ => Dz.forward());
}
currentSlideIndex() {
return this.page.evaluate(_ => Dz.idx + '.' + Dz.step);
}
}