2015-07-08 18:22:39 +03:00
|
|
|
function Slidy(page) {
|
|
|
|
this.page = page;
|
2015-07-02 19:21:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Slidy.prototype = {
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
getName: function () {
|
2015-07-02 19:21:56 +03:00
|
|
|
return "HTML Slidy";
|
|
|
|
},
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
isActive: function () {
|
|
|
|
return this.page.evaluate(function () {
|
2015-07-08 18:22:39 +03:00
|
|
|
return typeof w3c_slidy === "object";
|
|
|
|
});
|
2015-07-02 19:21:56 +03:00
|
|
|
},
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
configure: function () {
|
|
|
|
this.page.evaluate(function () {
|
2015-07-08 18:22:39 +03:00
|
|
|
w3c_slidy.hide_toolbar();
|
|
|
|
w3c_slidy.initial_prompt.style.visibility = "hidden";
|
|
|
|
});
|
2015-07-02 19:21:56 +03:00
|
|
|
},
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
slideCount: function () {
|
|
|
|
return this.page.evaluate(function () {
|
|
|
|
return w3c_slidy.slides.length + Array.prototype.slice.call(document.querySelectorAll(".incremental")).reduce(function (incrementals, parent) {
|
2015-07-08 18:22:39 +03:00
|
|
|
var children = parent.querySelectorAll("*");
|
|
|
|
return incrementals + (children.length == 0 ? 1 : children.length);
|
|
|
|
}, 0);
|
|
|
|
});
|
2015-07-02 19:21:56 +03:00
|
|
|
},
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
hasNextSlide: function () {
|
|
|
|
return this.page.evaluate(function () {
|
2015-07-08 18:22:39 +03:00
|
|
|
return w3c_slidy.slide_number + 1 < w3c_slidy.slides.length;
|
|
|
|
});
|
2015-07-02 19:21:56 +03:00
|
|
|
},
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
nextSlide: function () {
|
|
|
|
this.page.evaluate(function () {
|
2015-07-08 18:22:39 +03:00
|
|
|
w3c_slidy.next_slide(true);
|
|
|
|
});
|
2015-07-02 19:21:56 +03:00
|
|
|
},
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
currentSlideIndex: function () {
|
|
|
|
return this.page.evaluate(function () {
|
2015-07-08 18:22:39 +03:00
|
|
|
return "(" + (w3c_slidy.slide_number + 1) + ")";
|
|
|
|
});
|
2015-07-02 19:21:56 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
exports.create = function (page) {
|
2015-07-08 18:22:39 +03:00
|
|
|
return new Slidy(page);
|
|
|
|
};
|