ソースを参照

ref(SmallVideo): adds avatar selector

j8
paweldomas 8年前
コミット
4722054c3e
1個のファイルの変更18行の追加8行の削除
  1. 18
    8
      modules/UI/videolayout/SmallVideo.js

+ 18
- 8
modules/UI/videolayout/SmallVideo.js ファイルの表示

@@ -337,6 +337,16 @@ SmallVideo.prototype.selectVideoElement = function () {
337 337
     return $(RTCUIHelper.findVideoElement($('#' + this.videoSpanId)[0]));
338 338
 };
339 339
 
340
+/**
341
+ * Selects the HTML image element which displays user's avatar.
342
+ *
343
+ * @return {jQuery|HTMLElement} a jQuery selector pointing to the HTML image
344
+ * element which displays the user's avatar.
345
+ */
346
+SmallVideo.prototype.$avatar = function () {
347
+    return $('#' + this.videoSpanId + ' .userAvatar');
348
+};
349
+
340 350
 /**
341 351
  * Enables / disables the css responsible for focusing/pinning a video
342 352
  * thumbnail.
@@ -380,7 +390,7 @@ SmallVideo.prototype.updateView = function () {
380 390
 
381 391
     let video = this.selectVideoElement();
382 392
 
383
-    let avatar = $('#' + this.videoSpanId + ' .userAvatar');
393
+    let avatar = this.$avatar;
384 394
 
385 395
     var isCurrentlyOnLarge = this.VideoLayout.isCurrentlyOnLarge(this.id);
386 396
 
@@ -406,18 +416,18 @@ SmallVideo.prototype.updateView = function () {
406 416
 
407 417
 SmallVideo.prototype.avatarChanged = function (avatarUrl) {
408 418
     var thumbnail = $('#' + this.videoSpanId);
409
-    var avatar = $('#' + this.videoSpanId + ' .userAvatar');
419
+    var avatarSel = this.$avatar();
410 420
     this.hasAvatar = true;
411 421
 
412 422
     // set the avatar in the thumbnail
413
-    if (avatar && avatar.length > 0) {
414
-        avatar[0].src = avatarUrl;
423
+    if (avatarSel && avatarSel.length > 0) {
424
+        avatarSel[0].src = avatarUrl;
415 425
     } else {
416 426
         if (thumbnail && thumbnail.length > 0) {
417
-            avatar = document.createElement('img');
418
-            avatar.className = 'userAvatar';
419
-            avatar.src = avatarUrl;
420
-            thumbnail.append(avatar);
427
+            var avatarElement = document.createElement('img');
428
+            avatarElement.className = 'userAvatar';
429
+            avatarElement.src = avatarUrl;
430
+            thumbnail.append(avatarElement);
421 431
         }
422 432
     }
423 433
 };

読み込み中…
キャンセル
保存