Quellcode durchsuchen

Add new option to jitsi-popover

master
Ilya Daynatovich vor 9 Jahren
Ursprung
Commit
62af73ea09
2 geänderte Dateien mit 33 neuen und 20 gelöschten Zeilen
  1. 24
    14
      modules/UI/util/JitsiPopover.js
  2. 9
    6
      modules/UI/videolayout/RemoteVideo.js

+ 24
- 14
modules/UI/util/JitsiPopover.js Datei anzeigen

@@ -8,17 +8,14 @@ var JitsiPopover = (function () {
8 8
      */
9 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 21
         this.elementIsHovered = false;
@@ -27,10 +24,7 @@ var JitsiPopover = (function () {
27 24
 
28 25
         element.data("jitsi_popover", this);
29 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 28
         var self = this;
35 29
         this.element.on("mouseenter", function () {
36 30
             self.elementIsHovered = true;
@@ -43,6 +37,22 @@ var JitsiPopover = (function () {
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 57
      * Shows the popover
48 58
      */

+ 9
- 6
modules/UI/videolayout/RemoteVideo.js Datei anzeigen

@@ -22,7 +22,7 @@ function RemoteVideo(user, VideoLayout, emitter) {
22 22
     this.emitter = emitter;
23 23
     this.videoSpanId = `participant_${this.id}`;
24 24
     SmallVideo.call(this, VideoLayout);
25
-    this.hasRemoteVideoMenu = false;
25
+    this.hasRemoteVideoMenu = true;
26 26
     this.addRemoteVideoContainer();
27 27
     this.connectionIndicator = new ConnectionIndicator(this, this.id);
28 28
     this.setDisplayName();
@@ -75,14 +75,17 @@ RemoteVideo.prototype.addRemoteVideoContainer = function() {
75 75
  * to display in the popup
76 76
  */
77 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 86
     // override popover show method to make sure we will update the content
84 87
     // before showing the popover
85
-    var origShowFunc = this.popover.show;
88
+    let origShowFunc = this.popover.show;
86 89
     this.popover.show = function () {
87 90
         // update content by forcing it, to finish even if popover
88 91
         // is not visible

Laden…
Abbrechen
Speichern