Browse Source

Fix comparison warnings.

master
Boris Grozev 9 years ago
parent
commit
09eaa0d303

+ 2
- 3
modules/RTC/DataChannels.js View File

@@ -171,14 +171,13 @@ function onSelectedEndpointChanged(userResource) {
171 171
 
172 172
 function onPinnedEndpointChanged(userResource) {
173 173
     console.log('pinned endpoint changed: ', userResource);
174
-    if (_dataChannels && _dataChannels.length != 0) {
174
+    if (_dataChannels && _dataChannels.length !== 0) {
175 175
         _dataChannels.some(function (dataChannel) {
176 176
             if (dataChannel.readyState == 'open') {
177 177
                 dataChannel.send(JSON.stringify({
178 178
                     'colibriClass': 'PinnedEndpointChangedEvent',
179 179
                     'pinnedEndpoint':
180
-                        (!userResource || userResource == null)?
181
-                            null : userResource
180
+                        userResource ? userResource : null
182 181
                 }));
183 182
 
184 183
                 return true;

+ 1
- 1
modules/RTC/RTC.js View File

@@ -101,7 +101,7 @@ var RTC = {
101 101
         // check the video muted state from last stored presence if any
102 102
         var muted = false;
103 103
         var pres = APP.xmpp.getLastPresence(jid);
104
-        if(pres != null && pres.videoMuted) {
104
+        if (pres && pres.videoMuted) {
105 105
             muted = pres.videoMuted;
106 106
         }
107 107
 

+ 2
- 2
modules/RTC/RTCUtils.js View File

@@ -13,7 +13,7 @@ function getPreviousResolution(resolution) {
13 13
     var resName = null;
14 14
     for(var i in Resolutions) {
15 15
         var tmp = Resolutions[i];
16
-        if(res == null || (res.order < tmp.order && tmp.order < order)) {
16
+        if (!res || (res.order < tmp.order && tmp.order < order)) {
17 17
             resName = i;
18 18
             res = tmp;
19 19
         }
@@ -455,7 +455,7 @@ RTCUtils.prototype.errorCallback = function (error) {
455 455
             error.name == "OverconstrainedError") &&
456 456
         (error.constraintName == "minWidth" || error.constraintName == "maxWidth" ||
457 457
             error.constraintName == "minHeight" || error.constraintName == "maxHeight")
458
-        && resolution != null)
458
+        && resolution)
459 459
     {
460 460
         self.getUserMediaWithConstraints(['audio', 'video'],
461 461
             function (stream) {

+ 1
- 1
modules/UI/UI.js View File

@@ -755,7 +755,7 @@ UI.showLoginPopup = function(callback) {
755 755
         "dialog.Ok",
756 756
         function (e, v, m, f) {
757 757
             if (v) {
758
-                if (f.username !== null && f.password != null) {
758
+                if (f.username && f.password) {
759 759
                     callback(f.username, f.password);
760 760
                 }
761 761
             }

+ 1
- 1
modules/UI/audio_levels/AudioLevels.js View File

@@ -126,7 +126,7 @@ var AudioLevels = (function(my) {
126 126
             return;
127 127
 
128 128
         ASDrawContext.clearRect(0, 0, 300, 300);
129
-        if(audioLevel == 0)
129
+        if (!audioLevel)
130 130
             return;
131 131
 
132 132
         ASDrawContext.shadowBlur = getShadowLevel(audioLevel);

+ 1
- 1
modules/UI/prezi/PreziPlayer.js View File

@@ -168,7 +168,7 @@
168 168
             }
169 169
             // jump to animation steps by calling flyToNextStep()
170 170
             function doAnimationSteps() {
171
-                if (obj.values.isMoving == true) {
171
+                if (obj.values.isMoving) {
172 172
                     setTimeout(doAnimationSteps, 100); // wait until the flight ends
173 173
                     return;
174 174
                 }

+ 1
- 1
modules/UI/videolayout/ConnectionIndicator.js View File

@@ -86,7 +86,7 @@ ConnectionIndicator.prototype.generateText = function () {
86 86
     }
87 87
 
88 88
     var resolutionValue = null;
89
-    if(this.resolution && this.jid != null) {
89
+    if(this.resolution && this.jid) {
90 90
         var keys = Object.keys(this.resolution);
91 91
         for(var ssrc in this.resolution) {
92 92
             resolutionValue = this.resolution[ssrc];

+ 2
- 4
modules/UI/videolayout/RemoteVideo.js View File

@@ -2,8 +2,6 @@
2 2
 var ConnectionIndicator = require("./ConnectionIndicator");
3 3
 var SmallVideo = require("./SmallVideo");
4 4
 var AudioLevels = require("../audio_levels/AudioLevels");
5
-var LargeVideo = require("./LargeVideo");
6
-var Avatar = require("../avatar/Avatar");
7 5
 var RTCBrowserType = require("../../RTC/RTCBrowserType");
8 6
 var UIUtils = require("../util/UIUtil");
9 7
 
@@ -84,10 +82,10 @@ if (!interfaceConfig.filmStripOnly) {
84 82
 
85 83
         var self = this;
86 84
         muteLinkItem.onclick = function(){
87
-            if ($(this).attr('disabled') != undefined) {
85
+            if ($(this).attr('disabled')) {
88 86
                 event.preventDefault();
89 87
             }
90
-            var isMute = self.isMuted == true;
88
+            var isMute = !!self.isMuted;
91 89
             APP.xmpp.setMute(self.peerJid, !isMute);
92 90
 
93 91
             popupmenuElement.setAttribute('style', 'display:none;');

+ 2
- 2
modules/UI/videolayout/SmallVideo.js View File

@@ -171,7 +171,7 @@ SmallVideo.prototype.showAudioIndicator = function(isMuted) {
171 171
         }
172 172
     }
173 173
     else {
174
-        if(audioMutedSpan.length == 0 ) {
174
+        if (!audioMutedSpan.length) {
175 175
             audioMutedSpan = document.createElement('span');
176 176
             audioMutedSpan.className = 'audioMuted';
177 177
             UIUtil.setTooltip(audioMutedSpan,
@@ -204,7 +204,7 @@ SmallVideo.prototype.showVideoIndicator = function(isMuted) {
204 204
         }
205 205
     }
206 206
     else {
207
-        if(videoMutedSpan.length == 0) {
207
+        if (!videoMutedSpan.length) {
208 208
             videoMutedSpan = document.createElement('span');
209 209
             videoMutedSpan.className = 'videoMuted';
210 210
 

+ 1
- 1
modules/UI/videolayout/VideoLayout.js View File

@@ -49,7 +49,7 @@ var VideoLayout = (function (my) {
49 49
     my.isInLastN = function(resource) {
50 50
         return lastNCount < 0 || // lastN is disabled
51 51
              // lastNEndpoints cache not built yet
52
-            (lastNCount > 0 && lastNEndpointsCache.length == 0) ||
52
+            (lastNCount > 0 && !lastNEndpointsCache.length) ||
53 53
             (lastNEndpointsCache &&
54 54
                 lastNEndpointsCache.indexOf(resource) !== -1);
55 55
     };

+ 2
- 2
modules/connectionquality/connectionquality.js View File

@@ -87,7 +87,7 @@ var ConnectionQuality = {
87 87
     updateLocalStats: function (data) {
88 88
         stats = data;
89 89
         eventEmitter.emit(CQEvents.LOCALSTATS_UPDATED, 100 - stats.packetLoss.total, stats);
90
-        if (sendIntervalId == null) {
90
+        if (!sendIntervalId) {
91 91
             startSendingStats();
92 92
         }
93 93
     },
@@ -98,7 +98,7 @@ var ConnectionQuality = {
98 98
      * @param data the statistics
99 99
      */
100 100
     updateRemoteStats: function (jid, data) {
101
-        if (data == null || data.packetLoss_total == null) {
101
+        if (!data || !data.packetLoss_total) {
102 102
             eventEmitter.emit(CQEvents.REMOTESTATS_UPDATED, jid, null, null);
103 103
             return;
104 104
         }

+ 3
- 3
modules/xmpp/JingleSessionPC.js View File

@@ -844,7 +844,7 @@ JingleSessionPC.prototype.addSource = function (elem, fromJid) {
844 844
                 return this.getAttribute('ssrc');
845 845
             }).get();
846 846
 
847
-            if (ssrcs.length != 0) {
847
+            if (!ssrcs.length) {
848 848
                 lines += 'a=ssrc-group:' + semantics + ' ' + ssrcs.join(' ') + '\r\n';
849 849
             }
850 850
         });
@@ -923,7 +923,7 @@ JingleSessionPC.prototype.removeSource = function (elem, fromJid) {
923 923
                 return this.getAttribute('ssrc');
924 924
             }).get();
925 925
 
926
-            if (ssrcs.length != 0) {
926
+            if (ssrcs.length) {
927 927
                 lines += 'a=ssrc-group:' + semantics + ' ' + ssrcs.join(' ') + '\r\n';
928 928
             }
929 929
         });
@@ -1328,7 +1328,7 @@ JingleSessionPC.prototype.setLocalDescription = function () {
1328 1328
     var session = transform.parse(this.peerconnection.localDescription.sdp);
1329 1329
     session.media.forEach(function (media) {
1330 1330
 
1331
-        if (media.ssrcs != null && media.ssrcs.length > 0) {
1331
+        if (media.ssrcs && media.ssrcs.length > 0) {
1332 1332
             // TODO(gp) maybe exclude FID streams?
1333 1333
             media.ssrcs.forEach(function (ssrc) {
1334 1334
                 if (ssrc.attribute !== 'cname') {

+ 3
- 3
modules/xmpp/SDP.js View File

@@ -45,7 +45,7 @@ SDP.prototype.getMediaSsrcMap = function() {
45 45
         tmp.forEach(function(line){
46 46
             var semantics = line.substr(0, idx).substr(13);
47 47
             var ssrcs = line.substr(14 + semantics.length).split(' ');
48
-            if (ssrcs.length != 0) {
48
+            if (ssrcs.length) {
49 49
                 media.ssrcGroups.push({
50 50
                     semantics: semantics,
51 51
                     ssrcs: ssrcs
@@ -266,7 +266,7 @@ SDP.prototype.toJingle = function (elem, thecreator, ssrcs) {
266 266
                     idx = line.indexOf(' ');
267 267
                     var semantics = line.substr(0, idx).substr(13);
268 268
                     var ssrcs = line.substr(14 + semantics.length).split(' ');
269
-                    if (ssrcs.length != 0) {
269
+                    if (ssrcs.length) {
270 270
                         elem.c('ssrc-group', { semantics: semantics, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
271 271
                         ssrcs.forEach(function(ssrc) {
272 272
                             elem.c('source', { ssrc: ssrc })
@@ -597,7 +597,7 @@ SDP.prototype.jingle2media = function (content) {
597 597
             return this.getAttribute('ssrc');
598 598
         }).get();
599 599
 
600
-        if (ssrcs.length != 0) {
600
+        if (ssrcs.length) {
601 601
             media += 'a=ssrc-group:' + semantics + ' ' + ssrcs.join(' ') + '\r\n';
602 602
         }
603 603
     });

+ 1
- 1
modules/xmpp/SDPDiffer.js View File

@@ -143,7 +143,7 @@ SDPDiffer.prototype.toJingle = function(modify) {
143 143
 
144 144
         // generate source groups from lines
145 145
         media.ssrcGroups.forEach(function(ssrcGroup) {
146
-            if (ssrcGroup.ssrcs.length != 0) {
146
+            if (ssrcGroup.ssrcs.length) {
147 147
 
148 148
                 modify.c('ssrc-group', {
149 149
                     semantics: ssrcGroup.semantics,

+ 1
- 1
modules/xmpp/TraceablePeerConnection.js View File

@@ -179,7 +179,7 @@ var normalizePlanB = function(desc) {
179 179
                 for (i = 0; i<mLine.ssrcs.length; i++){
180 180
                     if (typeof mLine.ssrcs[i] === 'object'
181 181
                         && typeof mLine.ssrcs[i].id !== 'undefined'
182
-                        && $.inArray(mLine.ssrcs[i].id, firstSsrcs) == 0) {
182
+                        && !$.inArray(mLine.ssrcs[i].id, firstSsrcs)) {
183 183
                         newSsrcLines.push(mLine.ssrcs[i]);
184 184
                         delete mLine.ssrcs[i];
185 185
                     }

+ 1
- 1
modules/xmpp/recording.js View File

@@ -84,7 +84,7 @@ function setRecordingColibri(state, token, callback, connection) {
84 84
             recordingEnabled = newState;
85 85
             callback(newState);
86 86
 
87
-            if (newState === 'pending' && recordingStateChangeCallback == null) {
87
+            if (newState === 'pending' && !recordingStateChangeCallback) {
88 88
                 recordingStateChangeCallback = callback;
89 89
                 connection.addHandler(function(iq){
90 90
                     var state = $(iq).find('recording').attr('state');

Loading…
Cancel
Save