|
@@ -1,5 +1,8 @@
|
1
|
1
|
var Etherpad = (function (my) {
|
2
|
2
|
var etherpadName = null;
|
|
3
|
+ var etherpadIFrame = null;
|
|
4
|
+ var domain = null;
|
|
5
|
+ var options = "?showControls=true&showChat=false&showLineNumbers=true&useMonospaceFont=false";
|
3
|
6
|
|
4
|
7
|
/**
|
5
|
8
|
* Initializes the etherpad.
|
|
@@ -8,6 +11,8 @@ var Etherpad = (function (my) {
|
8
|
11
|
|
9
|
12
|
if (config.etherpad_base && !etherpadName) {
|
10
|
13
|
|
|
14
|
+ domain = config.etherpad_base;
|
|
15
|
+
|
11
|
16
|
if (!name) {
|
12
|
17
|
// In case we're the focus we generate the name.
|
13
|
18
|
etherpadName = Math.random().toString(36).substring(7) + '_' + (new Date().getTime()).toString();
|
|
@@ -15,21 +20,8 @@ var Etherpad = (function (my) {
|
15
|
20
|
}
|
16
|
21
|
else
|
17
|
22
|
etherpadName = name;
|
18
|
|
-
|
19
|
|
- this.domain = config.etherpad_base;
|
20
|
|
- this.options = "?showControls=true&showChat=false&showLineNumbers=true&useMonospaceFont=false";
|
21
|
23
|
|
22
|
24
|
createEtherpadButton();
|
23
|
|
-
|
24
|
|
- this.iframe = document.createElement('iframe');
|
25
|
|
- this.iframe.src = this.domain + etherpadName + this.options;
|
26
|
|
- this.iframe.frameBorder = 0;
|
27
|
|
- this.iframe.scrolling = "no";
|
28
|
|
- this.iframe.width = $('#largeVideoContainer').width() || 640;
|
29
|
|
- this.iframe.height = $('#largeVideoContainer').height() || 480;
|
30
|
|
- this.iframe.setAttribute('style', 'visibility: hidden;');
|
31
|
|
-
|
32
|
|
- document.getElementById('etherpad').appendChild(this.iframe);
|
33
|
25
|
}
|
34
|
26
|
}
|
35
|
27
|
|
|
@@ -37,6 +29,10 @@ var Etherpad = (function (my) {
|
37
|
29
|
* Opens/hides the Etherpad.
|
38
|
30
|
*/
|
39
|
31
|
my.toggleEtherpad = function (isPresentation) {
|
|
32
|
+ if (!etherpadIFrame)
|
|
33
|
+ createIFrame();
|
|
34
|
+
|
|
35
|
+ // TODO FIX large video and prezi toggling. Too many calls from different places.
|
40
|
36
|
var largeVideo = null;
|
41
|
37
|
if (isPresentationVisible())
|
42
|
38
|
largeVideo = $('#presentation>iframe');
|
|
@@ -102,6 +98,22 @@ var Etherpad = (function (my) {
|
102
|
98
|
toolbar.insertBefore(separator, button);
|
103
|
99
|
}
|
104
|
100
|
|
|
101
|
+ /**
|
|
102
|
+ * Creates the IFrame for the etherpad.
|
|
103
|
+ */
|
|
104
|
+ function createIFrame() {
|
|
105
|
+ etherpadIFrame = document.createElement('iframe');
|
|
106
|
+ etherpadIFrame.src = domain + etherpadName + options;
|
|
107
|
+ console.log("ETHER PAD URL", etherpadIFrame.src);
|
|
108
|
+ etherpadIFrame.frameBorder = 0;
|
|
109
|
+ etherpadIFrame.scrolling = "no";
|
|
110
|
+ etherpadIFrame.width = $('#largeVideoContainer').width() || 640;
|
|
111
|
+ etherpadIFrame.height = $('#largeVideoContainer').height() || 480;
|
|
112
|
+ etherpadIFrame.setAttribute('style', 'visibility: hidden;');
|
|
113
|
+
|
|
114
|
+ document.getElementById('etherpad').appendChild(etherpadIFrame);
|
|
115
|
+ }
|
|
116
|
+
|
105
|
117
|
/**
|
106
|
118
|
* On Etherpad added to muc.
|
107
|
119
|
*/
|
|
@@ -128,7 +140,7 @@ var Etherpad = (function (my) {
|
128
|
140
|
if (!config.etherpad_base)
|
129
|
141
|
return;
|
130
|
142
|
|
131
|
|
- if ($('#etherpad>iframe').css('visibility') != 'hidden')
|
|
143
|
+ if (etherpadIFrame && etherpadIFrame.style.visibility != 'hidden')
|
132
|
144
|
Etherpad.toggleEtherpad(isPresentation);
|
133
|
145
|
});
|
134
|
146
|
|