aboutsummaryrefslogtreecommitdiff
path: root/point/control
diff options
context:
space:
mode:
Diffstat (limited to 'point/control')
-rw-r--r--point/control/control.js83
-rw-r--r--point/control/fullscreen.js68
-rw-r--r--point/control/layout.js61
-rw-r--r--point/control/network.js58
-rw-r--r--point/control/slide.js86
5 files changed, 356 insertions, 0 deletions
diff --git a/point/control/control.js b/point/control/control.js
new file mode 100644
index 0000000..4ec21da
--- /dev/null
+++ b/point/control/control.js
@@ -0,0 +1,83 @@
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(function () {
20
21 var control = {
22
23 MODE: {
24 MASTER: "master",
25 SLAVE: "slave",
26 FREE: "free",
27 },
28
29 EVENT: {
30 GOTO: "goTo",
31 SLIDE: "slide",
32 SHOW: "show",
33 TOGGLE: "toggle",
34 TRIGGER: "trigger",
35 },
36
37 SLIDE: {
38
39 },
40
41 GOTO: {
42 PREVIOUS_SLIDE: "previousSlide",
43 NEXT_SLIDE: "nextSlide",
44 FIRST_SLIDE: "firstSlide",
45 LAST_SLIDE: "lastSlide",
46 },
47
48 SHOW: {
49 SLIDES: "slides",
50 NOTES: "notes",
51 },
52
53 TOGGLE: {
54 FULLSCREEN: "fullscreen",
55 },
56
57 TRIGGER: {
58
59 },
60
61 init: function () {
62 return;
63 },
64
65 dispatchEvent: function (eventType, eventDetail, forward) {
66 return document.dispatchEvent(new CustomEvent(eventType, {
67 "detail": {
68 "detail": eventDetail,
69 "forward": forward !== undefined ? forward : true,
70 },
71 }));
72 },
73
74 bindEvent: function (eventType, eventListener) {
75 document.addEventListener(eventType, function (event) {
76 eventListener(event.detail);
77 });
78 },
79 };
80
81 return control;
82
83});
diff --git a/point/control/fullscreen.js b/point/control/fullscreen.js
new file mode 100644
index 0000000..6e53bc4
--- /dev/null
+++ b/point/control/fullscreen.js
@@ -0,0 +1,68 @@
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 fullscreen = {
22
23 init: function () {
24 this.bindEvent();
25 },
26
27 toggleFullscreen: function () {
28 // from
29 // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode#Toggling_fullscreenController_mode
30 if (!document.fullscreenControllerElement && // alternative
31 // standard method
32 !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) {// current
33 // working
34 // methods
35 if (document.documentElement.requestFullscreen) {
36 document.documentElement.requestFullscreen();
37 } else if (document.documentElement.msRequestFullscreen) {
38 document.documentElement.msRequestFullscreen();
39 } else if (document.documentElement.mozRequestFullScreen) {
40 document.documentElement.mozRequestFullScreen();
41 } else if (document.documentElement.webkitRequestFullscreen) {
42 document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
43 }
44 } else {
45 if (document.exitFullscreen) {
46 document.exitFullscreen();
47 } else if (document.msExitFullscreen) {
48 document.msExitFullscreen();
49 } else if (document.mozCancelFullScreen) {
50 document.mozCancelFullScreen();
51 } else if (document.webkitExitFullscreen) {
52 document.webkitExitFullscreen();
53 }
54 }
55 },
56
57 bindEvent: function () {
58 control.bindEvent(control.EVENT.TOGGLE, function (toggleEvent) {
59 if (toggleEvent.detail === control.TOGGLE.FULLSCREEN) {
60 fullscreen.toggleFullscreen();
61 }
62 });
63 },
64 };
65
66 return fullscreen;
67
68});
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});
diff --git a/point/control/network.js b/point/control/network.js
new file mode 100644
index 0000000..e782257
--- /dev/null
+++ b/point/control/network.js
@@ -0,0 +1,58 @@
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 *