瀏覽代碼

Merge pull request #598 from damencho/minimize-document-modifications

Minimize document modifications on every presence
master
bgrozev 9 年之前
父節點
當前提交
26443b6d72

+ 3
- 1
modules/UI/side_pannels/contactlist/ContactList.js 查看文件

@@ -153,12 +153,14 @@ var ContactList = {
153 153
     },
154 154
 
155 155
     onDisplayNameChange (id, displayName) {
156
+        if(!displayName)
157
+            return;
156 158
         if (id === 'localVideoContainer') {
157 159
             id = APP.conference.localId;
158 160
         }
159 161
         let contactName = $(`#contacts #${id}>p`);
160 162
 
161
-        if (displayName) {
163
+        if (contactName.text() !== displayName) {
162 164
             contactName.text(displayName);
163 165
         }
164 166
     },

+ 22
- 6
modules/UI/videolayout/ConnectionIndicator.js 查看文件

@@ -270,6 +270,17 @@ ConnectionIndicator.prototype.create = function () {
270 270
             APP.translation.translateString("connectionindicator.na") + "</div>",
271 271
             skin: "black"});
272 272
 
273
+    // override popover show method to make sure we will update the content
274
+    // before showing the popover
275
+    var origShowFunc = this.popover.show;
276
+    this.popover.show = function () {
277
+        // update content by forcing it, to finish even if popover
278
+        // is not visible
279
+        this.updatePopoverData(true);
280
+        // call the original show, passing its actual this
281
+        origShowFunc.call(this.popover);
282
+    }.bind(this);
283
+
273 284
     this.emptyIcon = this.connectionIndicatorContainer.appendChild(
274 285
         createIcon(["connection", "connection_empty"]));
275 286
     this.fullIcon = this.connectionIndicatorContainer.appendChild(
@@ -335,13 +346,18 @@ ConnectionIndicator.prototype.updateResolution = function (resolution) {
335 346
 };
336 347
 
337 348
 /**
338
- * Updates the content of the popover
349
+ * Updates the content of the popover if its visible
350
+ * @param force to work even if popover is not visible
339 351
  */
340
-ConnectionIndicator.prototype.updatePopoverData = function () {
341
-    this.popover.updateContent(
342
-        `<div class="connection_info">${this.generateText()}</div>`
343
-    );
344
-    APP.translation.translateElement($(".connection_info"));
352
+ConnectionIndicator.prototype.updatePopoverData = function (force) {
353
+    // generate content, translate it and add it to document only if
354
+    // popover is visible or we force to do so.
355
+    if(this.popover.popoverShown || force) {
356
+        this.popover.updateContent(
357
+            `<div class="connection_info">${this.generateText()}</div>`
358
+        );
359
+        APP.translation.translateElement($(".connection_info"));
360
+    }
345 361
 };
346 362
 
347 363
 /**

+ 3
- 1
modules/UI/videolayout/RemoteVideo.js 查看文件

@@ -357,7 +357,9 @@ RemoteVideo.prototype.setDisplayName = function(displayName, key) {
357 357
     // If we already have a display name for this video.
358 358
     if (nameSpan.length > 0) {
359 359
         if (displayName && displayName.length > 0) {
360
-            $('#' + this.videoSpanId + '_name').text(displayName);
360
+            var displaynameSpan = $('#' + this.videoSpanId + '_name');
361
+            if (displaynameSpan.text() !== displayName)
362
+                displaynameSpan.text(displayName);
361 363
         }
362 364
         else if (key && key.length > 0) {
363 365
             var nameHtml = APP.translation.generateTranslationHTML(key);

Loading…
取消
儲存