Преглед изворни кода

Allow for a list of enabled buttons to be passed as part of interfaceConfig

j8
Issac Gerges пре 9 година
родитељ
комит
bcccc58b2c

+ 1
- 1
index.html Прегледај датотеку

@@ -20,7 +20,7 @@
20 20
     <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
21 21
     <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
22 22
     <script src="interface_config.js?v=5"></script>
23
-    <script src="libs/app.bundle.js?v=133"></script>
23
+    <script src="libs/app.bundle.js?v=138"></script>
24 24
     <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
25 25
     <link rel="stylesheet" href="css/font.css?v=7"/>
26 26
     <link rel="stylesheet" href="css/toastr.css?v=1">

+ 2
- 0
interface_config.js Прегледај датотеку

@@ -16,6 +16,8 @@ var interfaceConfig = {
16 16
     APP_NAME: "Jitsi Meet",
17 17
     INVITATION_POWERED_BY: true,
18 18
     ACTIVE_SPEAKER_AVATAR_SIZE: 100,
19
+    TOOLBAR_BUTTONS: ['authentication', 'microphone', 'camera', 'desktop', 'record', 'security', 'invite',
20
+        'chat', 'prezi', 'etherpad', 'fullscreen', 'sip', 'dialpad', 'settings', 'hangup', 'filmstrip', 'contacts'],
19 21
     /**
20 22
      * Whether to only show the filmstrip (and hide the toolbar).
21 23
      */

+ 19663
- 19596
libs/app.bundle.js
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 11
- 0
modules/UI/toolbars/BottomToolbar.js Прегледај датотеку

@@ -1,5 +1,6 @@
1 1
 /* global $ */
2 2
 var PanelToggler = require("../side_pannels/SidePanelToggler");
3
+var UIUtil = require("../util/UIUtil");
3 4
 
4 5
 var buttonHandlers = {
5 6
     "bottom_toolbar_contact_list": function () {
@@ -13,8 +14,18 @@ var buttonHandlers = {
13 14
     }
14 15
 };
15 16
 
17
+
18
+var defaultBottomToolbarButtons = {
19
+    'chat': '#bottom_toolbar_chat',
20
+    'contacts': '#bottom_toolbar_contact_list',
21
+    'filmstrip': '#bottom_toolbar_film_strip'
22
+};
23
+
24
+
16 25
 var BottomToolbar = (function (my) {
17 26
     my.init = function () {
27
+        UIUtil.hideDisabledButtons(defaultBottomToolbarButtons);
28
+
18 29
         for(var k in buttonHandlers)
19 30
             $("#" + k).click(buttonHandlers[k]);
20 31
     };

+ 23
- 12
modules/UI/toolbars/Toolbar.js Прегледај датотеку

@@ -87,6 +87,19 @@ var buttonHandlers = {
87 87
             });
88 88
     }
89 89
 };
90
+var defaultToolbarButtons = {
91
+    'microphone': '#toolbar_button_mute',
92
+    'camera': '#toolbar_button_camera',
93
+    'desktop': '#toolbar_button_desktopsharing',
94
+    'security': '#toolbar_button_security',
95
+    'invite': '#toolbar_button_link',
96
+    'chat': '#toolbar_button_chat',
97
+    'prezi': '#toolbar_button_prezi',
98
+    'ethherpad': '#toolbar_button_etherpad',
99
+    'fullscreen': '#toolbar_button_fullScreen',
100
+    'settings': '#toolbar_button_settings',
101
+    'hangup': '#toolbar_button_hangup'
102
+};
90 103
 
91 104
 function hangup() {
92 105
     APP.xmpp.disposeConference();
@@ -255,6 +268,8 @@ function callSipButtonClicked() {
255 268
 var Toolbar = (function (my) {
256 269
 
257 270
     my.init = function (ui) {
271
+        UIUtil.hideDisabledButtons(defaultToolbarButtons);
272
+
258 273
         for(var k in buttonHandlers)
259 274
             $("#" + k).click(buttonHandlers[k]);
260 275
         UI = ui;
@@ -339,7 +354,7 @@ var Toolbar = (function (my) {
339 354
      * Disables and enables some of the buttons.
340 355
      */
341 356
     my.setupButtonsFromConfig = function () {
342
-        if (config.disablePrezi) {
357
+        if (UIUtil.isButtonEnabled('prezi')) {
343 358
             $("#toolbar_button_prezi").css({display: "none"});
344 359
         }
345 360
     };
@@ -531,7 +546,7 @@ var Toolbar = (function (my) {
531 546
      * @param show <tt>true</tt> to show or <tt>false</tt> to hide
532 547
      */
533 548
     my.showAuthenticateButton = function (show) {
534
-        if (show) {
549
+        if (UIUtil.isButtonEnabled('authentication') && show) {
535 550
             $('#authentication').css({display: "inline"});
536 551
         }
537 552
         else {
@@ -541,11 +556,7 @@ var Toolbar = (function (my) {
541 556
 
542 557
     // Shows or hides the 'recording' button.
543 558
     my.showRecordingButton = function (show) {
544
-        if (!config.enableRecording) {
545
-            return;
546
-        }
547
-
548
-        if (show) {
559
+        if (UIUtil.isButtonEnabled('recording') && show) {
549 560
             $('#toolbar_button_record').css({display: "inline-block"});
550 561
         }
551 562
         else {
@@ -597,14 +608,14 @@ var Toolbar = (function (my) {
597 608
 
598 609
     // checks whether recording is enabled and whether we have params to start automatically recording
599 610
     my.checkAutoRecord = function () {
600
-        if (config.enableRecording && config.autoRecord) {
611
+        if (UIUtil.isButtonEnabled('recording') && config.autoRecord) {
601 612
             toggleRecording(config.autoRecordToken);
602 613
         }
603 614
     }
604 615
 
605 616
     // Shows or hides SIP calls button
606 617
     my.showSipCallButton = function (show) {
607
-        if (APP.xmpp.isSipGatewayEnabled() && show) {
618
+        if (APP.xmpp.isSipGatewayEnabled() && UIUtil.isButtonEnabled('sip') && show) {
608 619
             $('#toolbar_button_sip').css({display: "inline-block"});
609 620
         } else {
610 621
             $('#toolbar_button_sip').css({display: "none"});
@@ -613,7 +624,7 @@ var Toolbar = (function (my) {
613 624
 
614 625
     // Shows or hides the dialpad button
615 626
     my.showDialPadButton = function (show) {
616
-        if (show) {
627
+        if (UIUtil.isButtonEnabled('dialpad') && show) {
617 628
             $('#toolbar_button_dialpad').css({display: "inline-block"});
618 629
         } else {
619 630
             $('#toolbar_button_dialpad').css({display: "none"});
@@ -639,7 +650,7 @@ var Toolbar = (function (my) {
639 650
      * @param show <tt>true</tt> to show
640 651
      */
641 652
     my.showLoginButton = function (show) {
642
-        if (show) {
653
+        if (UIUtil.isButtonEnabled('authentication') && show) {
643 654
             $('#toolbar_button_login').css({display: "list-item"});
644 655
         } else {
645 656
             $('#toolbar_button_login').css({display: "none"});
@@ -651,7 +662,7 @@ var Toolbar = (function (my) {
651 662
      * @param show <tt>true</tt> to show
652 663
      */
653 664
     my.showLogoutButton = function (show) {
654
-        if (show) {
665
+        if (UIUtil.isButtonEnabled('authentication') && show) {
655 666
             $('#toolbar_button_logout').css({display: "list-item"});
656 667
         } else {
657 668
             $('#toolbar_button_logout').css({display: "none"});

+ 3
- 2
modules/UI/toolbars/ToolbarToggler.js Прегледај датотеку

@@ -2,10 +2,11 @@
2 2
  DesktopStreaming.showDesktopSharingButton */
3 3
 
4 4
 var toolbarTimeoutObject,
5
-    toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
5
+    toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT,
6
+    UIUtil = require("../util/UIUtil");
6 7
 
7 8
 function showDesktopSharingButton() {
8
-    if (APP.desktopsharing.isDesktopSharingEnabled()) {
9
+    if (APP.desktopsharing.isDesktopSharingEnabled() && UIUtil.isButtonEnabled('desktop')) {
9 10
         $('#toolbar_button_desktopsharing').css({display: "inline-block"});
10 11
     } else {
11 12
         $('#toolbar_button_desktopsharing').css({display: "none"});

+ 20
- 2
modules/UI/util/UIUtil.js Прегледај датотеку

@@ -1,8 +1,8 @@
1
-/* global $ */
1
+/* global $, config, interfaceConfig */
2 2
 /**
3 3
  * Created by hristo on 12/22/14.
4 4
  */
5
-module.exports = {
5
+var UIUtil = module.exports = {
6 6
     /**
7 7
      * Returns the available video width.
8 8
      */
@@ -92,5 +92,23 @@ module.exports = {
92 92
         } else {
93 93
             container.appendChild(newChild);
94 94
         }
95
+    },
96
+
97
+    isButtonEnabled: function (name) {
98
+        var isEnabled = interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1;
99
+        if (name === 'prezi') {
100
+            return isEnabled && !config.disablePrezi;
101
+        } else if (name === 'recording') {
102
+            return isEnabled && config.enableRecording;
103
+        }
104
+        return isEnabled;
105
+    },
106
+
107
+    hideDisabledButtons: function (mappings) {
108
+        var selector = Object.keys(mappings)
109
+          .map(function (buttonName) { return UIUtil.isButtonEnabled(buttonName) ? null : mappings[buttonName]; })
110
+          .filter(function (item) { return item; })
111
+          .join(',');
112
+        $(selector).hide();
95 113
     }
96 114
 };

Loading…
Откажи
Сачувај