浏览代码

Moves recording button related code to toolbar.js.

j8
Boris Grozev 11 年前
父节点
当前提交
05975e30a3
共有 2 个文件被更改,包括 25 次插入18 次删除
  1. 6
    18
      app.js
  2. 19
    0
      toolbar.js

+ 6
- 18
app.js 查看文件

@@ -636,7 +636,7 @@ $(document).bind('joined.muc', function (event, jid, info) {
636 636
             focus.setEndpointDisplayName(connection.emuc.myroomjid,
637 637
                                          nickname);
638 638
         }
639
-        showRecordingButton(false);
639
+        Toolbar.showRecordingButton(false);
640 640
     }
641 641
 
642 642
     if (focus && config.etherpad_base) {
@@ -668,7 +668,7 @@ $(document).bind('entered.muc', function (event, jid, info, pres) {
668 668
         if (focus.confid === null) {
669 669
             console.log('make new conference with', jid);
670 670
             focus.makeConference(Object.keys(connection.emuc.members));
671
-            showRecordingButton(true);
671
+            Toolbar.showRecordingButton(true);
672 672
         } else {
673 673
             console.log('invite', jid, 'into conference');
674 674
             focus.addNewParticipant(jid);
@@ -721,7 +721,7 @@ $(document).bind('left.muc', function (event, jid) {
721 721
 
722 722
         if (Object.keys(connection.emuc.members).length > 0) {
723 723
             focus.makeConference(Object.keys(connection.emuc.members));
724
-            showRecordingButton(true);
724
+            Toolbar.showRecordingButton(true);
725 725
         }
726 726
         $(document).trigger('focusechanged.muc', [focus]);
727 727
     }
@@ -735,7 +735,7 @@ $(document).bind('left.muc', function (event, jid) {
735 735
             focus.setEndpointDisplayName(connection.emuc.myroomjid,
736 736
                                          nickname);
737 737
         }
738
-        showRecordingButton(false);
738
+        Toolbar.showRecordingButton(false);
739 739
     }
740 740
     if (connection.emuc.getPrezi(jid)) {
741 741
         $(document).trigger('presentationremoved.muc',
@@ -943,14 +943,14 @@ function toggleRecording() {
943 943
     }
944 944
 
945 945
     var oldState = focus.recordingEnabled;
946
-    $('#recordButton').toggleClass('active');
946
+    Toolbar.toggleRecordingButtonState();
947 947
     focus.setRecording(!oldState,
948 948
                         recordingToken,
949 949
                         function (state) {
950 950
                             console.log("New recording state: ", state);
951 951
                             if (state == oldState) //failed to change, reset the token because it might have been wrong
952 952
                             {
953
-                                $('#recordButton').toggleClass('active');
953
+                                Toolbar.toggleRecordingButtonState();
954 954
                                 setRecordingToken(null);
955 955
                             }
956 956
                         }
@@ -1263,19 +1263,7 @@ function setView(viewName) {
1263 1263
 //    }
1264 1264
 }
1265 1265
 
1266
-function showRecordingButton(show) {
1267
-    if (!config.enableRecording) {
1268
-        return;
1269
-    }
1270
-
1271
-    if (show) {
1272
-        $('#recording').css({display: "inline"});
1273
-    }
1274
-    else {
1275
-        $('#recording').css({display: "none"});
1276
-    }
1277 1266
 
1278
-}
1279 1267
 
1280 1268
 $(document).bind('fatalError.jingle',
1281 1269
     function (event, session, error)

+ 19
- 0
toolbar.js 查看文件

@@ -284,5 +284,24 @@ var Toolbar = (function (my) {
284 284
         }
285 285
     };
286 286
 
287
+    // Shows or hides the 'recording' button.
288
+    my.showRecordingButton = function (show) {
289
+        if (!config.enableRecording) {
290
+            return;
291
+        }
292
+
293
+        if (show) {
294
+            $('#recording').css({display: "inline"});
295
+        }
296
+        else {
297
+            $('#recording').css({display: "none"});
298
+        }
299
+    };
300
+
301
+    // Toggle the state of the recording button
302
+    my.toggleRecordingButtonState = function() {
303
+        $('#recordButton').toggleClass('active');
304
+    };
305
+
287 306
     return my;
288 307
 }(Toolbar || {}));

正在加载...
取消
保存