mirror of
https://github.com/astefanutti/decktape.git
synced 2025-01-05 21:23:15 +03:00
Add Shower 2.x plugin
This commit is contained in:
parent
455d48fb44
commit
328e443818
@ -5,12 +5,12 @@ function Shower(page) {
|
||||
Shower.prototype = {
|
||||
|
||||
getName: function () {
|
||||
return 'Shower';
|
||||
return 'Shower 1.x';
|
||||
},
|
||||
|
||||
isActive: function () {
|
||||
return this.page.evaluate(function () {
|
||||
return typeof shower === 'object';
|
||||
return typeof shower === 'object' && typeof shower.modules === 'undefined';
|
||||
});
|
||||
},
|
||||
|
64
plugins/shower-2.x.js
Normal file
64
plugins/shower-2.x.js
Normal file
@ -0,0 +1,64 @@
|
||||
function Shower(page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
Shower.prototype = {
|
||||
|
||||
getName: function () {
|
||||
return 'Shower 2.x';
|
||||
},
|
||||
|
||||
isActive: function () {
|
||||
return this.page.evaluate(function () {
|
||||
return typeof shower === 'object' && typeof shower.modules === 'object';
|
||||
});
|
||||
},
|
||||
|
||||
configure: function () {
|
||||
var resolved;
|
||||
var promise = new Promise(function (fulfill) {
|
||||
resolved = fulfill;
|
||||
});
|
||||
this.page.onCallback = function () {
|
||||
resolved();
|
||||
};
|
||||
this.page.evaluate(function () {
|
||||
shower.modules.require(['shower.global'], function (sh) {
|
||||
window.decktape = {};
|
||||
decktape.shower = sh.getInited()[0];
|
||||
decktape.shower.container.enterSlideMode();
|
||||
window.callPhantom();
|
||||
});
|
||||
});
|
||||
return promise;
|
||||
},
|
||||
|
||||
slideCount: function () {
|
||||
// FIXME: this does not take fragments into account which ideally should be deactivated
|
||||
return this.page.evaluate(function () {
|
||||
return decktape.shower.getSlidesCount();
|
||||
});
|
||||
},
|
||||
|
||||
hasNextSlide: function () {
|
||||
return this.page.evaluate(function () {
|
||||
return decktape.shower.player.getCurrentSlideIndex() + 1 < decktape.shower.getSlidesCount();
|
||||
});
|
||||
},
|
||||
|
||||
nextSlide: function () {
|
||||
this.page.evaluate(function () {
|
||||
decktape.shower.player.next();
|
||||
});
|
||||
},
|
||||
|
||||
currentSlideIndex: function () {
|
||||
return this.page.evaluate(function () {
|
||||
return decktape.shower.player.getCurrentSlideIndex() + 1;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.create = function (page) {
|
||||
return new Shower(page);
|
||||
};
|
Loading…
Reference in New Issue
Block a user