浏览代码

Add new option to jitsi-popover

master
Ilya Daynatovich 9 年前
父节点
当前提交
62af73ea09
共有 2 个文件被更改,包括 33 次插入20 次删除
  1. 24
    14
      modules/UI/util/JitsiPopover.js
  2. 9
    6
      modules/UI/videolayout/RemoteVideo.js

+ 24
- 14
modules/UI/util/JitsiPopover.js 查看文件

8
      */
8
      */
9
     function JitsiPopover(element, options)
9
     function JitsiPopover(element, options)
10
     {
10
     {
11
-        this.options = {
12
-            skin: "white",
13
-            content: ""
14
-        };
15
-        if(options)
16
-        {
17
-            if(options.skin)
18
-                this.options.skin = options.skin;
11
+        let { skin, content, hasArrow } = options;
12
+        this.options = {};
13
+        this.options.skin = skin || 'white';
14
+        this.options.content = content || '';
15
+        this.options.hasArrow = true;
19
 
16
 
20
-            if(options.content)
21
-                this.options.content = options.content;
17
+        if (typeof(hasArrow) !== 'undefined') {
18
+            this.options.hasArrow = false;
22
         }
19
         }
23
 
20
 
24
         this.elementIsHovered = false;
21
         this.elementIsHovered = false;
27
 
24
 
28
         element.data("jitsi_popover", this);
25
         element.data("jitsi_popover", this);
29
         this.element = element;
26
         this.element = element;
30
-        this.template = ' <div class="jitsipopover ' + this.options.skin +
31
-            '"><div class="arrow"></div>' +
32
-            '<div class="jitsipopover__content"></div>' +
33
-            '<div class="jitsipopover__menu-padding"></div></div>';
27
+        this.template = this.getTemplate();
34
         var self = this;
28
         var self = this;
35
         this.element.on("mouseenter", function () {
29
         this.element.on("mouseenter", function () {
36
             self.elementIsHovered = true;
30
             self.elementIsHovered = true;
43
         });
37
         });
44
     }
38
     }
45
 
39
 
40
+    /**
41
+     * Returns template for popover
42
+     */
43
+    JitsiPopover.prototype.getTemplate = function () {
44
+        let arrow = '';
45
+        if (this.options.hasArrow) {
46
+            arrow = '<div class="arrow"></div>';
47
+        }
48
+        return  (
49
+            `<div class="jitsipopover ${this.options.skin}">
50
+                ${arrow}
51
+                <div class="jitsipopover__content"></div>
52
+            <div class="jitsipopover__menu-padding"></div></div>`
53
+        );
54
+    };
55
+
46
     /**
56
     /**
47
      * Shows the popover
57
      * Shows the popover
48
      */
58
      */

+ 9
- 6
modules/UI/videolayout/RemoteVideo.js 查看文件

22
     this.emitter = emitter;
22
     this.emitter = emitter;
23
     this.videoSpanId = `participant_${this.id}`;
23
     this.videoSpanId = `participant_${this.id}`;
24
     SmallVideo.call(this, VideoLayout);
24
     SmallVideo.call(this, VideoLayout);
25
-    this.hasRemoteVideoMenu = false;
25
+    this.hasRemoteVideoMenu = true;
26
     this.addRemoteVideoContainer();
26
     this.addRemoteVideoContainer();
27
     this.connectionIndicator = new ConnectionIndicator(this, this.id);
27
     this.connectionIndicator = new ConnectionIndicator(this, this.id);
28
     this.setDisplayName();
28
     this.setDisplayName();
75
  * to display in the popup
75
  * to display in the popup
76
  */
76
  */
77
 RemoteVideo.prototype._initPopupMenu = function (popupMenuElement) {
77
 RemoteVideo.prototype._initPopupMenu = function (popupMenuElement) {
78
-    this.popover = new JitsiPopover(
79
-        $("#" + this.videoSpanId + " .remotevideomenu"),
80
-        {   content: popupMenuElement.outerHTML,
81
-            skin: "black"});
78
+    let options = {
79
+        content: popupMenuElement.outerHTML,
80
+        skin: "black",
81
+        hasArrow: false
82
+    };
83
+    let element = $("#" + this.videoSpanId + " .remotevideomenu");
84
+    this.popover = new JitsiPopover(element, options);
82
 
85
 
83
     // override popover show method to make sure we will update the content
86
     // override popover show method to make sure we will update the content
84
     // before showing the popover
87
     // before showing the popover
85
-    var origShowFunc = this.popover.show;
88
+    let origShowFunc = this.popover.show;
86
     this.popover.show = function () {
89
     this.popover.show = function () {
87
         // update content by forcing it, to finish even if popover
90
         // update content by forcing it, to finish even if popover
88
         // is not visible
91
         // is not visible

正在加载...
取消
保存