Browse Source

[eslint] space-before-blocks

tags/v0.0.2
Lyubo Marinov 8 years ago
parent
commit
f8ab8015a2

+ 1
- 0
.eslintrc.js View File

@@ -157,6 +157,7 @@ module.exports = {
157 157
         'padded-blocks': 0,
158 158
         'quote-props': 0,
159 159
         'semi': [ 'error', 'always' ],
160
+        'space-before-blocks': 2,
160 161
         'space-before-function-paren': [ 'error', 'never' ],
161 162
         'space-in-parens': [ 'error', 'never' ],
162 163
         'space-infix-ops': 2,

+ 9
- 9
JitsiConference.js View File

@@ -388,7 +388,7 @@ JitsiConference.prototype.removeCommand = function(name) {
388 388
  * @param name the display name to set
389 389
  */
390 390
 JitsiConference.prototype.setDisplayName = function(name) {
391
-    if (this.room){
391
+    if (this.room) {
392 392
         // remove previously set nickname
393 393
         this.room.removeFromPresence("nick");
394 394
 
@@ -411,8 +411,8 @@ JitsiConference.prototype.setSubject = function(subject) {
411 411
  * Get a transcriber object for all current participants in this conference
412 412
  * @return {Transcriber} the transcriber object
413 413
  */
414
-JitsiConference.prototype.getTranscriber = function(){
415
-    if (this.transcriber === undefined){
414
+JitsiConference.prototype.getTranscriber = function() {
415
+    if (this.transcriber === undefined) {
416 416
         this.transcriber = new Transcriber();
417 417
         // add all existing local audio tracks to the transcriber
418 418
         const localAudioTracks = this.getLocalTracks(MediaType.AUDIO);
@@ -421,7 +421,7 @@ JitsiConference.prototype.getTranscriber = function(){
421 421
         }
422 422
         // and all remote audio tracks
423 423
         const remoteAudioTracks = this.rtc.getRemoteTracks(MediaType.AUDIO);
424
-        for (const remoteTrack of remoteAudioTracks){
424
+        for (const remoteTrack of remoteAudioTracks) {
425 425
             this.transcriber.addTrack(remoteTrack);
426 426
         }
427 427
     }
@@ -935,7 +935,7 @@ JitsiConference.prototype.onRemoteTrackAdded = function(track) {
935 935
     // Add track to JitsiParticipant.
936 936
     participant._tracks.push(track);
937 937
 
938
-    if (this.transcriber){
938
+    if (this.transcriber) {
939 939
         this.transcriber.addTrack(track);
940 940
     }
941 941
 
@@ -980,7 +980,7 @@ JitsiConference.prototype.onRemoteTrackRemoved = function(removedTrack) {
980 980
                 this.eventEmitter.emit(
981 981
                     JitsiConferenceEvents.TRACK_REMOVED, removedTrack);
982 982
 
983
-                if (this.transcriber){
983
+                if (this.transcriber) {
984 984
                     this.transcriber.removeTrack(removedTrack);
985 985
                 }
986 986
 
@@ -1282,7 +1282,7 @@ JitsiConference.prototype.dial = function(number) {
1282 1282
     if (this.room) {
1283 1283
         return this.room.dial(number);
1284 1284
     }
1285
-    return new Promise(function(resolve, reject){
1285
+    return new Promise(function(resolve, reject) {
1286 1286
         reject(new Error("The conference is not created yet!"));
1287 1287
     });
1288 1288
 };
@@ -1294,7 +1294,7 @@ JitsiConference.prototype.hangup = function() {
1294 1294
     if (this.room) {
1295 1295
         return this.room.hangup();
1296 1296
     }
1297
-    return new Promise(function(resolve, reject){
1297
+    return new Promise(function(resolve, reject) {
1298 1298
         reject(new Error("The conference is not created yet!"));
1299 1299
     });
1300 1300
 };
@@ -1418,7 +1418,7 @@ JitsiConference.prototype.setLocalParticipantProperty = function(name, value) {
1418 1418
  * @param detailedFeedback detailed feedback from the user. Not yet used
1419 1419
  */
1420 1420
 JitsiConference.prototype.sendFeedback =
1421
-function(overallFeedback, detailedFeedback){
1421
+function(overallFeedback, detailedFeedback) {
1422 1422
     this.statistics.sendFeedback(overallFeedback, detailedFeedback);
1423 1423
 };
1424 1424
 

+ 3
- 3
JitsiConferenceEventManager.js View File

@@ -73,12 +73,12 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
73 73
 
74 74
             this.conference.connectionIsInterrupted = false;
75 75
 
76
-            for (key in chatRoom.connectionTimes){
76
+            for (key in chatRoom.connectionTimes) {
77 77
                 value = chatRoom.connectionTimes[key];
78 78
                 Statistics.analytics.sendEvent('conference.' + key,
79 79
                     {value});
80 80
             }
81
-            for (key in chatRoom.xmpp.connectionTimes){
81
+            for (key in chatRoom.xmpp.connectionTimes) {
82 82
                 value = chatRoom.xmpp.connectionTimes[key];
83 83
                 Statistics.analytics.sendEvent('xmpp.' + key,
84 84
                     {value});
@@ -112,7 +112,7 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
112 112
         JitsiConferenceEvents.CONFERENCE_FAILED,
113 113
         JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE);
114 114
     chatRoom.addListener(XMPPEvents.BRIDGE_DOWN,
115
-        function(){
115
+        function() {
116 116
             Statistics.analytics.sendEvent('conference.bridgeDown');
117 117
         });
118 118
 

+ 2
- 2
JitsiMeetJS.js View File

@@ -244,12 +244,12 @@ var LibJitsiMeet = {
244 244
                     for(let i = 0; i < tracks.length; i++) {
245 245
                         const track = tracks[i];
246 246
                         var mStream = track.getOriginalStream();
247
-                        if(track.getType() === MediaType.AUDIO){
247
+                        if(track.getType() === MediaType.AUDIO) {
248 248
                             Statistics.startLocalStats(mStream,
249 249
                                 track.setAudioLevel.bind(track));
250 250
                             track.addEventListener(
251 251
                                 JitsiTrackEvents.LOCAL_TRACK_STOPPED,
252
-                                function(){
252
+                                function() {
253 253
                                     Statistics.stopLocalStats(mStream);
254 254
                                 });
255 255
                         }

+ 6
- 6
doc/example/example.js View File

@@ -19,7 +19,7 @@ var isJoined = false;
19 19
  * Handles local tracks.
20 20
  * @param tracks Array with JitsiTrack objects
21 21
  */
22
-function onLocalTracks(tracks){
22
+function onLocalTracks(tracks) {
23 23
     localTracks = tracks;
24 24
     for(var i = 0; i < localTracks.length; i++) {
25 25
         localTracks[i].addEventListener(JitsiMeetJS.events.track.TRACK_AUDIO_LEVEL_CHANGED,
@@ -114,14 +114,14 @@ function onUserLeft(id) {
114 114
 /**
115 115
  * That function is called when connection is established successfully
116 116
  */
117
-function onConnectionSuccess(){
117
+function onConnectionSuccess() {
118 118
     room = connection.initJitsiConference("conference", confOptions);
119 119
     room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
120 120
     room.on(JitsiMeetJS.events.conference.TRACK_REMOVED, function(track) {
121 121
         console.log("track removed!!!" + track);
122 122
     });
123 123
     room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);
124
-    room.on(JitsiMeetJS.events.conference.USER_JOINED, function(id){
124
+    room.on(JitsiMeetJS.events.conference.USER_JOINED, function(id) {
125 125
         console.log("user join");remoteTracks[id] = [];
126 126
     });
127 127
     room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);
@@ -132,7 +132,7 @@ function onConnectionSuccess(){
132 132
         console.log(userID + " - " + displayName);
133 133
     });
134 134
     room.on(JitsiMeetJS.events.conference.TRACK_AUDIO_LEVEL_CHANGED,
135
-      function(userID, audioLevel){
135
+      function(userID, audioLevel) {
136 136
           console.log(userID + " - " + audioLevel);
137 137
       });
138 138
     room.on(JitsiMeetJS.events.conference.RECORDER_STATE_CHANGED, function() {
@@ -165,7 +165,7 @@ function onDeviceListChanged(devices) {
165 165
 /**
166 166
  * This function is called when we disconnect.
167 167
  */
168
-function disconnect(){
168
+function disconnect() {
169 169
     console.log("disconnect!");
170 170
     connection.removeEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess);
171 171
     connection.removeEventListener(JitsiMeetJS.events.connection.CONNECTION_FAILED, onConnectionFailed);
@@ -239,7 +239,7 @@ var initOptions = {
239 239
     // The URL to the Firefox extension for desktop sharing.
240 240
     desktopSharingFirefoxExtensionURL: null
241 241
 };
242
-JitsiMeetJS.init(initOptions).then(function(){
242
+JitsiMeetJS.init(initOptions).then(function() {
243 243
     connection = new JitsiMeetJS.JitsiConnection(null, null, options);
244 244
 
245 245
     connection.addEventListener(JitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, onConnectionSuccess);

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

@@ -168,7 +168,7 @@ DataChannels.prototype.onDataChannel = function(event) {
168 168
  * Closes all currently opened data channels.
169 169
  */
170 170
 DataChannels.prototype.closeAllChannels = function() {
171
-    this._dataChannels.forEach(function(dc){
171
+    this._dataChannels.forEach(function(dc) {
172 172
         // the DC will be removed from the array on 'onclose' event
173 173
         dc.close();
174 174
     });

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

@@ -448,7 +448,7 @@ JitsiLocalTrack.prototype.dispose = function() {
448 448
     var self = this;
449 449
     var promise = Promise.resolve();
450 450
 
451
-    if (this.conference){
451
+    if (this.conference) {
452 452
         promise = this.conference.removeTrack(this);
453 453
     }
454 454
 
@@ -562,7 +562,7 @@ JitsiLocalTrack.prototype._setByteSent = function(bytesSent) {
562 562
         = this.conference ? this.conference.getConnectionState() : null;
563 563
     if(this._testByteSent && "connected" === iceConnectionState) {
564 564
         setTimeout(function() {
565
-            if(this._bytesSent <= 0){
565
+            if(this._bytesSent <= 0) {
566 566
                 // we are not receiving anything from the microphone
567 567
                 this._fireNoDataFromSourceEvent();
568 568
             }

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

@@ -67,7 +67,7 @@ function addMediaStreamInactiveHandler(mediaStream, handler) {
67 67
  * @param ssrc the SSRC of this track if known
68 68
  */
69 69
 function JitsiTrack(conference, stream, track, streamInactiveHandler, trackMediaType,
70
-                    videoType, ssrc){
70
+                    videoType, ssrc) {
71 71
     /**
72 72
      * Array with the HTML elements that are displaying the streams.
73 73
      * @type {Array}

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

@@ -18,10 +18,10 @@ const logger = getLogger(__filename);
18 18
 function createLocalTracks(tracksInfo, options) {
19 19
     var newTracks = [];
20 20
     var deviceId = null;
21
-    tracksInfo.forEach(function(trackInfo){
21
+    tracksInfo.forEach(function(trackInfo) {
22 22
         if (trackInfo.mediaType === MediaType.AUDIO) {
23 23
             deviceId = options.micDeviceId;
24
-        } else if (trackInfo.videoType === VideoType.CAMERA){
24
+        } else if (trackInfo.videoType === VideoType.CAMERA) {
25 25
             deviceId = options.cameraDeviceId;
26 26
         }
27 27
         var localTrack
@@ -366,7 +366,7 @@ export default class RTC extends Listenable {
366 366
      */
367 367
     setAudioMute(value) {
368 368
         const mutePromises = [];
369
-        this.getLocalTracks(MediaType.AUDIO).forEach(function(audioTrack){
369
+        this.getLocalTracks(MediaType.AUDIO).forEach(function(audioTrack) {
370 370
             // this is a Promise
371 371
             mutePromises.push(value ? audioTrack.mute() : audioTrack.unmute());
372 372
         });

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

@@ -997,7 +997,7 @@ class RTCUtils extends Listenable {
997 997
 
998 998
             options.devices = options.devices || ['audio', 'video'];
999 999
             if(!screenObtainer.isSupported()
1000
-                && options.devices.indexOf("desktop") !== -1){
1000
+                && options.devices.indexOf("desktop") !== -1) {
1001 1001
                 reject(new Error("Desktop sharing is not supported!"));
1002 1002
             }
1003 1003
             if (RTCBrowserType.isFirefox()
@@ -1018,7 +1018,7 @@ class RTCUtils extends Listenable {
1018 1018
                     "video": GUM.bind(self, ["video"])
1019 1019
                 };
1020 1020
 
1021
-                if(screenObtainer.isSupported()){
1021
+                if(screenObtainer.isSupported()) {
1022 1022
                     deviceGUM["desktop"] = screenObtainer.obtainStream.bind(
1023 1023
                         screenObtainer,
1024 1024
                         dsOptions);

+ 3
- 3
modules/RTC/ScreenObtainer.js View File

@@ -151,7 +151,7 @@ var ScreenObtainer = {
151 151
         } else if (RTCBrowserType.isFirefox()) {
152 152
             if (options.desktopSharingFirefoxDisabled) {
153 153
                 obtainDesktopStream = null;
154
-            } else if (window.location.protocol === "http:"){
154
+            } else if (window.location.protocol === "http:") {
155 155
                 logger.log("Screen sharing is not supported over HTTP. " +
156 156
                     "Use of HTTPS is required.");
157 157
                 obtainDesktopStream = null;
@@ -333,7 +333,7 @@ function obtainWebRTCScreen(options, streamCallback, failCallback) {
333 333
  * @param options supports "desktopSharingChromeExtId"
334 334
  * @returns {string}
335 335
  */
336
-function getWebStoreInstallUrl(options){
336
+function getWebStoreInstallUrl(options) {
337 337
     return "https://chrome.google.com/webstore/detail/" +
338 338
         options.desktopSharingChromeExtId;
339 339
 }
@@ -439,7 +439,7 @@ function doGetStreamFromExtension(options, streamCallback, failCallback) {
439 439
  * website of published extension.
440 440
  * @param options supports "desktopSharingChromeExtId"
441 441
  */
442
-function initInlineInstalls(options){
442
+function initInlineInstalls(options) {
443 443
     if($("link[rel=chrome-webstore-item]").length === 0) {
444 444
         $("head").append("<link rel=\"chrome-webstore-item\">");
445 445
     }

+ 3
- 3
modules/RTC/TraceablePeerConnection.js View File

@@ -267,7 +267,7 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track) {
267 267
 
268 268
     const remoteSDP = new SDP(this.remoteDescription.sdp);
269 269
     const mediaLines = remoteSDP.media.filter(
270
-        function(mediaLines){
270
+        function(mediaLines) {
271 271
             return mediaLines.startsWith("m=" + mediaType);
272 272
         });
273 273
     if (!mediaLines.length) {
@@ -535,7 +535,7 @@ var normalizePlanB = function(desc) {
535 535
 
536 536
             if (Array.isArray(mLine.ssrcs)) {
537 537
                 var i;
538
-                for (i = 0; i < mLine.ssrcs.length; i++){
538
+                for (i = 0; i < mLine.ssrcs.length; i++) {
539 539
                     if (typeof mLine.ssrcs[i] === 'object'
540 540
                         && typeof mLine.ssrcs[i].id !== 'undefined'
541 541
                         && firstSsrcs.indexOf(mLine.ssrcs[i].id) >= 0) {
@@ -544,7 +544,7 @@ var normalizePlanB = function(desc) {
544 544
                     }
545 545
                 }
546 546
 
547
-                for (i = 0; i < mLine.ssrcs.length; i++){
547
+                for (i = 0; i < mLine.ssrcs.length; i++) {
548 548
                     if (typeof mLine.ssrcs[i] !== 'undefined') {
549 549
                         newSsrcLines.push(mLine.ssrcs[i]);
550 550
                     }

+ 1
- 1
modules/statistics/CallStats.js View File

@@ -379,7 +379,7 @@ CallStats.prototype.sendTerminateEvent = _try_catch(function() {
379 379
  * @param {RTCPeerConnection} pc connection on which failure occured.
380 380
  * @param {CallStats} cs callstats instance related to the error (optional)
381 381
  */
382
-CallStats.prototype.sendIceConnectionFailedEvent = _try_catch(function(pc, cs){
382
+CallStats.prototype.sendIceConnectionFailedEvent = _try_catch(function(pc, cs) {
383 383
     CallStats._reportError.call(
384 384
         cs, wrtcFuncNames.iceConnectionFailure, null, pc);
385 385
 });

+ 4
- 4
modules/statistics/RTPStatsCollector.js View File

@@ -406,7 +406,7 @@ StatsCollector.prototype.processStatsReport = function() {
406 406
                     "upload": Math.round(sendBandwidth / 1000)
407 407
                 };
408 408
             }
409
-        } catch(e){/* not supported*/}
409
+        } catch(e) {/* not supported*/}
410 410
 
411 411
         if(now.type == 'googCandidatePair') {
412 412
             var ip, type, localip, active;
@@ -415,7 +415,7 @@ StatsCollector.prototype.processStatsReport = function() {
415 415
                 type = getStatValue(now, "transportType");
416 416
                 localip = getStatValue(now, "localAddress");
417 417
                 active = getStatValue(now, "activeConnection");
418
-            } catch(e){/* not supported*/}
418
+            } catch(e) {/* not supported*/}
419 419
             if(!ip || !type || !localip || active != "true") {
420 420
                 continue;
421 421
             }
@@ -501,7 +501,7 @@ StatsCollector.prototype.processStatsReport = function() {
501 501
         if(typeof nowBytesTransmitted === "number" ||
502 502
             typeof nowBytesTransmitted === "string") {
503 503
             nowBytesTransmitted = Number(nowBytesTransmitted);
504
-            if(!isNaN(nowBytesTransmitted)){
504
+            if(!isNaN(nowBytesTransmitted)) {
505 505
                 byteSentStats[ssrc] = nowBytesTransmitted;
506 506
                 if (nowBytesTransmitted > 0) {
507 507
                     bytesSent = nowBytesTransmitted -
@@ -536,7 +536,7 @@ StatsCollector.prototype.processStatsReport = function() {
536 536
                 resolution.height = height;
537 537
                 resolution.width = width;
538 538
             }
539
-        } catch(e){/* not supported*/}
539
+        } catch(e) {/* not supported*/}
540 540
 
541 541
         if (resolution.height && resolution.width) {
542 542
             ssrcStats.setResolution(resolution);

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

@@ -191,7 +191,7 @@ Statistics.stopLocalStats = function(stream) {
191 191
     }
192 192
 
193 193
     for(var i = 0; i < Statistics.localStats.length; i++) {
194
-        if(Statistics.localStats[i].stream === stream){
194
+        if(Statistics.localStats[i].stream === stream) {
195 195
             var localStats = Statistics.localStats.splice(i, 1);
196 196
             localStats[0].stop();
197 197
             break;

+ 14
- 14
modules/transcription/audioRecorder.js View File

@@ -13,7 +13,7 @@ var AUDIO_OGG = "audio/ogg";     // Supported in firefox
13 13
  * single JitsiTrack (either remote or local)
14 14
  * @param track The JitsiTrack the object is going to hold
15 15
  */
16
-var TrackRecorder = function(track){
16
+var TrackRecorder = function(track) {
17 17
     // The JitsiTrack holding the stream
18 18
     this.track = track;
19 19
     // The MediaRecorder recording the stream
@@ -47,7 +47,7 @@ function startRecorder(trackRecorder) {
47 47
  * This will also try to update the name
48 48
  * @param trackRecorder the TrackRecorder to stop
49 49
  */
50
-function stopRecorder(trackRecorder){
50
+function stopRecorder(trackRecorder) {
51 51
     if(trackRecorder.recorder === undefined) {
52 52
         throw new Error("Passed an object to stopRecorder which is not a " +
53 53
             "TrackRecorder object");
@@ -65,7 +65,7 @@ function instantiateTrackRecorder(track) {
65 65
     // Create a new stream which only holds the audio track
66 66
     var originalStream = trackRecorder.track.getOriginalStream();
67 67
     var stream = createEmptyStream();
68
-    originalStream.getAudioTracks().forEach(function(track){
68
+    originalStream.getAudioTracks().forEach(function(track) {
69 69
         stream.addTrack(track);
70 70
     });
71 71
     // Create the MediaRecorder
@@ -105,7 +105,7 @@ function determineCorrectFileType() {
105 105
  * @param jitsiConference the jitsiConference which this object
106 106
  * is going to record
107 107
  */
108
-var audioRecorder = function(jitsiConference){
108
+var audioRecorder = function(jitsiConference) {
109 109
     // array of TrackRecorders, where each trackRecorder
110 110
     // holds the JitsiTrack, MediaRecorder and recorder data
111 111
     this.recorders = [];
@@ -140,7 +140,7 @@ audioRecorder.prototype.addTrack = function(track) {
140 140
         this.updateNames();
141 141
         // If we're already recording, immediately start recording this new
142 142
         // track.
143
-        if(this.isRecording){
143
+        if(this.isRecording) {
144 144
             startRecorder(trackRecorder);
145 145
         }
146 146
     }
@@ -156,17 +156,17 @@ audioRecorder.prototype.addTrack = function(track) {
156 156
  *
157 157
  * @param {JitsiTrack} track the JitsiTrack to remove from the recording session
158 158
  */
159
-audioRecorder.prototype.removeTrack = function(track){
160
-    if(track.isVideoTrack()){
159
+audioRecorder.prototype.removeTrack = function(track) {
160
+    if(track.isVideoTrack()) {
161 161
         return;
162 162
     }
163 163
 
164 164
     var array = this.recorders;
165 165
     var i;
166 166
     for(i = 0; i < array.length; i++) {
167
-        if(array[i].track.getParticipantId() === track.getParticipantId()){
167
+        if(array[i].track.getParticipantId() === track.getParticipantId()) {
168 168
             var recorderToRemove = array[i];
169
-            if(this.isRecording){
169
+            if(this.isRecording) {
170 170
                 stopRecorder(recorderToRemove);
171 171
             } else {
172 172
                 // remove the TrackRecorder from the array
@@ -184,10 +184,10 @@ audioRecorder.prototype.removeTrack = function(track){
184 184
  * If it hasn't changed,it will keep the exiting name. If it changes to a
185 185
  * undefined value, the old value will also be kept.
186 186
  */
187
-audioRecorder.prototype.updateNames = function(){
187
+audioRecorder.prototype.updateNames = function() {
188 188
     var conference = this.jitsiConference;
189
-    this.recorders.forEach(function(trackRecorder){
190
-        if(trackRecorder.track.isLocal()){
189
+    this.recorders.forEach(function(trackRecorder) {
190
+        if(trackRecorder.track.isLocal()) {
191 191
             trackRecorder.name = "the transcriber";
192 192
         } else {
193 193
             var id = trackRecorder.track.getParticipantId();
@@ -211,7 +211,7 @@ audioRecorder.prototype.start = function() {
211 211
     // conference, that track can instantly start recording as well
212 212
     this.isRecording = true;
213 213
     // start all the mediaRecorders
214
-    this.recorders.forEach(function(trackRecorder){
214
+    this.recorders.forEach(function(trackRecorder) {
215 215
         startRecorder(trackRecorder);
216 216
     });
217 217
     // log that recording has started
@@ -226,7 +226,7 @@ audioRecorder.prototype.stop = function() {
226 226
     // set the boolean flag to false
227 227
     this.isRecording = false;
228 228
     // stop all recorders
229
-    this.recorders.forEach(function(trackRecorder){
229
+    this.recorders.forEach(function(trackRecorder) {
230 230
         stopRecorder(trackRecorder);
231 231
     });
232 232
     console.log("stopped recording");

+ 1
- 1
modules/transcription/recordingResult.js View File

@@ -8,7 +8,7 @@
8 8
  * @param wordArray the recorder audio stream transcribed as an array of Word
9 9
  *                  objects
10 10
  */
11
-var RecordingResult = function(blob, name, startTime, wordArray){
11
+var RecordingResult = function(blob, name, startTime, wordArray) {
12 12
     this.blob = blob;
13 13
     this.name = name;
14 14
     this.startTime = startTime;

+ 30
- 30
modules/transcription/transcriber.js View File

@@ -48,7 +48,7 @@ var transcriber = function() {
48 48
  * purposes
49 49
  */
50 50
 transcriber.prototype.start = function start() {
51
-    if(this.state !== BEFORE_STATE){
51
+    if(this.state !== BEFORE_STATE) {
52 52
         throw new Error("The transcription can only start when it's in the" +
53 53
             "\"" + BEFORE_STATE + "\" state. It's currently in the " +
54 54
             "\"" + this.state + "\" state");
@@ -65,7 +65,7 @@ transcriber.prototype.start = function start() {
65 65
  * @param callback a callback which will receive the transcription
66 66
  */
67 67
 transcriber.prototype.stop = function stop(callback) {
68
-    if(this.state !== RECORDING_STATE){
68
+    if(this.state !== RECORDING_STATE) {
69 69
         throw new Error("The transcription can only stop when it's in the" +
70 70
             "\"" + RECORDING_STATE + "\" state. It's currently in the " +
71 71
             "\"" + this.state + "\" state");
@@ -77,7 +77,7 @@ transcriber.prototype.stop = function stop(callback) {
77 77
     var t = this;
78 78
 
79 79
     var callBack = blobCallBack.bind(this);
80
-    this.audioRecorder.getRecordingResults().forEach(function(recordingResult){
80
+    this.audioRecorder.getRecordingResults().forEach(function(recordingResult) {
81 81
         t.transcriptionService.send(recordingResult, callBack);
82 82
         t.counter++;
83 83
     });
@@ -97,7 +97,7 @@ transcriber.prototype.stop = function stop(callback) {
97 97
  * @param {RecordingResult} answer a RecordingResult object with a defined
98 98
  * WordArray
99 99
  */
100
-var blobCallBack = function(answer){
100
+var blobCallBack = function(answer) {
101 101
     console.log("retrieved an answer from the transcription service. The" +
102 102
         " answer has an array of length: " + answer.wordArray.length);
103 103
     // first add the offset between the start of the transcription and
@@ -135,8 +135,8 @@ var blobCallBack = function(answer){
135 135
  * this method will check if the counter is zero. If it is, it will call
136 136
  * the merging method
137 137
  */
138
-transcriber.prototype.maybeMerge = function(){
139
-    if(this.state === TRANSCRIBING_STATE && this.counter === 0){
138
+transcriber.prototype.maybeMerge = function() {
139
+    if(this.state === TRANSCRIBING_STATE && this.counter === 0) {
140 140
         // make sure to include the events in the result arrays before
141 141
         // merging starts
142 142
         this.merge();
@@ -163,7 +163,7 @@ transcriber.prototype.merge = function() {
163 163
     hasPopulatedArrays(arrays);
164 164
 
165 165
     // populate all the potential Words for a first time
166
-    arrays.forEach(function(array){
166
+    arrays.forEach(function(array) {
167 167
         pushWordToSortedArray(potentialWords, array);
168 168
     });
169 169
 
@@ -171,11 +171,11 @@ transcriber.prototype.merge = function() {
171 171
     var lowestWordArray;
172 172
     var wordToAdd;
173 173
     var foundSmaller;
174
-    while(hasPopulatedArrays(arrays)){
174
+    while(hasPopulatedArrays(arrays)) {
175 175
         // first select the lowest array;
176 176
         lowestWordArray = arrays[0];
177
-        arrays.forEach(function(wordArray){
178
-            if(wordArray[0].begin < lowestWordArray[0].begin){
177
+        arrays.forEach(function(wordArray) {
178
+            if(wordArray[0].begin < lowestWordArray[0].begin) {
179 179
                 lowestWordArray = wordArray;
180 180
             }
181 181
         });
@@ -185,14 +185,14 @@ transcriber.prototype.merge = function() {
185 185
 
186 186
         // keep going until a word in another array has a smaller time
187 187
         // or the array is empty
188
-        while(!foundSmaller && lowestWordArray.length > 0){
189
-            arrays.forEach(function(wordArray){
190
-                if(wordArray[0].begin < lowestWordArray[0].begin){
188
+        while(!foundSmaller && lowestWordArray.length > 0) {
189
+            arrays.forEach(function(wordArray) {
190
+                if(wordArray[0].begin < lowestWordArray[0].begin) {
191 191
                     foundSmaller = true;
192 192
                 }
193 193
             });
194 194
             // add next word if no smaller time has been found
195
-            if(!foundSmaller){
195
+            if(!foundSmaller) {
196 196
                 wordToAdd = lowestWordArray.shift();
197 197
                 this.updateTranscription(wordToAdd, null);
198 198
             }
@@ -202,7 +202,7 @@ transcriber.prototype.merge = function() {
202 202
 
203 203
     // set the state to finished and do the necessary left-over tasks
204 204
     this.state = FINISHED_STATE;
205
-    if(this.callback){
205
+    if(this.callback) {
206 206
         this.callback(this.transcription);
207 207
     }
208 208
 };
@@ -213,12 +213,12 @@ transcriber.prototype.merge = function() {
213 213
  * @param {Word} word the Word object holding the word to append
214 214
  * @param {String|null} name the name of a new speaker. Null if not applicable
215 215
  */
216
-transcriber.prototype.updateTranscription = function(word, name){
217
-    if(name !== undefined && name !== null){
216
+transcriber.prototype.updateTranscription = function(word, name) {
217
+    if(name !== undefined && name !== null) {
218 218
         this.transcription += "\n" + name + ":";
219 219
         this.lineLength = name.length + 1; // +1 for the semi-colon
220 220
     }
221
-    if(this.lineLength + word.word.length > MAXIMUM_SENTENCE_LENGTH){
221
+    if(this.lineLength + word.word.length > MAXIMUM_SENTENCE_LENGTH) {
222 222
         this.transcription += "\n    ";
223 223
         this.lineLength = 4; // because of the 4 spaces after the new line
224 224
     }
@@ -234,10 +234,10 @@ transcriber.prototype.updateTranscription = function(word, name){
234 234
  * @param {Array<Array>} twoDimensionalArray the array to check
235 235
  * @returns {boolean} true if any non-zero arrays inside, otherwise false
236 236
  */
237
-var hasPopulatedArrays = function(twoDimensionalArray){
237
+var hasPopulatedArrays = function(twoDimensionalArray) {
238 238
     var i;
239
-    for(i = 0; i < twoDimensionalArray.length; i++){
240
-        if(twoDimensionalArray[i].length === 0){
239
+    for(i = 0; i < twoDimensionalArray.length; i++) {
240
+        if(twoDimensionalArray[i].length === 0) {
241 241
             twoDimensionalArray.splice(i, 1);
242 242
         }
243 243
     }
@@ -252,17 +252,17 @@ var hasPopulatedArrays = function(twoDimensionalArray){
252 252
  * @param {Array<Word>} array the sorted array to push to
253 253
  * @param {Word} word the word to push into the array
254 254
  */
255
-var pushWordToSortedArray = function(array, word){
255
+var pushWordToSortedArray = function(array, word) {
256 256
     if(array.length === 0) {
257 257
         array.push(word);
258 258
     } else{
259
-        if(array[array.length - 1].begin <= word.begin){
259
+        if(array[array.length - 1].begin <= word.begin) {
260 260
             array.push(word);
261 261
             return;
262 262
         }
263 263
         var i;
264
-        for(i = 0; i < array.length; i++){
265
-            if(word.begin < array[i].begin){
264
+        for(i = 0; i < array.length; i++) {
265
+            if(word.begin < array[i].begin) {
266 266
                 array.splice(i, 0, word);
267 267
                 return;
268 268
             }
@@ -277,7 +277,7 @@ var pushWordToSortedArray = function(array, word){
277 277
  * audiostream, it will not be added by the audioRecorder
278 278
  * @param {JitsiTrack} track the track to give to the audioRecorder
279 279
  */
280
-transcriber.prototype.addTrack = function(track){
280
+transcriber.prototype.addTrack = function(track) {
281 281
     this.audioRecorder.addTrack(track);
282 282
 };
283 283
 
@@ -285,7 +285,7 @@ transcriber.prototype.addTrack = function(track){
285 285
  * Remove the given track from the auioRecorder
286 286
  * @param track
287 287
  */
288
-transcriber.prototype.removeTrack = function(track){
288
+transcriber.prototype.removeTrack = function(track) {
289 289
     this.audioRecorder.removeTrack(track);
290 290
 };
291 291
 
@@ -294,8 +294,8 @@ transcriber.prototype.removeTrack = function(track){
294 294
  * when it's not done yet
295 295
  * @returns {String} the transcription as a String
296 296
  */
297
-transcriber.prototype.getTranscription = function(){
298
-    if(this.state !== FINISHED_STATE){
297
+transcriber.prototype.getTranscription = function() {
298
+    if(this.state !== FINISHED_STATE) {
299 299
         throw new Error("The transcription can only be retrieved when it's in" +
300 300
             " the\"" + FINISHED_STATE + "\" state. It's currently in the " +
301 301
             "\"" + this.state + "\" state");
@@ -306,7 +306,7 @@ transcriber.prototype.getTranscription = function(){
306 306
 /**
307 307
  * Returns the current state of the transcription process
308 308
  */
309
-transcriber.prototype.getState = function(){
309
+transcriber.prototype.getState = function() {
310 310
     return this.state;
311 311
 };
312 312
 

+ 1
- 1
modules/transcription/transcriberHolder.js View File

@@ -8,7 +8,7 @@
8 8
 var transcriberHolder = {
9 9
     transcribers : [],
10 10
 
11
-    add(transcriber){
11
+    add(transcriber) {
12 12
         transcriberHolder.transcribers.push(transcriber);
13 13
     }
14 14
 };

+ 5
- 5
modules/transcription/transcriptionServices/AbstractTranscriptionService.js View File

@@ -16,10 +16,10 @@ var TranscriptionService = function() {
16 16
  * @param {Function} callback  which will retrieve the a RecordingResult with
17 17
  *        the answer as a WordArray
18 18
  */
19
-TranscriptionService.prototype.send = function send(recordingResult, callback){
19
+TranscriptionService.prototype.send = function send(recordingResult, callback) {
20 20
     var t = this;
21
-    this.sendRequest(recordingResult.blob, function(response){
22
-        if(!t.verify(response)){
21
+    this.sendRequest(recordingResult.blob, function(response) {
22
+        if(!t.verify(response)) {
23 23
             console.log("the retrieved response from the server" +
24 24
                    " is not valid!");
25 25
             recordingResult.wordArray = [];
@@ -61,7 +61,7 @@ TranscriptionService.prototype.sendRequest = function(audioBlob, callback) {
61 61
  * @return {Array<Word>} an array of Word objects
62 62
  */
63 63
 // eslint-disable-next-line no-unused-vars
64
-TranscriptionService.prototype.formatResponse = function(response){
64
+TranscriptionService.prototype.formatResponse = function(response) {
65 65
     throw new Error("TranscriptionService.format is abstract");
66 66
 };
67 67
 
@@ -72,7 +72,7 @@ TranscriptionService.prototype.formatResponse = function(response){
72 72
  * @return {boolean} true if response is valid, false otherwise
73 73
  */
74 74
 // eslint-disable-next-line no-unused-vars
75
-TranscriptionService.prototype.verify = function(response){
75
+TranscriptionService.prototype.verify = function(response) {
76 76
     throw new Error("TranscriptionService.verify is abstract");
77 77
 };
78 78
 

+ 8
- 8
modules/transcription/transcriptionServices/SphinxTranscriptionService.js View File

@@ -62,7 +62,7 @@ SphinxService.prototype.formatResponse = function(response) {
62 62
     // the first value in the JSON array
63 63
     result.shift();
64 64
     var array = [];
65
-    result.forEach(function(word){
65
+    result.forEach(function(word) {
66 66
         if(!word.filler) {
67 67
             array.push(new Word(word.word, word.start, word.end));
68 68
         }
@@ -75,27 +75,27 @@ SphinxService.prototype.formatResponse = function(response) {
75 75
  * @param response the server response
76 76
  * @return {boolean} whether the response is valid
77 77
  */
78
-SphinxService.prototype.verify = function(response){
78
+SphinxService.prototype.verify = function(response) {
79 79
     console.log("response from server:" + response.toString());
80 80
     // test if server responded with a string object
81
-    if(typeof response !== "string"){
81
+    if(typeof response !== "string") {
82 82
         return false;
83 83
     }
84 84
     // test if the string can be parsed into valid JSON
85 85
     var json;
86 86
     try{
87 87
         json = JSON.parse(response);
88
-    } catch (error){
88
+    } catch (error) {
89 89
         console.log(error);
90 90
         return false;
91 91
     }
92 92
     // check if the JSON has a "objects" value
93
-    if(json.objects === undefined){
93
+    if(json.objects === undefined) {
94 94
         return false;
95 95
     }
96 96
     // get the "objects" value and check for a session ID
97 97
     var array = json.objects;
98
-    if(!(array[0] && array[0]["session-id"])){
98
+    if(!(array[0] && array[0]["session-id"])) {
99 99
         return false;
100 100
     }
101 101
     // everything seems to be in order
@@ -111,11 +111,11 @@ SphinxService.prototype.verify = function(response){
111 111
 function getURL() {
112 112
     var message = "config does not contain an url to a " +
113 113
     "Sphinx4 https server";
114
-    if(config.sphinxURL === undefined){
114
+    if(config.sphinxURL === undefined) {
115 115
         console.log(message);
116 116
     } else {
117 117
         var toReturn = config.sphinxURL;
118
-        if(toReturn.includes !== undefined && toReturn.includes("https://")){
118
+        if(toReturn.includes !== undefined && toReturn.includes("https://")) {
119 119
             return toReturn;
120 120
         } else{
121 121
             console.log(message);

+ 1
- 1
modules/version/ComponentsVersions.js View File

@@ -49,7 +49,7 @@ ComponentsVersions.prototype.processPresence =
49 49
         }
50 50
 
51 51
         var log = [];
52
-        node.children.forEach(function(item){
52
+        node.children.forEach(function(item) {
53 53
 
54 54
             var componentName = item.attributes.name;
55 55
             if (componentName !== ComponentsVersions.FOCUS_COMPONENT &&

+ 2
- 2
modules/xmpp/ChatRoom.js View File

@@ -33,7 +33,7 @@ var parser = {
33 33
     json2packet(nodes, packet) {
34 34
         for(let i = 0; i < nodes.length; i++) {
35 35
             const node = nodes[i];
36
-            if(!node || node === null){
36
+            if(!node || node === null) {
37 37
                 continue;
38 38
             }
39 39
             packet.c(node.tagName, node.attributes);
@@ -54,7 +54,7 @@ var parser = {
54 54
  * @param pres the presence JSON
55 55
  * @param nodeName the name of the node (videomuted, audiomuted, etc)
56 56
  */
57
-function filterNodeFromPresenceJSON(pres, nodeName){
57
+function filterNodeFromPresenceJSON(pres, nodeName) {
58 58
     var res = [];
59 59
     for(let i = 0; i < pres.length; i++) {
60 60
         if(pres[i].tagName === nodeName) {

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

@@ -1,6 +1,6 @@
1 1
 var SDPUtil = require("./SDPUtil");
2 2
 
3
-function SDPDiffer(mySDP, otherSDP){
3
+function SDPDiffer(mySDP, otherSDP) {
4 4
     this.mySDP = mySDP;
5 5
     this.otherSDP = otherSDP;
6 6
 }
@@ -55,7 +55,7 @@ SDPDiffer.prototype.getNewMedia = function() {
55 55
             if(Object.keys(myMedia.ssrcs).indexOf(ssrc) === -1) {
56 56
                 // Allocate channel if we've found ssrc that doesn't exist in
57 57
                 // our channel
58
-                if(!newMedia[othersMediaIdx]){
58
+                if(!newMedia[othersMediaIdx]) {
59 59
                     newMedia[othersMediaIdx] = {
60 60
                         mediaindex: othersMedia.mediaindex,
61 61
                         mid: othersMedia.mid,
@@ -68,7 +68,7 @@ SDPDiffer.prototype.getNewMedia = function() {
68 68
         });
69 69
 
70 70
         // Look for new ssrc groups across the channels
71
-        othersMedia.ssrcGroups.forEach(function(otherSsrcGroup){
71
+        othersMedia.ssrcGroups.forEach(function(otherSsrcGroup) {
72 72
 
73 73
             // try to match the other ssrc-group with an ssrc-group of ours
74 74
             var matched = false;
@@ -87,7 +87,7 @@ SDPDiffer.prototype.getNewMedia = function() {
87 87
                 // Allocate channel if we've found an ssrc-group that doesn't
88 88
                 // exist in our channel
89 89
 
90
-                if(!newMedia[othersMediaIdx]){
90
+                if(!newMedia[othersMediaIdx]) {
91 91
                     newMedia[othersMediaIdx] = {
92 92
                         mediaindex: othersMedia.mediaindex,
93 93
                         mid: othersMedia.mid,
@@ -109,7 +109,7 @@ SDPDiffer.prototype.toJingle = function(modify) {
109 109
     var sdpMediaSsrcs = this.getNewMedia();
110 110
 
111 111
     var modified = false;
112
-    Object.keys(sdpMediaSsrcs).forEach(function(mediaindex){
112
+    Object.keys(sdpMediaSsrcs).forEach(function(mediaindex) {
113 113
         modified = true;
114 114
         var media = sdpMediaSsrcs[mediaindex];
115 115
         modify.c('content', {name: media.mid});

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

@@ -86,7 +86,7 @@ Recording.prototype.handleJibriPresence = function(jibri) {
86 86
 Recording.prototype.setRecordingJibri
87 87
     = function(state, callback, errCallback, options) {
88 88
 
89
-        if (state == this.state){
89
+        if (state == this.state) {
90 90
             errCallback(JitsiRecorderErrors.INVALID_STATE);
91 91
         }
92 92
         options = options || {};
@@ -119,7 +119,7 @@ Recording.prototype.setRecordingJibri
119 119
 Recording.prototype.setRecordingJirecon =
120 120
     function(state, callback, errCallback) {
121 121
 
122
-        if (state == this.state){
122
+        if (state == this.state) {
123 123
             errCallback(new Error("Invalid state!"));
124 124
         }
125 125
 
@@ -129,7 +129,7 @@ Recording.prototype.setRecordingJirecon =
129 129
                 ? Recording.action.START
130 130
                 : Recording.action.STOP,
131 131
             mucjid: this.roomjid});
132
-        if (state === 'off'){
132
+        if (state === 'off') {
133 133
             iq.attrs({rid: this.jireconRid});
134 134
         }
135 135
 
@@ -145,7 +145,7 @@ Recording.prototype.setRecordingJirecon =
145 145
                 (state === Recording.status.ON ? 'started' : 'stopped') +
146 146
                 '(jirecon)' + result);
147 147
             self.state = state;
148
-            if (state === Recording.status.OFF){
148
+            if (state === Recording.status.OFF) {
149 149
                 self.jireconRid = null;
150 150
             }
151 151
 
@@ -179,7 +179,7 @@ function(state, callback, errCallback, options) {
179 179
             callback(newState);
180 180
 
181 181
             if (newState === 'pending') {
182
-                self.connection.addHandler(function(iq){
182
+                self.connection.addHandler(function(iq) {
183 183
                     var state = $(iq).find('recording').attr('state');
184 184
                     if (state) {
185 185
                         self.state = newState;
@@ -197,7 +197,7 @@ function(state, callback, errCallback, options) {
197 197
 
198 198
 Recording.prototype.setRecording =
199 199
 function(state, callback, errCallback, options) {
200
-    switch(this.type){
200
+    switch(this.type) {
201 201
     case Recording.types.JIRECON:
202 202
         this.setRecordingJirecon(state, callback, errCallback, options);
203 203
         break;

Loading…
Cancel
Save