decktape/plugins/slidy.js

42 lines
960 B
JavaScript
Raw Normal View History

2017-08-21 01:43:32 +03:00
exports.create = page => new Slidy(page);
class Slidy {
constructor(page) {
this.page = page;
2017-08-21 01:43:32 +03:00
}
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) + ')');
}
2015-07-02 19:21:56 +03:00
}