mirror of
https://github.com/YunoHost/doc.git
synced 2024-09-03 20:06:26 +02:00
28 lines
No EOL
983 B
JavaScript
28 lines
No EOL
983 B
JavaScript
/**
|
|
* Register and broadcast events between windows. If admin, post events, otherwise handle them.
|
|
*/
|
|
var bc = new BroadcastChannel('grav-presentation');
|
|
window.addEventListener("load", function (event) {
|
|
if (findGetParameter('admin') == 'true') {
|
|
Reveal.addEventListener('slidechanged', function (event) {
|
|
if (presentationAPIAuth == 'true') {
|
|
if (findGetParameter('token') !== presentationAuthToken) {
|
|
return;
|
|
}
|
|
}
|
|
var now = new Date();
|
|
console.info('Action at ' + ISODateString(now) + ', slidechanged');
|
|
bc.postMessage({
|
|
indexh: event.indexh,
|
|
indexv: event.indexv,
|
|
indexf: typeof event.indexf !== 'undefined' ? event.indexf : 0
|
|
});
|
|
});
|
|
} else {
|
|
bc.onmessage = function (event) {
|
|
var now = new Date();
|
|
console.info('Action at ' + ISODateString(now) + ', slidechanged');
|
|
Reveal.slide(event.data.indexh, event.data.indexv, event.data.indexf);
|
|
}
|
|
}
|
|
}, false); |