aboutsummaryrefslogtreecommitdiff
path: root/point/control/layout.js
diff options
context:
space:
mode:
Diffstat (limited to 'point/control/layout.js')
-rw-r--r--point/control/layout.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/point/control/layout.js b/point/control/layout.js
new file mode 100644
index 0000000..84a55ff
--- /dev/null
+++ b/point/control/layout.js
@@ -0,0 +1,61 @@
1/*
2 * This file is part of "What's The Point" <https://github.com/Pacien/WhatsThePoint>
3 * Copyright (C) 2014 Pacien TRAN-GIRARD
4 *
5 * "What's The Point" is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * "What's The Point" is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19define(["control/control"], function (control) {
20
21 var layout = {
22
23 init: function () {
24 this.screen = document.getElementsByTagName("p-screen")[0];
25 this.bindEvent();
26 },
27
28 CLASS: {
29 SLIDES: "slides",
30 NODES: "notes",
31 },
32
33 reset: function () {
34 for (var className in this.CLASS) {
35 this.screen.classList.remove(this.CLASS[className]);
36 }
37 },
38
39 show: function (element) {
40 this.reset();
41 switch (element) {
42 case control.SHOW.SLIDES:
43 this.screen.classList.add("slides");
44 break;
45
46 case control.SHOW.NOTES:
47 this.screen.classList.add("notes");
48 break;
49 }
50 },
51
52 bindEvent: function () {
53 control.bindEvent(control.EVENT.SHOW, function (showEvent) {
54 layout.show(showEvent.detail);
55 });
56 },
57 };
58
59 return layout;
60
61});