Browse Source

Add presentation events to "appData".

pull/176/head
Joachim Bauch 10 years ago
parent
commit
140de65563
  1. 16
      static/js/directives/presentation.js
  2. 10
      static/js/services/appdata.js

16
static/js/directives/presentation.js

@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
"use strict";
define(['jquery', 'underscore', 'text!partials/presentation.html', 'bigscreen'], function($, _, template, BigScreen) {
return ["$window", "mediaStream", "fileUpload", "fileDownload", "alertify", "translation", "randomGen", "fileData", function($window, mediaStream, fileUpload, fileDownload, alertify, translation, randomGen, fileData) {
return ["$window", "mediaStream", "fileUpload", "fileDownload", "alertify", "translation", "randomGen", "fileData", "appData", function($window, mediaStream, fileUpload, fileDownload, alertify, translation, randomGen, fileData, appData) {
var SUPPORTED_TYPES = {
// rendered by pdfcanvas directive
@ -743,8 +743,10 @@ define(['jquery', 'underscore', 'text!partials/presentation.html', 'bigscreen'], @@ -743,8 +743,10 @@ define(['jquery', 'underscore', 'text!partials/presentation.html', 'bigscreen'],
$scope.$watch("layout.presentation", function(newval, oldval) {
if (newval && !oldval) {
$scope.showPresentation();
appData.e.triggerHandler("presentationEnabled", [true]);
} else if (!newval && oldval) {
$scope.hidePresentation();
appData.e.triggerHandler("presentationEnabled", [false]);
}
});
@ -754,6 +756,18 @@ define(['jquery', 'underscore', 'text!partials/presentation.html', 'bigscreen'], @@ -754,6 +756,18 @@ define(['jquery', 'underscore', 'text!partials/presentation.html', 'bigscreen'],
}
});
$scope.$watch("currentPresentation", function(newval, oldval) {
if (oldval !== newval) {
appData.e.triggerHandler("presentationSelected", [newval]);
}
});
$scope.$watch("currentPageNumber", function(newval, oldval) {
if (oldval !== newval) {
appData.e.triggerHandler("presentationPageChanged", [newval]);
}
});
}];
var compile = function(tElement, tAttr) {

10
static/js/services/appdata.js

@ -48,6 +48,16 @@ define(["jquery"], function($) { @@ -48,6 +48,16 @@ define(["jquery"], function($) {
// loaded (bool) : True if something was loaded, else false.
// user_settings (map) : User map which was loaded.
//
// - presentationEnabled(event, enabled)
// enabled (bool) : True if presentation mode is enabled, else false.
//
// - presentationSelected(event, presentation)
// presentation (object) : Currently active presentation, `null` if none
// is active.
//
// - presentationPageChanged(event, page)
// page (number) : Currently active page in the presentation.
//
// Other appData properties:
//
// - language (string) : ISO language code of active language.

Loading…
Cancel
Save