forked from astefanutti/decktape
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslidy.js
54 lines (45 loc) · 1.39 KB
/
slidy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
function Slidy(page) {
this.page = page;
}
Slidy.prototype = {
getName: function () {
return 'Slidy';
},
isActive: function () {
return this.page.evaluate(function () {
return typeof w3c_slidy === 'object';
});
},
configure: function () {
this.page.evaluate(function () {
w3c_slidy.hide_toolbar();
w3c_slidy.initial_prompt.style.visibility = 'hidden';
});
},
slideCount: function () {
return this.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 this.page.evaluate(function () {
return w3c_slidy.slide_number + 1 < w3c_slidy.slides.length;
});
},
nextSlide: function () {
this.page.evaluate(function () {
w3c_slidy.next_slide(true);
});
},
currentSlideIndex: function () {
return this.page.evaluate(function () {
return '(' + (w3c_slidy.slide_number + 1) + ')';
});
}
};
exports.create = function (page) {
return new Slidy(page);
};