2015-07-08 18:22:39 +03:00
|
|
|
function Deck(page) {
|
|
|
|
this.page = page;
|
2015-07-01 12:20:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Deck.prototype = {
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
getName: function () {
|
2016-02-22 12:43:33 +03:00
|
|
|
return 'Deck JS';
|
2015-07-01 12:20:48 +03:00
|
|
|
},
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
isActive: function () {
|
|
|
|
return this.page.evaluate(function () {
|
2016-02-22 12:43:33 +03:00
|
|
|
return typeof $ === 'function' && typeof $.deck === 'function';
|
2015-07-08 18:22:39 +03:00
|
|
|
});
|
2015-07-01 12:20:48 +03:00
|
|
|
},
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
slideCount: function () {
|
|
|
|
return this.page.evaluate(function () {
|
2016-02-22 12:43:33 +03:00
|
|
|
return $.deck('getSlides').length;
|
2015-07-08 18:22:39 +03:00
|
|
|
});
|
2015-07-01 12:20:48 +03:00
|
|
|
},
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
nextSlide: function () {
|
|
|
|
this.page.evaluate(function () {
|
2016-02-22 12:43:33 +03:00
|
|
|
$.deck('next');
|
2015-07-08 18:22:39 +03:00
|
|
|
});
|
2015-07-01 12:20:48 +03:00
|
|
|
},
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
currentSlideIndex: function () {
|
|
|
|
return this.page.evaluate(function () {
|
2016-02-22 12:43:33 +03:00
|
|
|
return $.deck('getSlide').attr('id');
|
2015-07-08 18:22:39 +03:00
|
|
|
});
|
2015-07-01 12:20:48 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
exports.create = function (page) {
|
2015-07-08 18:22:39 +03:00
|
|
|
return new Deck(page);
|
|
|
|
};
|