2015-07-08 18:22:39 +03:00
|
|
|
function Impress(page) {
|
|
|
|
this.page = page;
|
2015-06-29 23:56:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Impress.prototype = {
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
getName: function () {
|
2016-02-22 12:43:33 +03:00
|
|
|
return 'Impress JS';
|
2015-06-29 23:56:32 +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
|
|
|
if (typeof impress === 'function')
|
2015-07-08 18:22:39 +03:00
|
|
|
return true;
|
2015-06-30 17:18:19 +03:00
|
|
|
|
2016-02-22 12:43:33 +03:00
|
|
|
if (document.getElementById('impress'))
|
|
|
|
console.log('Impress JS plugin isn\'t compatible with impress.js version < 0.3.0');
|
2015-06-30 17:18:19 +03:00
|
|
|
|
2015-07-08 18:22:39 +03:00
|
|
|
return false;
|
|
|
|
});
|
2015-06-29 23:56:32 +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 document.querySelectorAll('#impress .step, #impress .substep').length;
|
2015-07-08 18:22:39 +03:00
|
|
|
});
|
2015-06-29 23:56:32 +03:00
|
|
|
},
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
nextSlide: function () {
|
|
|
|
this.page.evaluate(function () {
|
2015-07-08 18:22:39 +03:00
|
|
|
impress().next();
|
|
|
|
});
|
2015-06-29 23:56:32 +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 window.location.hash.replace(/^#\/?/, '');
|
2015-07-08 18:22:39 +03:00
|
|
|
});
|
2015-06-29 23:56:32 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-08-09 19:02:49 +03:00
|
|
|
exports.create = function (page) {
|
2015-07-08 18:22:39 +03:00
|
|
|
return new Impress(page);
|
|
|
|
};
|