Browse Source

Creates the etherpad iframe once the button is clicked. Tries to improve prezi stability by encreasing the init interval.

j8
Yana Stamcheva 11 years ago
parent
commit
92a6959e1c
4 changed files with 34 additions and 18 deletions
  1. 4
    0
      css/main.css
  2. 26
    14
      etherpad.js
  3. 3
    3
      index.html
  4. 1
    1
      libs/prezi_player.js

+ 4
- 0
css/main.css View File

@@ -31,6 +31,10 @@ html, body{
31 31
     height: 100%;
32 32
 }
33 33
 
34
+#etherpad {
35
+    z-index: 0;
36
+}
37
+
34 38
 .videocontainer>span {
35 39
     display: none; /* enable when you want nicks to be shown */
36 40
     position: absolute;

+ 26
- 14
etherpad.js View File

@@ -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
 

+ 3
- 3
index.html View File

@@ -8,17 +8,17 @@
8 8
     <script src="muc.js?v=6"></script><!-- simple MUC library -->
9 9
     <script src="estos_log.js?v=2"></script><!-- simple stanza logger -->
10 10
     <script src="app.js?v=20"></script><!-- application logic -->
11
-    <script src="etherpad.js?v=1"></script><!-- etherpad plugin -->
11
+    <script src="etherpad.js?v=2"></script><!-- etherpad plugin -->
12 12
     <script src="smileys.js?v=1"></script><!-- smiley images -->
13 13
     <script src="replacement.js?v=5"></script><!-- link and smiley replacement -->
14 14
     <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
15
-    <link rel="stylesheet" type="text/css" media="screen" href="css/main.css?v=16"/>
15
+    <link rel="stylesheet" type="text/css" media="screen" href="css/main.css?v=17"/>
16 16
     <link rel="stylesheet" href="css/jquery-impromptu.css?v=4">
17 17
     <link rel="stylesheet" href="css/modaldialog.css?v=3">
18 18
     <script src="libs/jquery-impromptu.js"></script>
19 19
     <script src="libs/jquery.autosize.js"></script>
20 20
     <script src="config.js"></script><!-- adapt to your needs, i.e. set hosts and bosh path -->
21
-    <script src="libs/prezi_player.js"></script>
21
+    <script src="libs/prezi_player.js?v=2"></script>
22 22
   </head>
23 23
   <body>
24 24
     <div id="header">

+ 1
- 1
libs/prezi_player.js View File

@@ -94,7 +94,7 @@
94 94
 
95 95
             this.initPollInterval = setInterval(function(){
96 96
                 _this.sendMessage({'action': 'init'});
97
-            }, 200);
97
+            }, 500);
98 98
             PreziPlayer.players[id] = this;
99 99
         }
100 100
 

Loading…
Cancel
Save