mirror of
https://github.com/astefanutti/decktape.git
synced 2025-01-07 06:50:28 +03:00
591e14155b
The generic plugin emulates the end-user interaction by pressing the specified key [--keycode] and iterating over the presentation as long as any change to the DOM is detected by observing mutation events to the body element and its subtree. To support the generic plugin feature, the following enhancements are introduced: - Move to promises based navigation scheduling - Build CLI commands directly from available plugins - Enable per plugin CLI help and options - Enable by-command overriding of the selected plugin
54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
function Slidy(page) {
|
|
this.page = page;
|
|
}
|
|
|
|
Slidy.prototype = {
|
|
|
|
getName : function() {
|
|
return "HTML Slidy";
|
|
},
|
|
|
|
isActive : function() {
|
|
return page.evaluate(function() {
|
|
return typeof w3c_slidy === "object";
|
|
});
|
|
},
|
|
|
|
configure : function () {
|
|
page.evaluate(function() {
|
|
w3c_slidy.hide_toolbar();
|
|
w3c_slidy.initial_prompt.style.visibility = "hidden";
|
|
});
|
|
},
|
|
|
|
slideCount : function() {
|
|
return page.evaluate(function() {
|
|
return w3c_slidy.slides.length + Array.prototype.slice.call(document.querySelectorAll(".incremental")).reduce(function(incrementals, parent) {
|
|
var children = parent.querySelectorAll("*");
|
|
return incrementals + (children.length == 0 ? 1 : children.length);
|
|
}, 0);
|
|
});
|
|
},
|
|
|
|
hasNextSlide : function() {
|
|
return page.evaluate(function() {
|
|
return w3c_slidy.slide_number + 1 < w3c_slidy.slides.length;
|
|
});
|
|
},
|
|
|
|
nextSlide : function() {
|
|
page.evaluate(function() {
|
|
w3c_slidy.next_slide(true);
|
|
});
|
|
},
|
|
|
|
currentSlideIndex : function() {
|
|
return page.evaluate(function() {
|
|
return "(" + (w3c_slidy.slide_number + 1) + ")";
|
|
});
|
|
}
|
|
};
|
|
|
|
exports.create = function(page) {
|
|
return new Slidy(page);
|
|
}; |