瀏覽代碼

Merge branch 'm-voloshin-FIX-frozen-tooltips'

master
hristoterezov 8 年之前
父節點
當前提交
d2ccd20c78
共有 1 個檔案被更改,包括 37 行新增32 行删除
  1. 37
    32
      modules/UI/videolayout/SmallVideo.js

+ 37
- 32
modules/UI/videolayout/SmallVideo.js 查看文件

519
         return;
519
         return;
520
     }
520
     }
521
 
521
 
522
-    var indicatorSpanId = "dominantspeakerindicator";
523
-    var indicatorSpan = this.getIndicatorSpan(indicatorSpanId);
522
+    var indicatorSpan = this.getIndicatorSpan({
523
+        id: 'dominantspeakerindicator',
524
+        content: '<i id="indicatoricon" class="fa fa-bullhorn"></i>',
525
+        tooltip: 'speaker'
526
+    });
524
 
527
 
525
-    indicatorSpan.innerHTML
526
-        = "<i id='indicatoricon' class='fa fa-bullhorn'></i>";
527
-    // adds a tooltip
528
-    UIUtil.setTooltip(indicatorSpan, "speaker", "top");
529
-    APP.translation.translateElement($(indicatorSpan));
530
-
531
-    $(indicatorSpan).css("visibility", show ? "visible" : "hidden");
528
+    indicatorSpan.style.display = show ? "" : "none";
532
 };
529
 };
533
 
530
 
534
 /**
531
 /**
542
         return;
539
         return;
543
     }
540
     }
544
 
541
 
545
-    var indicatorSpanId = "raisehandindicator";
546
-    var indicatorSpan = this.getIndicatorSpan(indicatorSpanId);
547
-
548
-    indicatorSpan.innerHTML
549
-        = "<i id='indicatoricon' class='icon-raised-hand'></i>";
550
-
551
-    // adds a tooltip
552
-    UIUtil.setTooltip(indicatorSpan, "raisedHand", "top");
553
-    APP.translation.translateElement($(indicatorSpan));
542
+    var indicatorSpan = this.getIndicatorSpan({
543
+        id: 'raisehandindicator',
544
+        content: '<i id="indicatoricon" class="icon-raised-hand"></i>',
545
+        tooltip: 'raisedHand'
546
+    });
554
 
547
 
555
-    $(indicatorSpan).css("visibility", show ? "visible" : "hidden");
548
+    indicatorSpan.style.display = show ? "" : "none";
556
 };
549
 };
557
 
550
 
558
 /**
551
 /**
559
- * Gets (creating if necessary) the "indicator" span for this SmallVideo
560
-  identified by an ID.
552
+ * Gets (creating if necessary) the "indicator" span for this SmallVideo.
553
+ *
554
+ * @param options.id {String} element ID
555
+ * @param options.content {String} HTML content of the indicator
556
+ * @param options.tooltip {String} The key that should be passed to tooltip
557
+ *
558
+ * @returns {HTMLElement} DOM represention of the indicator
561
  */
559
  */
562
-SmallVideo.prototype.getIndicatorSpan = function(id) {
563
-    var indicatorSpan;
564
-    var spans = $(`#${this.videoSpanId}>[id=${id}`);
565
-    if (spans.length <= 0) {
566
-        indicatorSpan = document.createElement('span');
567
-        indicatorSpan.id = id;
568
-        indicatorSpan.className = "indicator";
569
-        $('#' + this.videoSpanId)[0].appendChild(indicatorSpan);
570
-    } else {
571
-        indicatorSpan = spans[0];
560
+SmallVideo.prototype.getIndicatorSpan = function(options) {
561
+    var indicator = this.container.querySelector('#' + options.id);
562
+
563
+    if (indicator) {
564
+        return indicator;
572
     }
565
     }
573
-    return indicatorSpan;
566
+
567
+    indicator = document.createElement('span');
568
+    indicator.className = 'indicator';
569
+    indicator.id = options.id;
570
+
571
+    indicator.innerHTML = options.content;
572
+
573
+    UIUtil.setTooltip(indicator, options.tooltip, "top");
574
+    APP.translation.translateElement($(indicator));
575
+
576
+    this.container.appendChild(indicator);
577
+
578
+    return indicator;
574
 };
579
 };
575
 
580
 
576
 /**
581
 /**

Loading…
取消
儲存