content/hifi-content/thoys/production/vivexPresentation/powerpointESS.js
2022-02-14 02:04:11 +01:00

43 lines
1.2 KiB
JavaScript

(function() {
var NUMBER_OF_SLIDES = 14;
var URL_PREFIX = 'http://cdn.highfidelity.com/vivexPresentation/';
var URL_POSTFIX = '.jpg';
var PRESENTATION_CHANNEL = 'presentationChannel';
var currentSlide = 0;
var _entityID = null;
function setSlide() {
Entities.editEntity('{e9187d56-72b3-435f-9cbb-96dd2709a295}', {
sourceUrl: URL_PREFIX + currentSlide + URL_POSTFIX
});
}
function next() {
currentSlide = (currentSlide + 1) % NUMBER_OF_SLIDES;
setSlide();
}
function previous() {
currentSlide = (currentSlide + NUMBER_OF_SLIDES - 1) % NUMBER_OF_SLIDES;
setSlide();
}
function onMessage(channel, message, sender) {
if (channel === PRESENTATION_CHANNEL) {
if (message === 'next') {
next();
} else if (message === 'previous') {
previous();
}
}
}
this.preload = function(entityID) {
_entityID = entityID;
Messages.messageReceived.connect(onMessage);
Messages.subscribe(PRESENTATION_CHANNEL);
setSlide();
print('initialized presentation');
};
})