2015-07-08 18:22:39 +03:00
|
|
|
function Reveal(page) {
|
|
|
|
this.page = page;
|
2015-05-29 00:35:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Reveal.prototype = {
|
|
|
|
|
2015-05-29 14:22:00 +03:00
|
|
|
getName : function() {
|
|
|
|
return "Reveal JS";
|
|
|
|
},
|
|
|
|
|
|
|
|
isActive : function() {
|
2015-07-09 19:19:26 +03:00
|
|
|
return this.page.evaluate(function() {
|
2015-07-08 18:22:39 +03:00
|
|
|
if (typeof Reveal === "undefined")
|
|
|
|
return false;
|
2015-06-03 12:14:04 +03:00
|
|
|
|
2015-07-08 18:22:39 +03:00
|
|
|
if (!(typeof Reveal.isLastSlide === "function")) {
|
|
|
|
console.log("Reveal JS plugin isn't compatible with reveal.js version < 2.3.0");
|
|
|
|
return false;
|
|
|
|
}
|
2015-06-03 12:14:04 +03:00
|
|
|
|
2015-07-08 18:22:39 +03:00
|
|
|
return true;
|
|
|
|
});
|
2015-05-29 14:22:00 +03:00
|
|
|
},
|
|
|
|
|
2015-05-29 00:35:06 +03:00
|
|
|
configure : function() {
|
2015-07-09 19:19:26 +03:00
|
|
|
this.page.evaluate(function() {
|
2015-07-08 18:22:39 +03:00
|
|
|
Reveal.configure({controls: false, progress: false});
|
|
|
|
});
|
2015-05-29 00:35:06 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
slideCount : function() {
|
2015-07-09 19:19:26 +03:00
|
|
|
return this.page.evaluate(function() {
|
2015-07-08 18:22:39 +03:00
|
|
|
// TODO: the getTotalSlides API does not report the number of slides accurately as it does not take stacks and some index-less fragments into account
|
|
|
|
// getTotalSlides API is only available starting reveal.js version 3.0.0
|
|
|
|
return typeof Reveal.getTotalSlides === "function" ? Reveal.getTotalSlides() : undefined;
|
|
|
|
});
|
2015-05-29 00:35:06 +03:00
|
|
|
},
|
|
|
|
|
2015-05-29 14:22:00 +03:00
|
|
|
hasNextSlide : function() {
|
2015-07-09 19:19:26 +03:00
|
|
|
return this.page.evaluate(function() {
|
2015-07-08 18:22:39 +03:00
|
|
|
return !Reveal.isLastSlide();
|
|
|
|
});
|
2015-05-29 00:35:06 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
nextSlide : function() {
|
2015-07-09 19:19:26 +03:00
|
|
|
this.page.evaluate(function() {
|
2015-07-08 18:22:39 +03:00
|
|
|
Reveal.next();
|
|
|
|
});
|
2015-05-29 00:35:06 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
currentSlideIndex : function() {
|
2015-07-09 19:19:26 +03:00
|
|
|
return this.page.evaluate(function() {
|
2015-07-08 18:22:39 +03:00
|
|
|
var indices = Reveal.getIndices();
|
|
|
|
var id = Reveal.getCurrentSlide().getAttribute("id");
|
|
|
|
if (typeof id === "string" && id.length)
|
|
|
|
return '/' + id;
|
|
|
|
else
|
|
|
|
return '/' + indices.h + (indices.v > 0 ? '/' + indices.v : '');
|
|
|
|
});
|
2015-05-29 00:35:06 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-07-08 18:22:39 +03:00
|
|
|
exports.create = function(page) {
|
|
|
|
return new Reveal(page);
|
|
|
|
};
|