Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(eslint): Enable for non react files
hristoterezov969f5d67ab19
diff --git a/.eslintrc.js b/.eslintrc.jsindex 55b9234426..be4ac4e300 100644--- a/.eslintrc.js+++ b/.eslintrc.js@@ -23,9 +23,157 @@ module.exports = {'sourceType': 'module'},'plugins': [- 'flowtype'+ 'flowtype',++ // ESLint's rule no-duplicate-imports does not understand Flow's import+ // type. Fortunately, eslint-plugin-import understands Flow's import+ // type.+ 'import'],'rules': {+ // Possible Errors group+ 'no-cond-assign': 2,+ 'no-console': 0,+ 'no-constant-condition': 2,+ 'no-control-regex': 2,+ 'no-debugger': 2,+ 'no-dupe-args': 2,+ 'no-dupe-keys': 2,+ 'no-duplicate-case': 2,+ 'no-empty': 2,+ 'no-empty-character-class': 2,+ 'no-ex-assign': 2,+ 'no-extra-boolean-cast': 2,+ 'no-extra-parens': [+ 'error',+ 'all',+ { 'nestedBinaryExpressions': false }+ ],+ 'no-extra-semi': 2,+ 'no-func-assign': 2,+ 'no-inner-declarations': 2,+ 'no-invalid-regexp': 2,+ 'no-irregular-whitespace': 2,+ 'no-negated-in-lhs': 2,+ 'no-obj-calls': 2,+ 'no-prototype-builtins': 0,+ 'no-regex-spaces': 2,+ 'no-sparse-arrays': 2,+ 'no-unexpected-multiline': 2,+ 'no-unreachable': 2,+ 'no-unsafe-finally': 2,+ 'use-isnan': 2,+ 'valid-typeof': 2,++ // Best Practices group+ 'accessor-pairs': 0,+ 'array-callback-return': 2,+ 'block-scoped-var': 0,+ 'complexity': 0,+ 'consistent-return': 0,+ 'curly': 2,+ 'default-case': 0,+ 'dot-location': [ 'error', 'property' ],+ 'dot-notation': 2,+ 'eqeqeq': 2,+ 'guard-for-in': 2,+ 'no-alert': 2,+ 'no-caller': 2,+ 'no-case-declarations': 2,+ 'no-div-regex': 0,+ 'no-else-return': 2,+ 'no-empty-function': 2,+ 'no-empty-pattern': 2,+ 'no-eq-null': 2,+ 'no-eval': 2,+ 'no-extend-native': 2,+ 'no-extra-bind': 2,+ 'no-extra-label': 2,+ 'no-fallthrough': 2,+ 'no-floating-decimal': 2,+ 'no-implicit-coercion': 2,+ 'no-implicit-globals': 2,+ 'no-implied-eval': 2,+ 'no-invalid-this': 2,+ 'no-iterator': 2,+ 'no-labels': 2,+ 'no-lone-blocks': 2,+ 'no-loop-func': 2,+ 'no-magic-numbers': 0,+ 'no-multi-spaces': 2,+ 'no-multi-str': 2,+ 'no-native-reassign': 2,+ 'no-new': 2,+ 'no-new-func': 2,+ 'no-new-wrappers': 2,+ 'no-octal': 2,+ 'no-octal-escape': 2,+ 'no-param-reassign': 2,+ 'no-proto': 2,+ 'no-redeclare': 2,+ 'no-return-assign': 2,+ 'no-script-url': 2,+ 'no-self-assign': 2,+ 'no-self-compare': 2,+ 'no-sequences': 2,+ 'no-throw-literal': 2,+ 'no-unmodified-loop-condition': 2,+ 'no-unused-expressions': [+ 'error',+ {+ 'allowShortCircuit': true,+ 'allowTernary': true+ }+ ],+ 'no-unused-labels': 2,+ 'no-useless-call': 2,+ 'no-useless-concat': 2,+ 'no-useless-escape': 2,+ 'no-void': 2,+ 'no-warning-comments': 0,+ 'no-with': 2,+ 'radix': 2,+ 'vars-on-top': 2,+ 'wrap-iife': [ 'error', 'inside' ],+ 'yoda': 2,++ // Strict Mode group+ 'strict': 2,++ // Variables group+ 'init-declarations': 0,+ 'no-catch-shadow': 2,+ 'no-delete-var': 2,+ 'no-label-var': 2,+ 'no-restricted-globals': 0,+ 'no-shadow': 2,+ 'no-shadow-restricted-names': 2,+ 'no-undef': 2,+ 'no-undef-init': 2,+ 'no-undefined': 0,+ 'no-unused-vars': 2,+ 'no-use-before-define': [ 'error', { 'functions': false } ],++ // Stylistic issues group+ 'array-bracket-spacing': [+ 'error',+ 'always',+ { 'objectsInArrays': true }+ ],+ 'block-spacing': [ 'error', 'always' ],+ 'brace-style': 2,+ 'camelcase': 2,+ 'comma-dangle': 2,+ 'comma-spacing': 2,+ 'comma-style': 2,+ 'computed-property-spacing': 2,+ 'consistent-this': [ 'error', 'self' ],+ 'eol-last': 2,+ 'func-names': 0,+ 'func-style': 0,+ 'id-blacklist': 0,+ 'id-length': 0,+ 'id-match': 0,'indent': ['error',4,@@ -43,19 +191,121 @@ module.exports = {'SwitchCase': 0}],- 'new-cap': [+ 'key-spacing': 2,+ 'keyword-spacing': 2,+ 'linebreak-style': [ 'error', 'unix' ],+ 'lines-around-comment': ['error',{- 'capIsNew': false // Behave like JSHint's newcap.+ 'allowBlockStart': true,+ 'allowObjectStart': true,+ 'beforeBlockComment': true,+ 'beforeLineComment': true}],- // While it is considered a best practice to avoid using methods on- // console in JavaScript that is designed to be executed in the browser- // and ESLint includes the rule among its set of recommended rules, (1)- // the general practice is to strip such calls before pushing to- // production and (2) we prefer to utilize console in lib-jitsi-meet- // (and jitsi-meet).- 'no-console': 'off',- 'semi': 'error'+ 'max-depth': 2,+ 'max-len': [ 'error', 80 ],+ 'max-lines': 0,+ 'max-nested-callbacks': 2,+ 'max-params': 2,+ 'max-statements': 0,+ 'max-statements-per-line': 2,+ 'multiline-ternary': 0,+ 'new-cap': 2,+ 'new-parens': 2,+ 'newline-after-var': 2,+ 'newline-before-return': 2,+ 'newline-per-chained-call': 2,+ 'no-array-constructor': 2,+ 'no-bitwise': 2,+ 'no-continue': 2,+ 'no-inline-comments': 0,+ 'no-lonely-if': 2,+ 'no-mixed-operators': 2,+ 'no-mixed-spaces-and-tabs': 2,+ 'no-multiple-empty-lines': 2,+ 'no-negated-condition': 2,+ 'no-nested-ternary': 0,+ 'no-new-object': 2,+ 'no-plusplus': 0,+ 'no-restricted-syntax': 0,+ 'no-spaced-func': 2,+ 'no-tabs': 2,+ 'no-ternary': 0,+ 'no-trailing-spaces': 2,+ 'no-underscore-dangle': 0,+ 'no-unneeded-ternary': 2,+ 'no-whitespace-before-property': 2,+ 'object-curly-newline': 0,+ 'object-curly-spacing': [ 'error', 'always' ],+ 'object-property-newline': 2,+ 'one-var': 0,+ 'one-var-declaration-per-line': 0,+ 'operator-assignment': 0,+ 'operator-linebreak': [ 'error', 'before' ],+ 'padded-blocks': 0,+ 'quote-props': 0,+ 'quotes': [ 'error', 'single' ],+ 'require-jsdoc': [+ 'error',+ {+ 'require': {+ 'ClassDeclaration': true,+ 'FunctionDeclaration': true,+ 'MethodDefinition': true+ }+ }+ ],+ 'semi': [ 'error', 'always' ],+ 'semi-spacing': 2,+ 'sort-vars': 2,+ 'space-before-blocks': 2,+ 'space-before-function-paren': [ 'error', 'never' ],+ 'space-in-parens': [ 'error', 'never' ],+ 'space-infix-ops': 2,+ 'space-unary-ops': 2,+ 'spaced-comment': 2,+ 'unicode-bom': 0,+ 'wrap-regex': 0,++ // ES6 group rules+ 'arrow-body-style': [+ 'error',+ 'as-needed',+ { requireReturnForObjectLiteral: true }+ ],+ 'arrow-parens': [ 'error', 'as-needed' ],+ 'arrow-spacing': 2,+ 'constructor-super': 2,+ 'generator-star-spacing': 2,+ 'no-class-assign': 2,+ 'no-confusing-arrow': 2,+ 'no-const-assign': 2,+ 'no-dupe-class-members': 2,+ 'no-new-symbol': 2,+ 'no-restricted-imports': 0,+ 'no-this-before-super': 2,+ 'no-useless-computed-key': 2,+ 'no-useless-constructor': 2,+ 'no-useless-rename': 2,+ 'no-var': 2,+ 'object-shorthand': [+ 'error',+ 'always',+ { 'avoidQuotes': true }+ ],+ 'prefer-arrow-callback': [ 'error', { 'allowNamedFunctions': true } ],+ 'prefer-const': 2,+ 'prefer-reflect': 0,+ 'prefer-rest-params': 2,+ 'prefer-spread': 2,+ 'prefer-template': 2,+ 'require-yield': 2,+ 'rest-spread-spacing': 2,+ 'sort-imports': 0,+ 'template-curly-spacing': 2,+ 'yield-star-spacing': 2,++ 'import/no-duplicates': 2}};diff --git a/ConferenceEvents.js b/ConferenceEvents.jsindex 8dd66b37bf..20deec08d3 100644--- a/ConferenceEvents.js+++ b/ConferenceEvents.js@@ -1,11 +1,11 @@/*** Notifies interested parties that hangup procedure will start.*/-export const BEFORE_HANGUP = "conference.before_hangup";+export const BEFORE_HANGUP = 'conference.before_hangup';/*** Notifies interested parties that desktop sharing enable/disable state is* changed.*/export const DESKTOP_SHARING_ENABLED_CHANGED- = "conference.desktop_sharing_enabled_changed";+ = 'conference.desktop_sharing_enabled_changed';diff --git a/analytics.js b/analytics.jsindex 20971c675d..124b5925be 100644--- a/analytics.js+++ b/analytics.js@@ -1,38 +1,45 @@/* global ga *//* eslint-disable indent */-(function (ctx) {- function Analytics() {- /* eslint-disable semi */-+(function(ctx) {/**- * Google Analytics+ **/- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');- ga('create', 'UA-319188-14', 'jit.si');- ga('send', 'pageview');+ function Analytics() {+ /* eslint-disable */++ /**+ * Google Analytics+ */+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');+ ga('create', 'UA-319188-14', 'jit.si');+ ga('send', 'pageview');++ /* eslint-enable */+ }- /* eslint-enable semi */- }+ Analytics.prototype.sendEvent = function(action, data) {+ // empty label if missing value for it and add the value,+ // the value should be integer or null+ let value = data.value;- Analytics.prototype.sendEvent = function (action, data) {- // empty label if missing value for it and add the value,- // the value should be integer or null- var value = data.value;- value = value? Math.round(parseFloat(value)) : null;- var label = data.label || "";+ value = value ? Math.round(parseFloat(value)) : null;+ const label = data.label || '';- ga('send', 'event', 'jit.si',- action + '.' + data.browserName, label, value);- };+ ga('send', 'event', 'jit.si',+ `${action}.${data.browserName}`, label, value);+ };- if (typeof ctx.JitsiMeetJS === "undefined")- ctx.JitsiMeetJS = {};- if (typeof ctx.JitsiMeetJS.app === "undefined")- ctx.JitsiMeetJS.app = {};- if (typeof ctx.JitsiMeetJS.app.analyticsHandlers === "undefined")- ctx.JitsiMeetJS.app.analyticsHandlers = [];- ctx.JitsiMeetJS.app.analyticsHandlers.push(Analytics);-}(window));+ if (typeof ctx.JitsiMeetJS === 'undefined') {+ ctx.JitsiMeetJS = {};+ }+ if (typeof ctx.JitsiMeetJS.app === 'undefined') {+ ctx.JitsiMeetJS.app = {};+ }+ if (typeof ctx.JitsiMeetJS.app.analyticsHandlers === 'undefined') {+ ctx.JitsiMeetJS.app.analyticsHandlers = [];+ }+ ctx.JitsiMeetJS.app.analyticsHandlers.push(Analytics);+})(window);diff --git a/conference.js b/conference.jsindex 4f3189f4dc..b729d13fe3 100644--- a/conference.js+++ b/conference.js@@ -1,7 +1,7 @@/* global $, APP, JitsiMeetJS, config, interfaceConfig */-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);-import {openConnection} from './connection';+import { openConnection } from './connection';import AuthHandler from './modules/UI/authentication/AuthHandler';import Recorder from './modules/recorder/Recorder';@@ -18,7 +18,7 @@ import * as JitsiMeetConferenceEvents from './ConferenceEvents';import { initAnalytics, sendEvent } from './react/features/analytics';-import EventEmitter from "events";+import EventEmitter from 'events';import {AVATAR_ID_COMMAND,@@ -77,7 +77,7 @@ import {} from './react/features/base/tracks';import { getLocationContextRoot } from './react/features/base/util';import { statsEmitter } from './react/features/connection-indicator';-import { showDesktopPicker } from './react/features/desktop-picker';+import { showDesktopPicker } from './react/features/desktop-picker';import { maybeOpenFeedbackDialog } from './react/features/feedback';import {mediaPermissionPromptVisibilityChanged,@@ -109,10 +109,10 @@ window.JitsiMeetScreenObtainer = {const commands = {AVATAR_ID: AVATAR_ID_COMMAND,AVATAR_URL: AVATAR_URL_COMMAND,- CUSTOM_ROLE: "custom-role",+ CUSTOM_ROLE: 'custom-role',EMAIL: EMAIL_COMMAND,- ETHERPAD: "etherpad",- SHARED_VIDEO: "shared-video"+ ETHERPAD: 'etherpad',+ SHARED_VIDEO: 'shared-video'};/**@@ -121,15 +121,18 @@ const commands = {* @returns Promise<JitsiConnection>*/function connect(roomName) {- return openConnection({retry: true, roomName: roomName})- .catch(function (err) {- if (err === JitsiConnectionErrors.PASSWORD_REQUIRED) {- APP.UI.notifyTokenAuthFailed();- } else {- APP.UI.notifyConnectionFailed(err);- }- throw err;- });+ return openConnection({+ retry: true,+ roomName+ })+ .catch(err => {+ if (err === JitsiConnectionErrors.PASSWORD_REQUIRED) {+ APP.UI.notifyTokenAuthFailed();+ } else {+ APP.UI.notifyConnectionFailed(err);+ }+ throw err;+ });}/**@@ -143,7 +146,7 @@ function sendData(command, value) {}room.removeCommand(command);- room.sendCommand(command, {value: value});+ room.sendCommand(command, { value });}/**@@ -194,15 +197,17 @@ function maybeRedirectToWelcomePage(options) {// save whether current user is guest or not, before navigating// to close pagewindow.sessionStorage.setItem('guest', isGuest);- assignWindowLocationPathname('static/'- + (options.feedbackSubmitted ? "close.html" : "close2.html"));+ assignWindowLocationPathname(`static/${+ options.feedbackSubmitted ? 'close.html' : 'close2.html'}`);+return;}// else: show thankYou dialog only if there is no feedback- if (options.thankYouDialogVisible)+ if (options.thankYouDialogVisible) {APP.UI.messageHandler.openMessageDialog(- null, "dialog.thankYou", {appName:interfaceConfig.APP_NAME});+ null, 'dialog.thankYou', { appName: interfaceConfig.APP_NAME });+ }// if Welcome page is enabled redirect to welcome page after 3 sec.if (config.enableWelcomePage) {@@ -225,19 +230,27 @@ function maybeRedirectToWelcomePage(options) {*/function assignWindowLocationPathname(pathname) {const windowLocation = window.location;+ let newPathname = pathname;- if (!pathname.startsWith('/')) {+ if (!newPathname.startsWith('/')) {// A pathname equal to ./ specifies the current directory. It will be// fine but pointless to include it because contextRoot is the current// directory.- pathname.startsWith('./') && (pathname = pathname.substring(2));- pathname = getLocationContextRoot(windowLocation) + pathname;+ newPathname.startsWith('./')+ && (newPathname = newPathname.substring(2));+ newPathname = getLocationContextRoot(windowLocation) + newPathname;}- windowLocation.pathname = pathname;+ windowLocation.pathname = newPathname;}+/**+ *+ */class ConferenceConnector {+ /**+ *+ */constructor(resolve, reject) {this._resolve = resolve;this._reject = reject;@@ -249,17 +262,26 @@ class ConferenceConnector {room.on(JitsiConferenceEvents.CONFERENCE_ERROR,this._onConferenceError.bind(this));}++ /**+ *+ */_handleConferenceFailed(err) {this._unsubscribe();this._reject(err);}++ /**+ *+ */_onConferenceFailed(err, ...params) {APP.store.dispatch(conferenceFailed(room, err, ...params));logger.error('CONFERENCE FAILED:', err, ...params);switch (err) {case JitsiConferenceErrors.CONNECTION_ERROR: {- let [msg] = params;+ const [ msg ] = params;+APP.UI.notifyConnectionFailed(msg);break;}@@ -284,7 +306,8 @@ class ConferenceConnector {}case JitsiConferenceErrors.RESERVATION_ERROR: {- let [code, msg] = params;+ const [ code, msg ] = params;+APP.UI.notifyReservationError(code, msg);break;}@@ -298,7 +321,8 @@ class ConferenceConnector {break;case JitsiConferenceErrors.CONFERENCE_DESTROYED: {- let [reason] = params;+ const [ reason ] = params;+APP.UI.hideStats();APP.UI.notifyConferenceDestroyed(reason);break;@@ -309,7 +333,8 @@ class ConferenceConnector {// because Jicofo is not available, but it is going to give it another// try.case JitsiConferenceErrors.FOCUS_DISCONNECTED: {- let [focus, retrySec] = params;+ const [ focus, retrySec ] = params;+APP.UI.notifyFocusDisconnected(focus, retrySec);break;}@@ -335,34 +360,53 @@ class ConferenceConnector {this._handleConferenceFailed(err, ...params);}}++ /**+ *+ */_onConferenceError(err, ...params) {logger.error('CONFERENCE Error:', err, params);switch (err) {case JitsiConferenceErrors.CHAT_ERROR:- logger.error("Chat error.", err);+ logger.error('Chat error.', err);if (isButtonEnabled('chat')) {- let [code, msg] = params;+ const [ code, msg ] = params;+APP.UI.showChatError(code, msg);}break;default:- logger.error("Unknown error.", err);+ logger.error('Unknown error.', err);}}++ /**+ *+ */_unsubscribe() {room.off(- JitsiConferenceEvents.CONFERENCE_JOINED, this._handleConferenceJoined);+ JitsiConferenceEvents.CONFERENCE_JOINED,+ this._handleConferenceJoined);room.off(- JitsiConferenceEvents.CONFERENCE_FAILED, this._onConferenceFailed);+ JitsiConferenceEvents.CONFERENCE_FAILED,+ this._onConferenceFailed);if (this.reconnectTimeout !== null) {clearTimeout(this.reconnectTimeout);}AuthHandler.closeAuth();}++ /**+ *+ */_handleConferenceJoined() {this._unsubscribe();this._resolve();}++ /**+ *+ */connect() {room.join();}@@ -376,6 +420,7 @@ class ConferenceConnector {function disconnect() {connection.disconnect();APP.API.notifyConferenceLeft(APP.conference.roomName);+return Promise.resolve();}@@ -391,8 +436,9 @@ function _connectionFailedHandler(error) {APP.connection.removeEventListener(JitsiConnectionEvents.CONNECTION_FAILED,_connectionFailedHandler);- if (room)+ if (room) {room.leave();+ }}}@@ -405,6 +451,7 @@ export default {_localTracksInitialized: false,isModerator: false,isSharingScreen: false,+/*** Indicates if the desktop sharing functionality has been enabled.* It takes into consideration {@link isDesktopSharingDisabledByConfig}@@ -415,21 +462,25 @@ export default {* config.js for listed options).*/isDesktopSharingEnabled: false,+/*** Set to <tt>true</tt> if the desktop sharing functionality has been* explicitly disabled in the config.*/isDesktopSharingDisabledByConfig: false,+/*** The text displayed when the desktop sharing button is disabled through* the config. The value is set through* {@link interfaceConfig.DESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP}.*/desktopSharingDisabledTooltip: null,+/** Whether the local "raisedHand" flag is on.*/isHandRaised: false,+/** Whether the local participant is the dominant speaker in the conference.*/@@ -507,25 +558,29 @@ export default {tryCreateLocalTracks = this._createDesktopTrack().then(desktopStream => {if (!requestedAudio) {- return [desktopStream];+ return [ desktopStream ];}- return createLocalTracksF({ devices: ['audio'] }, true)- .then(([audioStream]) => {- return [desktopStream, audioStream];- })+ return createLocalTracksF({ devices: [ 'audio' ] }, true)+ .then(([ audioStream ]) =>+ [ desktopStream, audioStream ]).catch(error => {audioOnlyError = error;- return [desktopStream];++ return [ desktopStream ];});- }).catch(error => {+ })+ .catch(error => {logger.error('Failed to obtain desktop stream', error);screenSharingError = error;+return requestedAudio- ? createLocalTracksF({ devices: ['audio'] }, true)+ ? createLocalTracksF({ devices: [ 'audio' ] }, true): [];- }).catch(error => {+ })+ .catch(error => {audioOnlyError = error;+return [];});} else if (!requestedAudio && !requestedVideo) {@@ -540,7 +595,10 @@ export default {// Try audio only...audioAndVideoError = err;- return createLocalTracksF({devices: ['audio']}, true);+ return createLocalTracksF(+ { devices: [ 'audio' ] },+ true+ );} else if (requestedAudio && !requestedVideo) {audioOnlyError = err;@@ -551,7 +609,8 @@ export default {return [];}logger.error('Should never happen');- }).catch(err => {+ })+ .catch(err => {// Log this just in case...if (!requestedAudio) {logger.error('The impossible just happened', err);@@ -560,7 +619,7 @@ export default {// Try video only...return requestedVideo- ? createLocalTracksF({devices: ['video']}, true)+ ? createLocalTracksF({ devices: [ 'video' ] }, true): [];}).catch(err => {@@ -575,9 +634,10 @@ export default {}return Promise.all([ tryCreateLocalTracks, connect(roomName) ])- .then(([tracks, con]) => {+ .then(([ tracks, con ]) => {APP.store.dispatch(mediaPermissionPromptVisibilityChanged(false));+// FIXME If there will be microphone error it will cover any// screensharing dialog, but it's still better than in// the reverse order where the screensharing dialog will@@ -601,7 +661,7 @@ export default {}}- return [tracks, con];+ return [ tracks, con ];});},@@ -613,40 +673,49 @@ export default {*/init(options) {this.roomName = options.roomName;+// attaches global error handler, if there is already one, respect itif (JitsiMeetJS.getGlobalOnErrorHandler) {- var oldOnErrorHandler = window.onerror;- window.onerror = function (message, source, lineno, colno, error) {+ const oldOnErrorHandler = window.onerror;++ // eslint-disable-next-line max-params+ window.onerror = (message, source, lineno, colno, error) => {JitsiMeetJS.getGlobalOnErrorHandler(message, source, lineno, colno, error);- if (oldOnErrorHandler)+ if (oldOnErrorHandler) {oldOnErrorHandler(message, source, lineno, colno, error);+ }};- var oldOnUnhandledRejection = window.onunhandledrejection;+ const oldOnUnhandledRejection = window.onunhandledrejection;+window.onunhandledrejection = function(event) {JitsiMeetJS.getGlobalOnErrorHandler(null, null, null, null, event.reason);- if (oldOnUnhandledRejection)+ if (oldOnUnhandledRejection) {oldOnUnhandledRejection(event);+ }};}+return (JitsiMeetJS.init({enableAnalyticsLogging: isAnalyticsEnabled(APP.store),...config}).then(() => {initAnalytics(APP.store);+return this.createInitialLocalTracksAndConnect(options.roomName, {startAudioOnly: config.startAudioOnly,startScreenSharing: config.startScreenSharing,startWithAudioMuted: config.startWithAudioMuted,- startWithVideoMuted: config.startWithVideoMuted,+ startWithVideoMuted: config.startWithVideoMuted});- }).then(([tracks, con]) => {+ })+ .then(([ tracks, con ]) => {tracks.forEach(track => {if (track.isAudioTrack() && this.isLocalAudioMuted()) {sendEvent('conference.audio.initiallyMuted');@@ -687,26 +756,29 @@ export default {// them at all, we mark corresponding toolbar buttons as muted,// so that the user can try unmute later on and add audio/video// to the conference- if (!tracks.find((t) => t.isAudioTrack())) {+ if (!tracks.find(t => t.isAudioTrack())) {this.setAudioMuteStatus(true);}- if (!tracks.find((t) => t.isVideoTrack())) {+ if (!tracks.find(t => t.isVideoTrack())) {this.setVideoMuteStatus(true);}this._initDeviceList();- if (config.iAmRecorder)+ if (config.iAmRecorder) {this.recorder = new Recorder();+ }// XXX The API will take care of disconnecting from the XMPP// server (and, thus, leaving the room) on unload.return new Promise((resolve, reject) => {(new ConferenceConnector(resolve, reject)).connect();});- }));+ })+ );},+/*** Check if id is id of the local user.* @param {string} id id to check@@ -754,8 +826,8 @@ export default {showUI && APP.UI.showMicErrorNotification(error);};- createLocalTracksF({ devices: ['audio'] }, false)- .then(([audioTrack]) => audioTrack)+ createLocalTracksF({ devices: [ 'audio' ] }, false)+ .then(([ audioTrack ]) => audioTrack).catch(error => {maybeShowErrorDialog(error);@@ -767,6 +839,7 @@ export default {muteLocalAudio(mute);}},+/*** Returns whether local audio is muted or not.* @returns {boolean}@@ -780,6 +853,7 @@ export default {: Boolean(APP.store.getState()['features/base/media'].audio.muted);},+/*** Simulates toolbar button click for audio mute. Used by shortcuts* and API.@@ -789,6 +863,7 @@ export default {toggleAudioMuted(showUI = true) {this.muteAudio(!this.isLocalAudioMuted(), showUI);},+/*** Simulates toolbar button click for video mute. Used by shortcuts and API.* @param mute true for mute and false for unmute.@@ -825,8 +900,8 @@ export default {//// FIXME when local track creation is moved to react/redux// it should take care of the use case described above- createLocalTracksF({ devices: ['video'] }, false)- .then(([videoTrack]) => videoTrack)+ createLocalTracksF({ devices: [ 'video' ] }, false)+ .then(([ videoTrack ]) => videoTrack).catch(error => {// FIXME should send some feedback to the API on error ?maybeShowErrorDialog(error);@@ -840,6 +915,7 @@ export default {muteLocalVideo(mute);}},+/*** Simulates toolbar button click for video mute. Used by shortcuts and API.* @param {boolean} [showUI] when set to false will not display any error@@ -848,6 +924,7 @@ export default {toggleVideoMuted(showUI = true) {this.muteVideo(!this.isLocalVideoMuted(), showUI);},+/*** Retrieve list of conference participants (without local user).* @returns {JitsiParticipant[]}@@ -855,6 +932,7 @@ export default {listMembers() {return room.getParticipants();},+/*** Retrieve list of ids of conference participants (without local user).* @returns {string[]}@@ -862,18 +940,22 @@ export default {listMembersIds() {return room.getParticipants().map(p => p.getId());},+/*** Checks whether the participant identified by id is a moderator.* @id id to search for participant* @return {boolean} whether the participant is moderator*/isParticipantModerator(id) {- let user = room.getParticipantById(id);+ const user = room.getParticipantById(id);++return user && user.isModerator();},get membersCount() {return room.getParticipants().length + 1;},+/*** Returns true if the callstats integration is enabled, otherwise returns* false.@@ -884,6 +966,7 @@ export default {isCallstatsEnabled() {return room && room.isCallstatsEnabled();},+/*** Sends the given feedback through CallStats if enabled.*@@ -892,7 +975,7 @@ export default {* @param detailedFeedback detailed feedback from the user. Not yet used*/sendFeedback(overallFeedback, detailedFeedback) {- return room.sendFeedback (overallFeedback, detailedFeedback);+ return room.sendFeedback(overallFeedback, detailedFeedback);},/**@@ -912,6 +995,7 @@ export default {getConnectionTimes() {return this._room.getConnectionTimes();},+// used by torture currentlyisJoined() {return this._room@@ -921,6 +1005,7 @@ export default {return this._room&& this._room.getConnectionState();},+/*** Obtains current P2P ICE connection state.* @return {string|null} ICE connection state or <tt>null</tt> if there's no@@ -930,6 +1015,7 @@ export default {return this._room&& this._room.getP2PConnectionState();},+/*** Starts P2P (for tests only)* @private@@ -938,10 +1024,11 @@ export default {try {this._room && this._room.startP2PSession();} catch (error) {- logger.error("Start P2P failed", error);+ logger.error('Start P2P failed', error);throw error;}},+/*** Stops P2P (for tests only)* @private@@ -950,10 +1037,11 @@ export default {try {this._room && this._room.stopP2PSession();} catch (error) {- logger.error("Stop P2P failed", error);+ logger.error('Stop P2P failed', error);throw error;}},+/*** Checks whether or not our connection is currently in interrupted and* reconnect attempts are in progress.@@ -964,6 +1052,7 @@ export default {isConnectionInterrupted() {return this._room.isConnectionInterrupted();},+/*** Obtains the local display name.* @returns {string|undefined}@@ -971,6 +1060,7 @@ export default {getLocalDisplayName() {return getDisplayName(this.getMyUserId());},+/*** Finds JitsiParticipant for given id.*@@ -982,6 +1072,7 @@ export default {getParticipantById(id) {return room ? room.getParticipantById(id) : null;},+/*** Get participant connection status for the participant.*@@ -991,9 +1082,12 @@ export default {* or null if no such participant is found or participant is the local user.*/getParticipantConnectionStatus(id) {- let participant = this.getParticipantById(id);+ const participant = this.getParticipantById(id);++return participant ? participant.getConnectionStatus() : null;},+/*** Gets the display name foe the <tt>JitsiParticipant</tt> identified by* the given <tt>id</tt>.@@ -1004,39 +1098,45 @@ export default {* absent.*/getParticipantDisplayName(id) {- let displayName = getDisplayName(id);+ const displayName = getDisplayName(id);+if (displayName) {return displayName;- } else {- if (APP.conference.isLocalId(id)) {- return APP.translation.generateTranslationHTML(+ }+ if (APP.conference.isLocalId(id)) {+ return APP.translation.generateTranslationHTML(interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME);- } else {- return interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME;- }}++ return interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME;++},getMyUserId() {return this._room&& this._room.myUserId();},+/*** Indicates if recording is supported in this conference.*/isRecordingSupported() {return this._room && this._room.isRecordingSupported();},+/*** Returns the recording state or undefined if the room is not defined.*/getRecordingState() {- return (this._room) ? this._room.getRecordingState() : undefined;+ return this._room ? this._room.getRecordingState() : undefined;},+/*** Will be filled with values only when config.debug is enabled.* Its used by torture to check audio levels.*/audioLevelsMap: {},+/*** Returns the stored audio level (stored only if config.debug is enabled)* @param id the id for the user audio level to return (the id value is@@ -1045,21 +1145,24 @@ export default {getPeerSSRCAudioLevel(id) {return this.audioLevelsMap[id];},+/*** @return {number} the number of participants in the conference with at* least one track.*/getNumberOfParticipantsWithTracks() {return this._room.getParticipants()- .filter((p) => p.getTracks().length > 0)+ .filter(p => p.getTracks().length > 0).length;},+/*** Returns the stats.*/getStats() {return room.connectionQuality.getStats();},+// end used by torturegetLogs() {@@ -1074,15 +1177,15 @@ export default {saveLogs(filename = 'meetlog.json') {// this can be called from console and will not have reference to this// that's why we reference the global var- let logs = APP.conference.getLogs();- let data = encodeURIComponent(JSON.stringify(logs, null, ' '));+ const logs = APP.conference.getLogs();+ const data = encodeURIComponent(JSON.stringify(logs, null, ' '));- let elem = document.createElement('a');+ const elem = document.createElement('a');elem.download = filename;- elem.href = 'data:application/json;charset=utf-8,\n' + data;+ elem.href = `data:application/json;charset=utf-8,\n${data}`;elem.dataset.downloadurl- = ['text/json', elem.download, elem.href].join(':');+ = [ 'text/json', elem.download, elem.href ].join(':');elem.dispatchEvent(new MouseEvent('click', {view: window,bubbles: true,@@ -1104,37 +1207,45 @@ export default {* Known custom conference commands.*/defaults: commands,+/*** Receives notifications from other participants about commands aka* custom events (sent by sendCommand or sendCommandOnce methods).* @param command {String} the name of the command* @param handler {Function} handler for the command*/- addCommandListener () {- room.addCommandListener.apply(room, arguments);+ addCommandListener() {+ // eslint-disable-next-line prefer-rest-params+ room.addCommandListener(...arguments);},+/*** Removes command.* @param name {String} the name of the command.*/- removeCommand () {- room.removeCommand.apply(room, arguments);+ removeCommand() {+ // eslint-disable-next-line prefer-rest-params+ room.removeCommand(...arguments);},+/*** Sends command.* @param name {String} the name of the command.* @param values {Object} with keys and values that will be sent.*/- sendCommand () {- room.sendCommand.apply(room, arguments);+ sendCommand() {+ // eslint-disable-next-line prefer-rest-params+ room.sendCommand(...arguments);},+/*** Sends command one time.* @param name {String} the name of the command.* @param values {Object} with keys and values that will be sent.*/- sendCommandOnce () {- room.sendCommandOnce.apply(room, arguments);+ sendCommandOnce() {+ // eslint-disable-next-line prefer-rest-params+ room.sendCommandOnce(...arguments);}},@@ -1163,21 +1274,24 @@ export default {return this.useAudioStream(track);} else if (track.isVideoTrack()) {return this.useVideoStream(track);- } else {- logger.error(- "Ignored not an audio nor a video track: ", track);- return Promise.resolve();}+ logger.error(+ 'Ignored not an audio nor a video track: ', track);++ return Promise.resolve();+});},_getConferenceOptions() {- let options = config;+ const options = config;+if (config.enableRecording && !config.recordingType) {- options.recordingType = (config.hosts &&- (typeof config.hosts.jirecon != "undefined"))?- "jirecon" : "colibri";+ options.recordingType = config.hosts+ && (typeof config.hosts.jirecon !== 'undefined')+ ? 'jirecon' : 'colibri';}+return options;},@@ -1300,8 +1414,8 @@ export default {let promise = null;if (didHaveVideo) {- promise = createLocalTracksF({ devices: ['video'] })- .then(([stream]) => this.useVideoStream(stream))+ promise = createLocalTracksF({ devices: [ 'video' ] })+ .then(([ stream ]) => this.useVideoStream(stream)).then(() => {sendEvent('conference.sharingDesktop.stop');@@ -1314,14 +1428,17 @@ export default {}).catch(error => {logger.error('failed to switch back to local video', error);- return this.useVideoStream(null).then(() => {++ return this.useVideoStream(null).then(() =>+// Still fail with the original err- return Promise.reject(error);- });+ Promise.reject(error)+ );});} else {promise = this.useVideoStream(null);}+return promise.then(() => {this.videoSwitchInProgress = false;@@ -1364,9 +1481,10 @@ export default {if (toggle) {return this._switchToScreenSharing(options);- } else {- return this._untoggleScreenSharing();}++ return this._untoggleScreenSharing();+},/**@@ -1388,13 +1506,13 @@ export default {return createLocalTracksF({desktopSharingSources: options.desktopSharingSources,- devices: ['desktop'],+ devices: [ 'desktop' ],desktopSharingExtensionExternalInstallation: {interval: 500,checkAgain: () => DSExternalInstallationInProgress,listener: (status, url) => {- switch(status) {- case "waitingForExtension": {+ switch (status) {+ case 'waitingForExtension': {DSExternalInstallationInProgress = true;externalInstallation = true;const listener = () => {@@ -1409,22 +1527,24 @@ export default {UIEvents.EXTERNAL_INSTALLATION_CANCELED,listener);};+APP.UI.addListener(UIEvents.EXTERNAL_INSTALLATION_CANCELED,listener);APP.UI.showExtensionExternalInstallationDialog(url);break;}- case "extensionFound":+ case 'extensionFound':// Close the dialog.externalInstallation && $.prompt.close();break;default:+// Unknown status}}}- }).then(([desktopStream]) => {+ }).then(([ desktopStream ]) => {// Stores the "untoggle" handler which remembers whether was// there any video before and whether was it muted.this._untoggleScreenSharing@@ -1440,11 +1560,14 @@ export default {&& this._untoggleScreenSharing();});+// close external installation dialog on success.externalInstallation && $.prompt.close();+return desktopStream;}, error => {DSExternalInstallationInProgress = false;+// close external installation dialog on success.externalInstallation && $.prompt.close();throw error;@@ -1470,14 +1593,17 @@ export default {}this.videoSwitchInProgress = true;- return this._createDesktopTrack(options).then(stream => {- return this.useVideoStream(stream);- }).then(() => {++ return this._createDesktopTrack(options)+ .then(stream => this.useVideoStream(stream))+ .then(() => {this.videoSwitchInProgress = false;sendEvent('conference.sharingDesktop.start');logger.log('sharing local desktop');- }).catch(error => {+ })+ .catch(error => {this.videoSwitchInProgress = false;+// Pawel: With this call I'm trying to preserve the original// behaviour although it is not clear why would we "untoggle"// on failure. I suppose it was to restore video in case there@@ -1491,8 +1617,8 @@ export default {}// FIXME the code inside of _handleScreenSharingError is- // asynchronous, but does not return a Promise and is not part of- // the current Promise chain.+ // asynchronous, but does not return a Promise and is not part+ // of the current Promise chain.this._handleScreenSharingError(error);return Promise.reject(error);@@ -1517,13 +1643,15 @@ export default {logger.error('failed to share local desktop', error);- if (error.name === JitsiTrackErrors.CHROME_EXTENSION_USER_GESTURE_REQUIRED) {+ if (error.name+ === JitsiTrackErrors.CHROME_EXTENSION_USER_GESTURE_REQUIRED) {// If start with screen sharing the extension will fail to install// (if not found), because the request has been triggered by the// script. Show a dialog which asks user to click "install" and try// again switching to the screen sharing.APP.UI.showExtensionInlineInstallationDialog(() => {+ // eslint-disable-next-line no-empty-functionthis.toggleScreenSharing().catch(() => {});});@@ -1547,16 +1675,17 @@ export default {if (error.name === JitsiTrackErrors.PERMISSION_DENIED) {dialogTxt = APP.translation.generateTranslationHTML(- "dialog.screenSharingPermissionDeniedError");- dialogTitleKey = "dialog.error";+ 'dialog.screenSharingPermissionDeniedError');+ dialogTitleKey = 'dialog.error';} else {dialogTxt = APP.translation.generateTranslationHTML(- "dialog.failtoinstall");- dialogTitleKey = "dialog.permissionDenied";+ 'dialog.failtoinstall');+ dialogTitleKey = 'dialog.permissionDenied';}APP.UI.messageHandler.openDialog(dialogTitleKey, dialogTxt, false);},+/*** Setup interaction between conference and UI.*/@@ -1582,8 +1711,9 @@ export default {room.on(JitsiConferenceEvents.PARTCIPANT_FEATURES_CHANGED,user => APP.UI.onUserFeaturesChanged(user));room.on(JitsiConferenceEvents.USER_JOINED, (id, user) => {- if (user.isHidden())+ if (user.isHidden()) {return;+ }APP.store.dispatch(participantJoined({id,@@ -1610,7 +1740,8 @@ export default {room.on(JitsiConferenceEvents.USER_STATUS_CHANGED, (id, status) => {APP.store.dispatch(participantPresenceChanged(id, status));- let user = room.getParticipantById(id);+ const user = room.getParticipantById(id);+if (user) {APP.UI.updateUserStatus(user, status);}@@ -1629,40 +1760,46 @@ export default {} else {APP.store.dispatch(participantRoleChanged(id, role));- let user = room.getParticipantById(id);+ const user = room.getParticipantById(id);+if (user) {APP.UI.updateUserRole(user);}}});- room.on(JitsiConferenceEvents.TRACK_ADDED, (track) => {- if (!track || track.isLocal())+ room.on(JitsiConferenceEvents.TRACK_ADDED, track => {+ if (!track || track.isLocal()) {return;+ }APP.store.dispatch(trackAdded(track));});- room.on(JitsiConferenceEvents.TRACK_REMOVED, (track) => {- if (!track || track.isLocal())+ room.on(JitsiConferenceEvents.TRACK_REMOVED, track => {+ if (!track || track.isLocal()) {return;+ }APP.store.dispatch(trackRemoved(track));});room.on(JitsiConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED, (id, lvl) => {+ let newLvl = lvl;+if (this.isLocalId(id)&& this.localAudio && this.localAudio.isMuted()) {- lvl = 0;+ newLvl = 0;}if (config.debug) {- this.audioLevelsMap[id] = lvl;- if (config.debugAudioLevels)- logger.log("AudioLevel:" + id + "/" + lvl);+ this.audioLevelsMap[id] = newLvl;+ if (config.debugAudioLevels) {+ logger.log(`AudioLevel:${id}/${newLvl}`);+ }}- APP.UI.setAudioLevel(id, lvl);+ APP.UI.setAudioLevel(id, newLvl);});room.on(JitsiConferenceEvents.TALK_WHILE_MUTED, () => {@@ -1679,7 +1816,8 @@ export default {room.on(JitsiConferenceEvents.P2P_STATUS,- (jitsiConference, p2p) => APP.store.dispatch(p2pStatusChanged(p2p)));+ (jitsiConference, p2p) =>+ APP.store.dispatch(p2pStatusChanged(p2p)));room.on(JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,@@ -1689,7 +1827,7 @@ export default {APP.UI.participantConnectionStatusChanged(id);});- room.on(JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, (id) => {+ room.on(JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED, id => {APP.store.dispatch(dominantSpeakerChanged(id));if (this.isLocalId(id)) {@@ -1697,7 +1835,8 @@ export default {this.setRaisedHand(false);} else {this.isDominantSpeaker = false;- var participant = room.getParticipantById(id);+ const participant = room.getParticipantById(id);+if (participant) {APP.UI.setRaisedHandStatus(participant, false);}@@ -1714,37 +1853,41 @@ export default {});if (isButtonEnabled('chat')) {- room.on(JitsiConferenceEvents.MESSAGE_RECEIVED, (id, body, ts) => {- let nick = getDisplayName(id);-- if (!nick) {- nick =- `${interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME} (${+ room.on(+ JitsiConferenceEvents.MESSAGE_RECEIVED,+ (id, body, ts) => {+ let nick = getDisplayName(id);++ if (!nick) {+ nick = `${+ interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME} (${id})`;- }+ }- APP.API.notifyReceivedChatMessage({- id,- nick,- body,- ts- });- APP.UI.addMessage(id, nick, body, ts);- });- APP.UI.addListener(UIEvents.MESSAGE_CREATED, (message) => {+ APP.API.notifyReceivedChatMessage({+ id,+ nick,+ body,+ ts+ });+ APP.UI.addMessage(id, nick, body, ts);+ }+ );+ APP.UI.addListener(UIEvents.MESSAGE_CREATED, message => {APP.API.notifySendingChatMessage(message);room.sendTextMessage(message);});}- APP.UI.addListener(UIEvents.SELECTED_ENDPOINT, (id) => {+ APP.UI.addListener(UIEvents.SELECTED_ENDPOINT, id => {try {// do not try to select participant if there is none (we// are alone in the room), otherwise an error will be// thrown cause reporting mechanism is not available// (datachannels currently)- if (room.getParticipants().length === 0)+ if (room.getParticipants().length === 0) {return;+ }room.selectParticipant(id);} catch (e) {@@ -1773,16 +1916,20 @@ export default {APP.UI.showLocalConnectionInterrupted(false);});- room.on(JitsiConferenceEvents.DISPLAY_NAME_CHANGED, (id, displayName) => {- const formattedDisplayName- = displayName.substr(0, MAX_DISPLAY_NAME_LENGTH);- APP.store.dispatch(participantUpdated({- id,- name: formattedDisplayName- }));- APP.API.notifyDisplayNameChanged(id, formattedDisplayName);- APP.UI.changeDisplayName(id, formattedDisplayName);- });+ room.on(+ JitsiConferenceEvents.DISPLAY_NAME_CHANGED,+ (id, displayName) => {+ const formattedDisplayName+ = displayName.substr(0, MAX_DISPLAY_NAME_LENGTH);++ APP.store.dispatch(participantUpdated({+ id,+ name: formattedDisplayName+ }));+ APP.API.notifyDisplayNameChanged(id, formattedDisplayName);+ APP.UI.changeDisplayName(id, formattedDisplayName);+ }+ );room.on(JitsiConferenceEvents.LOCK_STATE_CHANGED,@@ -1790,12 +1937,13 @@ export default {APP.remoteControl.on(RemoteControlEvents.ACTIVE_CHANGED, isActive => {room.setLocalParticipantProperty(- "remoteControlSessionStatus",+ 'remoteControlSessionStatus',isActive);APP.UI.setLocalRemoteControlActiveChanged();});+ /* eslint-disable max-params */room.on(JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,(participant, name, oldValue, newValue) => {@@ -1809,23 +1957,31 @@ export default {newValue);break;default:+// ignore}});- room.on(JitsiConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => {- logger.log("Received recorder status change: ", status, error);- APP.UI.updateRecordingState(status);- });+ /* eslint-enable max-params */++ room.on(+ JitsiConferenceEvents.RECORDER_STATE_CHANGED,+ (status, error) => {+ logger.log('Received recorder status change: ', status, error);+ APP.UI.updateRecordingState(status);+ }+ );room.on(JitsiConferenceEvents.KICKED, () => {APP.UI.hideStats();APP.UI.notifyKicked();+// FIXME close});room.on(JitsiConferenceEvents.SUSPEND_DETECTED, () => {APP.store.dispatch(suspendDetected());+// After wake up, we will be in a state where conference is left// there will be dialog shown to user.// We do not want video/audio as we show an overlay and after it@@ -1833,16 +1989,18 @@ export default {// camera wakeup as a problem with device.// We also do not care about device change, which happens// on resume after suspending PC.- if (this.deviceChangeListener)+ if (this.deviceChangeListener) {JitsiMeetJS.mediaDevices.removeEventListener(JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED,this.deviceChangeListener);+ }// stop local videoif (this.localVideo) {this.localVideo.dispose();this.localVideo = null;}+// stop local audioif (this.localAudio) {this.localAudio.dispose();@@ -1850,9 +2008,12 @@ export default {}});- room.on(JitsiConferenceEvents.DTMF_SUPPORT_CHANGED, (isDTMFSupported) => {- APP.UI.updateDTMFSupport(isDTMFSupported);- });+ room.on(+ JitsiConferenceEvents.DTMF_SUPPORT_CHANGED,+ isDTMFSupported => {+ APP.UI.updateDTMFSupport(isDTMFSupported);+ }+ );APP.UI.addListener(UIEvents.AUDIO_MUTED, muted => {this.muteAudio(muted);@@ -1867,9 +2028,11 @@ export default {statsEmitter.startListeningForStats(room);- room.addCommandListener(this.commands.defaults.ETHERPAD, ({value}) => {- APP.UI.initEtherpad(value);- });+ room.addCommandListener(this.commands.defaults.ETHERPAD,+ ({ value }) => {+ APP.UI.initEtherpad(value);+ }+ );APP.UI.addListener(UIEvents.EMAIL_CHANGED, this.changeLocalEmail);room.addCommandListener(this.commands.defaults.EMAIL, (data, from) => {@@ -1924,7 +2087,8 @@ export default {});room.on(- JitsiConferenceEvents.AVAILABLE_DEVICES_CHANGED, function (id, devices) {+ JitsiConferenceEvents.AVAILABLE_DEVICES_CHANGED,+ (id, devices) => {APP.UI.updateDevicesAvailability(id, devices);});@@ -1951,15 +2115,16 @@ export default {});});+ /* eslint-disable max-params */APP.UI.addListener(UIEvents.RESOLUTION_CHANGED,(id, oldResolution, newResolution, delay) => {- var logObject = {- id: "resolution_change",+ const logObject = {+ id: 'resolution_change',participant: id,oldValue: oldResolution,newValue: newResolution,- delay: delay+ delay};room.sendApplicationLog(JSON.stringify(logObject));@@ -1968,28 +2133,29 @@ export default {// Longer delays will be caused by something else and will just// poison the data.if (delay < 2000) {- sendEvent('stream.switch.delay',- {value: delay});+ sendEvent('stream.switch.delay', { value: delay });}});+ /* eslint-enable max-params */+// Starts or stops the recording for the conference.- APP.UI.addListener(UIEvents.RECORDING_TOGGLED, (options) => {+ APP.UI.addListener(UIEvents.RECORDING_TOGGLED, options => {room.toggleRecording(options);});- APP.UI.addListener(UIEvents.SUBJECT_CHANGED, (topic) => {+ APP.UI.addListener(UIEvents.SUBJECT_CHANGED, topic => {room.setSubject(topic);});- room.on(JitsiConferenceEvents.SUBJECT_CHANGED, function (subject) {+ room.on(JitsiConferenceEvents.SUBJECT_CHANGED, subject => {APP.UI.setSubject(subject);});- APP.UI.addListener(UIEvents.USER_KICKED, (id) => {+ APP.UI.addListener(UIEvents.USER_KICKED, id => {room.kickParticipant(id);});- APP.UI.addListener(UIEvents.REMOTE_AUDIO_MUTED, (id) => {+ APP.UI.addListener(UIEvents.REMOTE_AUDIO_MUTED, id => {room.muteParticipant(id);});@@ -1999,14 +2165,14 @@ export default {APP.UI.addListener(UIEvents.VIDEO_DEVICE_CHANGED,- (cameraDeviceId) => {+ cameraDeviceId => {sendEvent('settings.changeDevice.video');createLocalTracksF({- devices: ['video'],- cameraDeviceId: cameraDeviceId,+ devices: [ 'video' ],+ cameraDeviceId,micDeviceId: null})- .then(([stream]) => {+ .then(([ stream ]) => {if (this.isAudioOnly()) {return stream.mute().then(() => stream);@@ -2019,7 +2185,7 @@ export default {logger.log('switched local video device');APP.settings.setCameraDeviceId(cameraDeviceId, true);})- .catch((err) => {+ .catch(err => {APP.UI.showCameraErrorNotification(err);});}@@ -2027,20 +2193,20 @@ export default {APP.UI.addListener(UIEvents.AUDIO_DEVICE_CHANGED,- (micDeviceId) => {+ micDeviceId => {sendEvent('settings.changeDevice.audioIn');createLocalTracksF({- devices: ['audio'],+ devices: [ 'audio' ],cameraDeviceId: null,- micDeviceId: micDeviceId+ micDeviceId})- .then(([stream]) => {+ .then(([ stream ]) => {this.useAudioStream(stream);logger.log('switched local audio device');APP.settings.setMicDeviceId(micDeviceId, true);})- .catch((err) => {+ .catch(err => {APP.UI.showMicErrorNotification(err);});}@@ -2048,15 +2214,15 @@ export default {APP.UI.addListener(UIEvents.AUDIO_OUTPUT_DEVICE_CHANGED,- (audioOutputDeviceId) => {+ audioOutputDeviceId => {sendEvent('settings.changeDevice.audioOut');APP.settings.setAudioOutputDeviceId(audioOutputDeviceId).then(() => logger.log('changed audio output device'))- .catch((err) => {- logger.warn('Failed to change audio output device. ' +- 'Default or previously set audio output device ' +- 'will be used instead.', err);+ .catch(err => {+ logger.warn('Failed to change audio output device. '+ + 'Default or previously set audio output device '+ + 'will be used instead.', err);});});@@ -2076,6 +2242,7 @@ export default {tracks.find(track => track.jitsiTrack&& track.jitsiTrack.getType() === 'video'));+if (!isTrackInRedux) {this.muteVideo(audioOnly);}@@ -2093,9 +2260,11 @@ export default {UIEvents.TOGGLE_SCREENSHARING, this.toggleScreenSharing.bind(this));+ /* eslint-disable max-params */APP.UI.addListener(UIEvents.UPDATE_SHARED_VIDEO,(url, state, time, isMuted, volume) => {+ /* eslint-enable max-params */// send start and stop commands once, and remove any updates// that had leftif (state === 'stop'@@ -2105,43 +2274,41 @@ export default {room.sendCommandOnce(this.commands.defaults.SHARED_VIDEO, {value: url,attributes: {- state: state,- time: time,+ state,+ time,muted: isMuted,- volume: volume+ volume}});- }- else {+ } else {// in case of paused, in order to allow late users to join// pausedroom.removeCommand(this.commands.defaults.SHARED_VIDEO);room.sendCommand(this.commands.defaults.SHARED_VIDEO, {value: url,attributes: {- state: state,- time: time,+ state,+ time,muted: isMuted,- volume: volume+ volume}});}});room.addCommandListener(- this.commands.defaults.SHARED_VIDEO, ({value, attributes}, id) => {-+ this.commands.defaults.SHARED_VIDEO,+ ({ value, attributes }, id) => {if (attributes.state === 'stop') {APP.UI.onSharedVideoStop(id, attributes);- }- else if (attributes.state === 'start') {+ } else if (attributes.state === 'start') {APP.UI.onSharedVideoStart(id, value, attributes);- }- else if (attributes.state === 'playing'+ } else if (attributes.state === 'playing'|| attributes.state === 'pause') {APP.UI.onSharedVideoUpdate(id, value, attributes);}});},+/*** Adds any room listener.* @param {string} eventName one of the JitsiConferenceEvents@@ -2190,7 +2357,7 @@ export default {APP.store.dispatch(updateDeviceList(devices));});- this.deviceChangeListener = (devices) =>+ this.deviceChangeListener = devices =>window.setTimeout(() => this._onDeviceListChanged(devices), 0);JitsiMeetJS.mediaDevices.addEventListener(@@ -2198,10 +2365,11 @@ export default {this.deviceChangeListener);}})- .catch((error) => {+ .catch(error => {logger.warn(`Error getting device list: ${error}`);});},+/*** Event listener for JitsiMediaDevicesEvents.DEVICE_LIST_CHANGED to* handle change of available media devices.@@ -2214,26 +2382,26 @@ export default {// Event handler can be fired before direct// enumerateDevices() call, so handle this situation here.- if (!currentDevices.audioinput &&- !currentDevices.videoinput &&- !currentDevices.audiooutput) {+ if (!currentDevices.audioinput+ && !currentDevices.videoinput+ && !currentDevices.audiooutput) {mediaDeviceHelper.setCurrentMediaDevices(devices);currentDevices = mediaDeviceHelper.getCurrentMediaDevices();}- let newDevices =- mediaDeviceHelper.getNewMediaDevicesAfterDeviceListChanged(+ const newDevices+ = mediaDeviceHelper.getNewMediaDevicesAfterDeviceListChanged(devices,this.isSharingScreen,this.localVideo,this.localAudio);- let promises = [];- let audioWasMuted = this.isLocalAudioMuted();- let videoWasMuted = this.isLocalVideoMuted();- let availableAudioInputDevices =- mediaDeviceHelper.getDevicesFromListByKind(devices, 'audioinput');- let availableVideoInputDevices =- mediaDeviceHelper.getDevicesFromListByKind(devices, 'videoinput');+ const promises = [];+ const audioWasMuted = this.isLocalAudioMuted();+ const videoWasMuted = this.isLocalVideoMuted();+ const availableAudioInputDevices+ = mediaDeviceHelper.getDevicesFromListByKind(devices, 'audioinput');+ const availableVideoInputDevices+ = mediaDeviceHelper.getDevicesFromListByKind(devices, 'videoinput');if (typeof newDevices.audiooutput !== 'undefined') {// Just ignore any errors in catch block.@@ -2252,9 +2420,9 @@ export default {.then(() => {// If audio was muted before, or we unplugged current device// and selected new one, then mute new audio track.- if (audioWasMuted ||- currentDevices.audioinput.length >- availableAudioInputDevices.length) {+ if (audioWasMuted+ || currentDevices.audioinput.length+ > availableAudioInputDevices.length) {sendEvent('deviceListChanged.audio.muted');logger.log('Audio mute: device list changed');muteLocalAudio(true);@@ -2262,10 +2430,10 @@ export default {// If video was muted before, or we unplugged current device// and selected new one, then mute new video track.- if (!this.isSharingScreen &&- (videoWasMuted ||- currentDevices.videoinput.length >- availableVideoInputDevices.length)) {+ if (!this.isSharingScreen+ && (videoWasMuted+ || currentDevices.videoinput.length+ > availableVideoInputDevices.length)) {sendEvent('deviceListChanged.video.muted');logger.log('Video mute: device list changed');muteLocalVideo(true);@@ -2293,10 +2461,10 @@ export default {const available = audioDeviceCount > 0 || Boolean(this.localAudio);logger.debug(- 'Microphone button enabled: ' + available,- 'local audio: ' + this.localAudio,- 'audio devices: ' + audioMediaDevices,- 'device count: ' + audioDeviceCount);+ `Microphone button enabled: ${available}`,+ `local audio: ${this.localAudio}`,+ `audio devices: ${audioMediaDevices}`,+ `device count: ${audioDeviceCount}`);APP.store.dispatch(setAudioAvailable(available));APP.API.notifyAudioAvailabilityChanged(available);@@ -2310,6 +2478,7 @@ export default {= mediaDeviceHelper.getCurrentMediaDevices().videoinput;const videoDeviceCount= videoMediaDevices ? videoMediaDevices.length : 0;+// The video functionality is considered available if there are any// video devices detected or if there is local video stream already// active which could be either screensharing stream or a video track@@ -2318,10 +2487,10 @@ export default {const available = videoDeviceCount > 0 || Boolean(this.localVideo);logger.debug(- 'Camera button enabled: ' + available,- 'local video: ' + this.localVideo,- 'video devices: ' + videoMediaDevices,- 'device count: ' + videoDeviceCount);+ `Camera button enabled: ${available}`,+ `local video: ${this.localVideo}`,+ `video devices: ${videoMediaDevices}`,+ `device count: ${videoDeviceCount}`);APP.store.dispatch(setVideoAvailable(available));APP.API.notifyVideoAvailabilityChanged(available);@@ -2338,13 +2507,14 @@ export default {* Sets the local "raised hand" status to a particular value.*/setRaisedHand(raisedHand) {- if (raisedHand !== this.isHandRaised)- {+ if (raisedHand !== this.isHandRaised) {APP.UI.onLocalRaiseHandChanged(raisedHand);this.isHandRaised = raisedHand;+// Advertise the updated status- room.setLocalParticipantProperty("raisedHand", raisedHand);+ room.setLocalParticipantProperty('raisedHand', raisedHand);+// Update the viewAPP.UI.setLocalRaisedHandStatus(raisedHand);}@@ -2360,11 +2530,17 @@ export default {* NOTE: Should be used after conference.init*/logEvent(name, value, label) {- sendEvent(name, {value, label});+ sendEvent(name, {+ value,+ label+ });if (room) {- room.sendApplicationLog(JSON.stringify({name, value, label}));+ room.sendApplicationLog(JSON.stringify({ name,+ value,+ label }));}},+/*** Methods logs an application event given in the JSON format.* @param {string} logJSON an event to be logged in JSON format@@ -2374,6 +2550,7 @@ export default {room.sendApplicationLog(logJSON);}},+/*** Disconnect from the conference and optionally request user feedback.* @param {boolean} [requestFeedback=false] if user feedback should be@@ -2387,6 +2564,7 @@ export default {if (requestFeedback) {requestFeedbackPromise= APP.store.dispatch(maybeOpenFeedbackDialog(room))+// false because the thank you dialog shouldn't be displayed.catch(() => Promise.resolve(false));} else {@@ -2413,9 +2591,9 @@ export default {changeLocalEmail(email = '') {const localParticipant = getLocalParticipant(APP.store.getState());- email = String(email).trim();+ const formattedEmail = String(email).trim();- if (email === localParticipant.email) {+ if (formattedEmail === localParticipant.email) {return;}@@ -2424,12 +2602,12 @@ export default {APP.store.dispatch(participantUpdated({id: localId,local: true,+ formattedEmail}));- APP.settings.setEmail(email);- APP.UI.setUserEmail(localId, email);- sendData(commands.EMAIL, email);+ APP.settings.setEmail(formattedEmail);+ APP.UI.setUserEmail(localId, formattedEmail);+ sendData(commands.EMAIL, formattedEmail);},/**@@ -2439,16 +2617,16 @@ export default {changeLocalAvatarUrl(url = '') {const { avatarURL, id } = getLocalParticipant(APP.store.getState());- url = String(url).trim();+ const formattedUrl = String(url).trim();- if (url === avatarURL) {+ if (formattedUrl === avatarURL) {return;}APP.store.dispatch(participantUpdated({id,local: true,- avatarURL: url+ avatarURL: formattedUrl}));APP.settings.setAvatarUrl(url);diff --git a/config.js b/config.jsindex bdec549281..926454416d 100644--- a/config.js+++ b/config.js@@ -1,12 +1,13 @@+/* eslint-disable no-unused-vars, no-var */var config = { // eslint-disable-line no-unused-vars// Configuration//// Alternative location for the configuration.- //configLocation: './config.json',+ // configLocation: './config.json',// Custom function which given the URL path should return a room name.- //getroomnode: function (path) { return 'someprefixpossiblybasedonpath'; },+ // getroomnode: function (path) { return 'someprefixpossiblybasedonpath'; },// Connection@@ -17,22 +18,22 @@ var config = { // eslint-disable-line no-unused-varsdomain: 'jitsi-meet.example.com',// XMPP MUC domain. FIXME: use XEP-0030 to discover it.- muc: 'conference.jitsi-meet.example.com',+ muc: 'conference.jitsi-meet.example.com'// When using authentication, domain for guest users.- //anonymousdomain: 'guest.example.com',+ // anonymousdomain: 'guest.example.com',// Domain for authenticated users. Defaults to <domain>.- //authdomain: 'jitsi-meet.example.com',+ // authdomain: 'jitsi-meet.example.com',// Jirecon recording component domain.- //jirecon: 'jirecon.jitsi-meet.example.com',+ // jirecon: 'jirecon.jitsi-meet.example.com',// Call control component (Jigasi).- //call_control: 'callcontrol.jitsi-meet.example.com',+ // call_control: 'callcontrol.jitsi-meet.example.com',// Focus component domain. Defaults to focus.<domain>.- //focus: 'focus.jitsi-meet.example.com',+ // focus: 'focus.jitsi-meet.example.com',},// BOSH URL. FIXME: use XEP-0156 to discover it.@@ -42,7 +43,7 @@ var config = { // eslint-disable-line no-unused-varsclientNode: 'http://jitsi.org/jitsimeet',// The real JID of focus participant - can be overridden here- //focusUserJid: '[email protected]',+ // focusUserJid: '[email protected]',// Testing / experimental features.@@ -51,18 +52,19 @@ var config = { // eslint-disable-line no-unused-varstesting: {// Enables experimental simulcast support on Firefox.enableFirefoxSimulcast: false,+// P2P test mode disables automatic switching to P2P when there are 2// participants in the conference.- p2pTestMode: false,+ p2pTestMode: false},// Disables ICE/UDP by filtering out local and remote UDP candidates in// signalling.- //webrtcIceUdpDisable: false,+ // webrtcIceUdpDisable: false,// Disables ICE/TCP by filtering out local and remote TCP candidates in// signalling.- //webrtcIceTcpDisable: false,+ // webrtcIceTcpDisable: false,// Media@@ -71,52 +73,52 @@ var config = { // eslint-disable-line no-unused-vars// Audio// Disable measuring of audio levels.- //disableAudioLevels: false,+ // disableAudioLevels: false,// Start the conference in audio only mode (no video is being received nor// sent).- //startAudioOnly: false,+ // startAudioOnly: false,// Every participant after the Nth will start audio muted.- //startAudioMuted: 10,+ // startAudioMuted: 10,// Start calls with audio muted. Unlike the option above, this one is only// applied locally. FIXME: having these 2 options is confusing.- //startWithAudioMuted: false,+ // startWithAudioMuted: false,// Video// Sets the preferred resolution (height) for local video. Defaults to 720.- //resolution: 720,+ // resolution: 720,// Enable / disable simulcast support.- //disableSimulcast: false,+ // disableSimulcast: false,// Suspend sending video if bandwidth estimation is too low. This may cause// problems with audio playback. Disabled until these are fixed.disableSuspendVideo: true,// Every participant after the Nth will start video muted.- //startVideoMuted: 10,+ // startVideoMuted: 10,// Start calls with video muted. Unlike the option above, this one is only// applied locally. FIXME: having these 2 options is confusing.- //startWithVideoMuted: false,+ // startWithVideoMuted: false,// If set to true, prefer to use the H.264 video codec (if supported).// Note that it's not recommended to do this because simulcast is not// supported when using H.264. For 1-to-1 calls this setting is enabled by// default and can be toggled in the p2p section.- //preferH264: true,+ // preferH264: true,// If set to true, disable H.264 video codec by stripping it out of the// SDP.- //disableH264: false,+ // disableH264: false,// Desktop sharing// Enable / disable desktop sharing- //disableDesktopSharing: false,+ // disableDesktopSharing: false,// The ID of the jidesha extension for Chrome.desktopSharingChromeExtId: null,@@ -126,7 +128,7 @@ var config = { // eslint-disable-line no-unused-vars// The media sources to use when using screen sharing with the Chrome// extension.- desktopSharingChromeSources: ['screen', 'window', 'tab'],+ desktopSharingChromeSources: [ 'screen', 'window', 'tab' ],// Required version of Chrome extensiondesktopSharingChromeMinExtVersion: '0.1',@@ -149,15 +151,15 @@ var config = { // eslint-disable-line no-unused-varsdesktopSharingFirefoxExtensionURL: null,// Try to start calls with screen-sharing instead of camera video.- //startScreenSharing: false,+ // startScreenSharing: false,// Recording// Whether to enable recording or not.- //enableRecording: false,+ // enableRecording: false,// Type for recording: one of jibri or jirecon.- //recordingType: 'jibri',+ // recordingType: 'jibri',// Misc@@ -165,29 +167,29 @@ var config = { // eslint-disable-line no-unused-varschannelLastN: -1,// Disables or enables RTX (RFC 4588) (defaults to false).- //disableRtx: false,+ // disableRtx: false,// Use XEP-0215 to fetch STUN and TURN servers.- //useStunTurn: true,+ // useStunTurn: true,// Enable IPv6 support.- //useIPv6: true,+ // useIPv6: true,// Enables / disables a data communication channel with the Videobridge.// Values can be 'datachannel', 'websocket', true (treat it as// 'datachannel'), undefined (treat it as 'datachannel') and false (don't// open any channel).- //openBridgeChannel: true,+ // openBridgeChannel: true,// UI//// Use display name as XMPP nickname.- //useNicks: false,+ // useNicks: false,// Require users to always specify a display name.- //requireDisplayName: true,+ // requireDisplayName: true,// Whether to use a welcome page or not. In case it's false a random room// will be joined when no room is specified.@@ -195,17 +197,19 @@ var config = { // eslint-disable-line no-unused-vars// Enabling the close page will ignore the welcome page redirection when// a call is hangup.- //enableClosePage: false,+ // enableClosePage: false,// Disable hiding of remote thumbnails when in a 1-on-1 conference call.- //disable1On1Mode: false,+ // disable1On1Mode: false,++ // The minumum value a video's height (or width, whichever is smaller) needs// The minimum value a video's height (or width, whichever is smaller) needs// to be in order to be considered high-definition.minHDHeight: 540,// Default language for the user interface.- //defaultLanguage: 'en',+ // defaultLanguage: 'en',// If true all users without a token will be considered guests and all users// with token will be considered non-guests. Only guests will be allowed to@@ -214,19 +218,19 @@ var config = { // eslint-disable-line no-unused-vars// Message to show the users. Example: 'The service will be down for// maintenance at 01:00 AM GMT,- //noticeMessage: '',+ // noticeMessage: '',// Stats//// Whether to enable stats collection or not.- //disableStats: false,+ // disableStats: false,// To enable sending statistics to callstats.io you must provide the// Application ID and Secret.- //callStatsID: '',- //callStatsSecret: '',+ // callStatsID: '',+ // callStatsSecret: '',// Privacy@@ -235,7 +239,7 @@ var config = { // eslint-disable-line no-unused-vars// If third party requests are disabled, no other server will be contacted.// This means avatars will be locally generated and callstats integration// will not function.- //disableThirdPartyRequests: false,+ // disableThirdPartyRequests: false,// Peer-To-Peer mode: used (if enabled) when there are just 2 participants.@@ -251,13 +255,13 @@ var config = { // eslint-disable-line no-unused-varsenabled: true,// Use XEP-0215 to fetch STUN and TURN servers.- //useStunTurn: true,+ // useStunTurn: true,// The STUN servers that will be used in the peer to peer connectionsstunServers: [- { urls: "stun:stun.l.google.com:19302" },- { urls: "stun:stun1.l.google.com:19302" },- { urls: "stun:stun2.l.google.com:19302" }+ { urls: 'stun:stun.l.google.com:19302' },+ { urls: 'stun:stun1.l.google.com:19302' },+ { urls: 'stun:stun2.l.google.com:19302' }],// If set to true, it will prefer to use H.264 for P2P calls (if H.264@@ -266,11 +270,11 @@ var config = { // eslint-disable-line no-unused-vars// If set to true, disable H.264 video codec by stripping it out of the// SDP.- //disableH264: false,+ // disableH264: false,// How long we're going to wait, before going back to P2P after the 3rd// participant has left the conference (to filter out page reload).- //backToP2PDelay: 5+ // backToP2PDelay: 5},@@ -279,8 +283,9 @@ var config = { // eslint-disable-line no-unused-vars//deploymentInfo: {- //shard: "shard1",- //region: "europe",- //userRegion: "asia"+ // shard: "shard1",+ // region: "europe",+ // userRegion: "asia"}};+/* eslint-enable no-unused-vars, no-var */diff --git a/connection.js b/connection.jsindex 5c7f6e5de6..5e0e7aef38 100644--- a/connection.js+++ b/connection.js@@ -13,7 +13,7 @@ import {JitsiConnectionEvents} from './react/features/base/lib-jitsi-meet';-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);/*** Checks if we have data to use attach instead of connect. If we have the data@@ -27,26 +27,31 @@ const logger = require("jitsi-meet-logger").getLogger(__filename);* @param {string} [roomName] the name of the conference.*/function checkForAttachParametersAndConnect(id, password, connection) {- if(window.XMPPAttachInfo){- APP.connect.status = "connecting";+ if (window.XMPPAttachInfo) {+ APP.connect.status = 'connecting';+// When connection optimization is not deployed or enabled the default// value will be window.XMPPAttachInfo.status = "error"// If the connection optimization is deployed and enabled and there is// a failure the value will be window.XMPPAttachInfo.status = "error"- if(window.XMPPAttachInfo.status === "error") {- connection.connect({id, password});+ if (window.XMPPAttachInfo.status === 'error') {+ connection.connect({ id,+ password });+return;}- var attachOptions = window.XMPPAttachInfo.data;- if(attachOptions) {+ const attachOptions = window.XMPPAttachInfo.data;++ if (attachOptions) {connection.attach(attachOptions);delete window.XMPPAttachInfo.data;} else {- connection.connect({id, password});+ connection.connect({ id,+ password });}} else {- APP.connect.status = "ready";+ APP.connect.status = 'ready';APP.connect.handler = checkForAttachParametersAndConnect.bind(null,id, password, connection);}@@ -64,15 +69,15 @@ function connect(id, password, roomName) {const connectionConfig = Object.assign({}, config);const { issuer, jwt } = APP.store.getState()['features/base/jwt'];- connectionConfig.bosh += '?room=' + roomName;+ connectionConfig.bosh += `?room=${roomName}`;- let connection+ const connection= new JitsiMeetJS.JitsiConnection(null,jwt && issuer && issuer !== 'anonymous' ? jwt : undefined,connectionConfig);- return new Promise(function (resolve, reject) {+ return new Promise((resolve, reject) => {connection.addEventListener(JitsiConnectionEvents.CONNECTION_ESTABLISHED,handleConnectionEstablished);@@ -83,6 +88,9 @@ function connect(id, password, roomName) {JitsiConnectionEvents.CONNECTION_FAILED,connectionFailedHandler);+ /**+ *+ */function connectionFailedHandler(error, message, credentials) {APP.store.dispatch(connectionFailed(connection, error, message, credentials));@@ -94,6 +102,9 @@ function connect(id, password, roomName) {}}+ /**+ *+ */function unsubscribe() {connection.removeEventListener(JitsiConnectionEvents.CONNECTION_ESTABLISHED,@@ -103,15 +114,21 @@ function connect(id, password, roomName) {handleConnectionFailed);}+ /**+ *+ */function handleConnectionEstablished() {APP.store.dispatch(connectionEstablished(connection));unsubscribe();resolve(connection);}+ /**+ *+ */function handleConnectionFailed(err) {unsubscribe();- logger.error("CONNECTION FAILED:", err);+ logger.error('CONNECTION FAILED:', err);reject(err);}@@ -132,17 +149,17 @@ function connect(id, password, roomName) {** @returns {Promise<JitsiConnection>}*/-export function openConnection({id, password, retry, roomName}) {- let usernameOverride- = jitsiLocalStorage.getItem("xmpp_username_override");- let passwordOverride- = jitsiLocalStorage.getItem("xmpp_password_override");+export function openConnection({ id, password, retry, roomName }) {+ const usernameOverride+ = jitsiLocalStorage.getItem('xmpp_username_override');+ const passwordOverride+ = jitsiLocalStorage.getItem('xmpp_password_override');if (usernameOverride && usernameOverride.length > 0) {- id = usernameOverride;+ id = usernameOverride; // eslint-disable-line no-param-reassign}if (passwordOverride && passwordOverride.length > 0) {- password = passwordOverride;+ password = passwordOverride; // eslint-disable-line no-param-reassign}return connect(id, password, roomName).catch(err => {diff --git a/index.html b/index.htmlindex 3884188b34..6f16502dcb 100644--- a/index.html+++ b/index.html@@ -72,9 +72,9 @@+ "font-size: medium;"+ "font-weight: 400;"+ "transform: translate(-50%, -50%)'>"- + "Uh oh! We couldn't fully download everything we needed :(" // jshint ignore:line+ + "Uh oh! We couldn't fully download everything we needed :("+ "<br/> "- + "We will try again shortly. In the mean time, check for problems with your Internet connection!" // jshint ignore:line+ + "We will try again shortly. In the mean time, check for problems with your Internet connection!"+ "<br/><br/> "+ "<div id='moreInfo' style='"+ "display: none;'>" + "Missing " + fileRefdiff --git a/interface_config.js b/interface_config.jsindex 72e89469d9..a36f59d4ba 100644--- a/interface_config.js+++ b/interface_config.js@@ -1,7 +1,9 @@-var interfaceConfig = { // eslint-disable-line no-unused-vars+/* eslint-disable no-unused-vars, no-var, max-len */+var interfaceConfig = {// TO FIX: this needs to be handled from SASS variables. There are some// methods allowing to use variables both in css and js.DEFAULT_BACKGROUND: '#474747',+/*** In case the desktop sharing is disabled through the config the button* will not be hidden, but displayed as disabled with this text us as@@ -10,45 +12,53 @@ var interfaceConfig = { // eslint-disable-line no-unused-varsDESKTOP_SHARING_BUTTON_DISABLED_TOOLTIP: null,INITIAL_TOOLBAR_TIMEOUT: 20000,TOOLBAR_TIMEOUT: 4000,- DEFAULT_REMOTE_DISPLAY_NAME: "Fellow Jitster",- DEFAULT_LOCAL_DISPLAY_NAME: "me",+ DEFAULT_REMOTE_DISPLAY_NAME: 'Fellow Jitster',+ DEFAULT_LOCAL_DISPLAY_NAME: 'me',SHOW_JITSI_WATERMARK: true,- JITSI_WATERMARK_LINK: "https://jitsi.org",+ JITSI_WATERMARK_LINK: 'https://jitsi.org',+// if watermark is disabled by default, it can be shown only for guestsSHOW_WATERMARK_FOR_GUESTS: true,SHOW_BRAND_WATERMARK: false,- BRAND_WATERMARK_LINK: "",+ BRAND_WATERMARK_LINK: '',SHOW_POWERED_BY: false,GENERATE_ROOMNAMES_ON_WELCOME_PAGE: true,- APP_NAME: "Jitsi Meet",- LANG_DETECTION: false, // Allow i18n to detect the system language+ APP_NAME: 'Jitsi Meet',+ LANG_DETECTION: false, // Allow i18n to detect the system languageINVITATION_POWERED_BY: true,+/*** If we should show authentication block in profile*/AUTHENTICATION_ENABLE: true,+/*** the toolbar buttons line is intentionally left in one line, to be able* to easily override values or remove them using regex*/TOOLBAR_BUTTONS: [- //main toolbar- 'microphone', 'camera', 'desktop', 'invite', 'fullscreen', 'fodeviceselection', 'hangup', // jshint ignore:line- //extended toolbar- 'profile', 'contacts', 'info', 'chat', 'recording', 'etherpad', 'sharedvideo', 'settings', 'raisehand', 'videoquality', 'filmstrip'], // jshint ignore:line++ // main toolbar+ 'microphone', 'camera', 'desktop', 'invite', 'fullscreen', 'fodeviceselection', 'hangup',++ // extended toolbar+ 'profile', 'contacts', 'info', 'chat', 'recording', 'etherpad', 'sharedvideo', 'settings', 'raisehand', 'videoquality', 'filmstrip' ],+/*** Main Toolbar Buttons* All of them should be in TOOLBAR_BUTTONS*/- MAIN_TOOLBAR_BUTTONS: ['microphone', 'camera', 'desktop', 'invite', 'fullscreen', 'fodeviceselection', 'hangup'], // jshint ignore:line- SETTINGS_SECTIONS: ['language', 'devices', 'moderator'],- INVITE_OPTIONS: ['invite', 'dialout', 'addtocall'],+ MAIN_TOOLBAR_BUTTONS: [ 'microphone', 'camera', 'desktop', 'invite', 'fullscreen', 'fodeviceselection', 'hangup' ],+ SETTINGS_SECTIONS: [ 'language', 'devices', 'moderator' ],+ INVITE_OPTIONS: [ 'invite', 'dialout', 'addtocall' ],+// Determines how the video would fit the screen. 'both' would fit the whole// screen, 'height' would fit the original video height to the height of the// screen, 'width' would fit the original video width to the width of the// screen respecting ratio.VIDEO_LAYOUT_FIT: 'both',SHOW_CONTACTLIST_AVATARS: true,+/*** Whether to only show the filmstrip (and hide the toolbar).*/@@ -59,11 +69,12 @@ var interfaceConfig = { // eslint-disable-line no-unused-vars*/VERTICAL_FILMSTRIP: true,- //A html text to be shown to guests on the close page, false disables it+ // A html text to be shown to guests on the close page, false disables itCLOSE_PAGE_GUEST_HINT: false,RANDOM_AVATAR_URL_PREFIX: false,RANDOM_AVATAR_URL_SUFFIX: false,FILM_STRIP_MAX_HEIGHT: 120,+// Enables feedback star animation.ENABLE_FEEDBACK_ANIMATION: false,DISABLE_FOCUS_INDICATOR: false,@@ -76,13 +87,13 @@ var interfaceConfig = { // eslint-disable-line no-unused-vars* @type {boolean}*/DISABLE_RINGING: false,- AUDIO_LEVEL_PRIMARY_COLOR: "rgba(255,255,255,0.4)",- AUDIO_LEVEL_SECONDARY_COLOR: "rgba(255,255,255,0.2)",+ AUDIO_LEVEL_PRIMARY_COLOR: 'rgba(255,255,255,0.4)',+ AUDIO_LEVEL_SECONDARY_COLOR: 'rgba(255,255,255,0.2)',POLICY_LOGO: null,- LOCAL_THUMBNAIL_RATIO: 16/9, //16:9- REMOTE_THUMBNAIL_RATIO: 1, //1:1+ LOCAL_THUMBNAIL_RATIO: 16 / 9, // 16:9+ REMOTE_THUMBNAIL_RATIO: 1, // 1:1// Documentation reference for the live streaming feature.- LIVE_STREAMING_HELP_LINK: "https://jitsi.org/live",+ LIVE_STREAMING_HELP_LINK: 'https://jitsi.org/live',/*** Whether the mobile app Jitsi Meet is to be promoted to participants@@ -131,3 +142,4 @@ var interfaceConfig = { // eslint-disable-line no-unused-vars*/// ADD_PEOPLE_APP_NAME: ""};+/* eslint-enable no-unused-vars, no-var, max-len */diff --git a/logging_config.js b/logging_config.jsindex 5dd95b3bab..e8270d1abf 100644--- a/logging_config.js+++ b/logging_config.js@@ -1,10 +1,15 @@+/* eslint-disable no-unused-vars, no-var */// Logging configuration-var loggingConfig = { // eslint-disable-line no-unused-vars- //default log level for the app and lib-jitsi-meet+var loggingConfig = {+ // default log level for the app and lib-jitsi-meetdefaultLogLevel: 'trace',+// Option to disable LogCollector (which stores the logs on CallStats)- //disableLogCollector: true,+ // disableLogCollector: true,+// Logging level adjustments for verbose modules:'modules/xmpp/strophe.util.js': 'log','modules/statistics/CallStats.js': 'info'-};\ No newline at end of file+};++/* eslint-enable no-unused-vars, no-var */diff --git a/modules/FollowMe.js b/modules/FollowMe.jsindex a5dc1050d3..85f1b79edb 100644--- a/modules/FollowMe.js+++ b/modules/FollowMe.js@@ -13,7 +13,7 @@* See the License for the specific language governing permissions and* limitations under the License.*/-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);import UIEvents from '../service/UI/UIEvents';import VideoLayout from './UI/videolayout/VideoLayout';@@ -23,7 +23,7 @@ import VideoLayout from './UI/videolayout/VideoLayout';* {State} for the local state at the time of this writing) of a {FollowMe}* (instance) between participants.*/-const _COMMAND = "follow-me";+const _COMMAND = 'follow-me';/*** The timeout after which a follow-me command that has been received will be@@ -50,34 +50,61 @@ class State {* the property, the old value of the property before the change, and the* new value of the property after the change.*/- constructor (propertyChangeCallback) {+ constructor(propertyChangeCallback) {this._propertyChangeCallback = propertyChangeCallback;}- get filmstripVisible () { return this._filmstripVisible; }+ /**+ *+ */+ get filmstripVisible() {+ return this._filmstripVisible;+ }++ /**+ *+ */+ set filmstripVisible(b) {+ const oldValue = this._filmstripVisible;- set filmstripVisible (b) {- var oldValue = this._filmstripVisible;if (oldValue !== b) {this._filmstripVisible = b;this._firePropertyChange('filmstripVisible', oldValue, b);}}- get nextOnStage() { return this._nextOnStage; }+ /**+ *+ */+ get nextOnStage() {+ return this._nextOnStage;+ }+ /**+ *+ */set nextOnStage(id) {- var oldValue = this._nextOnStage;+ const oldValue = this._nextOnStage;+if (oldValue !== id) {this._nextOnStage = id;this._firePropertyChange('nextOnStage', oldValue, id);}}- get sharedDocumentVisible () { return this._sharedDocumentVisible; }+ /**+ *+ */+ get sharedDocumentVisible() {+ return this._sharedDocumentVisible;+ }++ /**+ *+ */+ set sharedDocumentVisible(b) {+ const oldValue = this._sharedDocumentVisible;- set sharedDocumentVisible (b) {- var oldValue = this._sharedDocumentVisible;if (oldValue !== b) {this._sharedDocumentVisible = b;this._firePropertyChange('sharedDocumentVisible', oldValue, b);@@ -93,10 +120,12 @@ class State {* @param oldValue the value of {property} before the change* @param newValue the value of {property} after the change*/- _firePropertyChange (property, oldValue, newValue) {- var propertyChangeCallback = this._propertyChangeCallback;- if (propertyChangeCallback)+ _firePropertyChange(property, oldValue, newValue) {+ const propertyChangeCallback = this._propertyChangeCallback;++ if (propertyChangeCallback) {propertyChangeCallback(property, oldValue, newValue);+ }}}@@ -118,7 +147,7 @@ class FollowMe {* destination (model/state) to receive from the remote moderator if the* local participant is not the moderator*/- constructor (conference, UI) {+ constructor(conference, UI) {this._conference = conference;this._UI = UI;this.nextOnStageTimer = 0;@@ -150,9 +179,10 @@ class FollowMe {this._nextOnStage(pinnedId, Boolean(pinnedId));// check whether shared document is enabled/initialized- if(this._UI.getSharedDocumentManager())+ if (this._UI.getSharedDocumentManager()) {this._sharedDocumentToggled.bind(this, this._UI.getSharedDocumentManager().isVisible());+ }}/**@@ -162,20 +192,21 @@ class FollowMe {* the states of interest.* @private*/- _addFollowMeListeners () {+ _addFollowMeListeners() {this.filmstripEventHandler = this._filmstripToggled.bind(this);this._UI.addListener(UIEvents.TOGGLED_FILMSTRIP,this.filmstripEventHandler);- var self = this;- this.pinnedEndpointEventHandler = function (videoId, isPinned) {+ const self = this;++ this.pinnedEndpointEventHandler = function(videoId, isPinned) {self._nextOnStage(videoId, isPinned);};this._UI.addListener(UIEvents.PINNED_ENDPOINT,this.pinnedEndpointEventHandler);this.sharedDocEventHandler = this._sharedDocumentToggled.bind(this);- this._UI.addListener( UIEvents.TOGGLED_SHARED_DOCUMENT,+ this._UI.addListener(UIEvents.TOGGLED_SHARED_DOCUMENT,this.sharedDocEventHandler);}@@ -183,7 +214,7 @@ class FollowMe {* Removes all follow me listeners.* @private*/- _removeFollowMeListeners () {+ _removeFollowMeListeners() {this._UI.removeListener(UIEvents.TOGGLED_FILMSTRIP,this.filmstripEventHandler);this._UI.removeListener(UIEvents.TOGGLED_SHARED_DOCUMENT,@@ -198,13 +229,13 @@ class FollowMe {* @param enable {true} to enable the follow me functionality, {false} -* to disable it*/- enableFollowMe (enable) {+ enableFollowMe(enable) {if (enable) {this._setFollowMeInitialState();this._addFollowMeListeners();- }- else+ } else {this._removeFollowMeListeners();+ }}/**@@ -214,7 +245,7 @@ class FollowMe {* @param filmstripVisible {Boolean} {true} if the filmstrip was shown (as a* result of the toggle) or {false} if the filmstrip was hidden*/- _filmstripToggled (filmstripVisible) {+ _filmstripToggled(filmstripVisible) {this._local.filmstripVisible = filmstripVisible;}@@ -225,7 +256,7 @@ class FollowMe {* @param sharedDocumentVisible {Boolean} {true} if the shared document was* shown (as a result of the toggle) or {false} if it was hidden*/- _sharedDocumentToggled (sharedDocumentVisible) {+ _sharedDocumentToggled(sharedDocumentVisible) {this._local.sharedDocumentVisible = sharedDocumentVisible;}@@ -237,13 +268,16 @@ class FollowMe {* unpinned* @private*/- _nextOnStage (videoId, isPinned) {- if (!this._conference.isModerator)+ _nextOnStage(videoId, isPinned) {+ if (!this._conference.isModerator) {return;+ }++ let nextOnStage = null;- var nextOnStage = null;- if(isPinned)+ if (isPinned) {nextOnStage = videoId;+ }this._local.nextOnStage = nextOnStage;}@@ -251,24 +285,25 @@ class FollowMe {/*** Sends the follow-me command, when a local property change occurs.*- * @param property the property name- * @param oldValue the old value- * @param newValue the new value* @private*/- // eslint-disable-next-line no-unused-vars- _localPropertyChange (property, oldValue, newValue) {+ _localPropertyChange() { // eslint-disable-next-line no-unused-vars// Only a moderator is allowed to send commands.const conference = this._conference;- if (!conference.isModerator)++ if (!conference.isModerator) {return;+ }const commands = conference.commands;+// XXX The "Follow Me" command represents a snapshot of all states// which are to be followed so don't forget to removeCommand before// sendCommand!+commands.removeCommand(_COMMAND);const local = this._local;+commands.sendCommandOnce(_COMMAND,{@@ -289,22 +324,24 @@ class FollowMe {* notable idiosyncrasy of the Command(s) API to be mindful of here is that* the command may be issued by the local participant.*/- _onFollowMeCommand ({ attributes }, id) {+ _onFollowMeCommand({ attributes }, id) {// We require to know who issued the command because (1) only a// moderator is allowed to send commands and (2) a command MUST be// issued by a defined commander.- if (typeof id === 'undefined')+ if (typeof id === 'undefined') {return;+ }// The Command(s) API will send us our own commands and we don't want// to act upon them.- if (this._conference.isLocalId(id))+ if (this._conference.isLocalId(id)) {return;+ }++ if (!this._conference.isParticipantModerator(id)) {+ logger.warn('Received follow-me command '+ + 'not from moderator');- if (!this._conference.isParticipantModerator(id))- {- logger.warn('Received follow-me command ' +- 'not from moderator');return;}@@ -328,14 +365,16 @@ class FollowMe {// attributes, at least) at the time of this writing so take into// account that what originated as a Boolean may be a String on// receipt.- filmstripVisible = (filmstripVisible == 'true');+ // eslint-disable-next-line eqeqeq, no-param-reassign+ filmstripVisible = filmstripVisible == 'true';// FIXME The UI (module) very likely doesn't (want to) expose its// eventEmitter as a public field. I'm not sure at the time of this// writing whether calling UI.toggleFilmstrip() is acceptable (from// a design standpoint) either.- if (filmstripVisible !== this._UI.isFilmstripVisible())+ if (filmstripVisible !== this._UI.isFilmstripVisible()) {this._UI.eventEmitter.emit(UIEvents.TOGGLE_FILMSTRIP);+ }}}@@ -347,22 +386,24 @@ class FollowMe {* @private*/_onNextOnStage(id) {- var clickId = null;- var pin;+ let clickId = null;+ let pin;+// if there is an id which is not pinned we schedule it for pin only the// first time- if(typeof id !== 'undefined' && !VideoLayout.isPinned(id)) {++ if (typeof id !== 'undefined' && !VideoLayout.isPinned(id)) {clickId = id;pin = true;- }- // if there is no id, but we have a pinned one, let's unpin- else if (typeof id == 'undefined' && VideoLayout.getPinnedId()) {+ } else if (typeof id === 'undefined' && VideoLayout.getPinnedId()) {+ // if there is no id, but we have a pinned one, let's unpinclickId = VideoLayout.getPinnedId();pin = false;}- if (clickId)+ if (clickId) {this._pinVideoThumbnailById(clickId, pin);+ }}/**@@ -378,11 +419,13 @@ class FollowMe {// attributes, at least) at the time of this writing so take into// account that what originated as a Boolean may be a String on// receipt.- sharedDocumentVisible = (sharedDocumentVisible == 'true');+ // eslint-disable-next-line eqeqeq, no-param-reassign+ sharedDocumentVisible = sharedDocumentVisible == 'true';if (sharedDocumentVisible- !== this._UI.getSharedDocumentManager().isVisible())+ !== this._UI.getSharedDocumentManager().isVisible()) {this._UI.getSharedDocumentManager().toggleEtherpad();+ }}}@@ -394,27 +437,31 @@ class FollowMe {* @private*/_pinVideoThumbnailById(clickId, pin) {- var self = this;- var smallVideo = VideoLayout.getSmallVideo(clickId);+ const self = this;+ const smallVideo = VideoLayout.getSmallVideo(clickId);// If the SmallVideo for the given clickId exists we proceed with the// pin/unpin.if (smallVideo) {this.nextOnStageTimer = 0;clearTimeout(this.nextOnStageTimout);+ /* eslint-disable no-mixed-operators */if (pin && !VideoLayout.isPinned(clickId)- || !pin && VideoLayout.isPinned(clickId))+ || !pin && VideoLayout.isPinned(clickId)) {+ /* eslint-disable no-mixed-operators */VideoLayout.handleVideoThumbClicked(clickId);- }- // If there's no SmallVideo object for the given id, lets wait and see- // if it's going to be created in the next 30sec.- else {- this.nextOnStageTimout = setTimeout(function () {+ }+ } else {+ // If there's no SmallVideo object for the given id, lets wait and+ // see if it's going to be created in the next 30sec.+ this.nextOnStageTimout = setTimeout(function() {if (self.nextOnStageTimer > _FOLLOW_ME_RECEIVED_TIMEOUT) {self.nextOnStageTimer = 0;+return;}+ // eslint-disable-next-line no-invalid-thisthis.nextOnStageTimer++;self._pinVideoThumbnailById(clickId, pin);}, 1000);diff --git a/modules/UI/UI.js b/modules/UI/UI.jsindex 9934a26d17..bf4a110902 100644--- a/modules/UI/UI.js+++ b/modules/UI/UI.js@@ -1,24 +1,24 @@/* global APP, $, config, interfaceConfig */-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);-var UI = {};+const UI = {};-import Chat from "./side_pannels/chat/Chat";-import SidePanels from "./side_pannels/SidePanels";-import Avatar from "./avatar/Avatar";-import SideContainerToggler from "./side_pannels/SideContainerToggler";-import messageHandler from "./util/MessageHandler";-import UIUtil from "./util/UIUtil";-import UIEvents from "../../service/UI/UIEvents";+import Chat from './side_pannels/chat/Chat';+import SidePanels from './side_pannels/SidePanels';+import Avatar from './avatar/Avatar';+import SideContainerToggler from './side_pannels/SideContainerToggler';+import messageHandler from './util/MessageHandler';+import UIUtil from './util/UIUtil';+import UIEvents from '../../service/UI/UIEvents';import EtherpadManager from './etherpad/Etherpad';import SharedVideoManager from './shared_video/SharedVideo';-import Recording from "./recording/Recording";+import Recording from './recording/Recording';-import VideoLayout from "./videolayout/VideoLayout";-import Filmstrip from "./videolayout/Filmstrip";-import SettingsMenu from "./side_pannels/settings/SettingsMenu";-import Profile from "./side_pannels/profile/Profile";+import VideoLayout from './videolayout/VideoLayout';+import Filmstrip from './videolayout/Filmstrip';+import SettingsMenu from './side_pannels/settings/SettingsMenu';+import Profile from './side_pannels/profile/Profile';import {openDeviceSelectionDialog@@ -43,11 +43,13 @@ import {showToolbox} from '../../react/features/toolbox';-var EventEmitter = require("events");+const EventEmitter = require('events');+UI.messageHandler = messageHandler;-import FollowMe from "../FollowMe";+import FollowMe from '../FollowMe';++const eventEmitter = new EventEmitter();-var eventEmitter = new EventEmitter();UI.eventEmitter = eventEmitter;let etherpadManager;@@ -62,38 +64,82 @@ const JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP = {JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.UNSUPPORTED_RESOLUTION]- = "dialog.cameraUnsupportedResolutionError";+ = 'dialog.cameraUnsupportedResolutionError';JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.GENERAL]- = "dialog.cameraUnknownError";+ = 'dialog.cameraUnknownError';JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.PERMISSION_DENIED]- = "dialog.cameraPermissionDeniedError";+ = 'dialog.cameraPermissionDeniedError';JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.NOT_FOUND]- = "dialog.cameraNotFoundError";+ = 'dialog.cameraNotFoundError';JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.CONSTRAINT_FAILED]- = "dialog.cameraConstraintFailedError";+ = 'dialog.cameraConstraintFailedError';JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.NO_DATA_FROM_SOURCE]- = "dialog.cameraNotSendingData";+ = 'dialog.cameraNotSendingData';JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[JitsiTrackErrors.GENERAL]- = "dialog.micUnknownError";+ = 'dialog.micUnknownError';JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[JitsiTrackErrors.PERMISSION_DENIED]- = "dialog.micPermissionDeniedError";+ = 'dialog.micPermissionDeniedError';JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[JitsiTrackErrors.NOT_FOUND]- = "dialog.micNotFoundError";+ = 'dialog.micNotFoundError';JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[JitsiTrackErrors.CONSTRAINT_FAILED]- = "dialog.micConstraintFailedError";+ = 'dialog.micConstraintFailedError';JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.microphone[JitsiTrackErrors.NO_DATA_FROM_SOURCE]- = "dialog.micNotSendingData";+ = 'dialog.micNotSendingData';++const UIListeners = new Map([+ [+ UIEvents.ETHERPAD_CLICKED,+ () => etherpadManager && etherpadManager.toggleEtherpad()+ ], [+ UIEvents.SHARED_VIDEO_CLICKED,+ () => sharedVideoManager && sharedVideoManager.toggleSharedVideo()+ ], [+ UIEvents.TOGGLE_FULLSCREEN,+ () => UI.toggleFullScreen()+ ], [+ UIEvents.TOGGLE_CHAT,+ () => UI.toggleChat()+ ], [+ UIEvents.TOGGLE_SETTINGS,+ () => {+ // Opening of device selection is special-cased as it is a dialog+ // opened through a button in settings and not directly displayed in+ // settings itself. As it is not useful to only have a settings menu+ // with a button to open a dialog, open the dialog directly instead.+ if (interfaceConfig.SETTINGS_SECTIONS.length === 1+ && UIUtil.isSettingEnabled('devices')) {+ APP.store.dispatch(openDeviceSelectionDialog());+ } else {+ UI.toggleSidePanel('settings_container');+ }+ }+ ], [+ UIEvents.TOGGLE_CONTACT_LIST,+ () => UI.toggleContactList()+ ], [+ UIEvents.TOGGLE_PROFILE,+ () => {+ UI.toggleSidePanel('profile_container');+ }+ ], [+ UIEvents.TOGGLE_FILMSTRIP,+ () => UI.handleToggleFilmstrip()+ ], [+ UIEvents.FOLLOW_ME_ENABLED,+ enabled => followMeHandler && followMeHandler.enableFollowMe(enabled)+ ]+]);/*** Toggles the application in and out of full screen mode* (a.k.a. presentation mode in Chrome).*/UI.toggleFullScreen = function() {- (UIUtil.isFullScreen())+ UIUtil.isFullScreen()? UIUtil.exitFullScreen(): UIUtil.enterFullScreen();};@@ -101,7 +147,7 @@ UI.toggleFullScreen = function() {/*** Notify user that server has shut down.*/-UI.notifyGracefulShutdown = function () {+UI.notifyGracefulShutdown = function() {messageHandler.openMessageDialog('dialog.serviceUnavailable','dialog.gracefulShutdown'@@ -111,31 +157,33 @@ UI.notifyGracefulShutdown = function () {/*** Notify user that reservation error happened.*/-UI.notifyReservationError = function (code, msg) {- var message = APP.translation.generateTranslationHTML(- "dialog.reservationErrorMsg", {code: code, msg: msg});+UI.notifyReservationError = function(code, msg) {+ const message = APP.translation.generateTranslationHTML(+ 'dialog.reservationErrorMsg', { code,+ msg });+messageHandler.openDialog(- "dialog.reservationError", message, true, {}, () => false);+ 'dialog.reservationError', message, true, {}, () => false);};/*** Notify user that he has been kicked from the server.*/-UI.notifyKicked = function () {+UI.notifyKicked = function() {messageHandler.openMessageDialog(- "dialog.sessTerminated",- "dialog.kickMessage");+ 'dialog.sessTerminated',+ 'dialog.kickMessage');};/*** Notify user that conference was destroyed.* @param reason {string} the reason text*/-UI.notifyConferenceDestroyed = function (reason) {- //FIXME: use Session Terminated from translation, but+UI.notifyConferenceDestroyed = function(reason) {+ // FIXME: use Session Terminated from translation, but// 'reason' text comes from XMPP packet and is not translatedmessageHandler.openDialog(- "dialog.sessTerminated", reason, true, {}, () => false);+ 'dialog.sessTerminated', reason, true, {}, () => false);};/**@@ -143,7 +191,7 @@ UI.notifyConferenceDestroyed = function (reason) {* @param err the Error* @param msg*/-UI.showChatError = function (err, msg) {+UI.showChatError = function(err, msg) {if (interfaceConfig.filmStripOnly) {return;}@@ -155,12 +203,12 @@ UI.showChatError = function (err, msg) {* @param {string} id user id* @param {string} displayName new nickname*/-UI.changeDisplayName = function (id, displayName) {+UI.changeDisplayName = function(id, displayName) {VideoLayout.onDisplayNameChanged(id, displayName);if (APP.conference.isLocalId(id) || id === 'localVideoContainer') {Profile.changeDisplayName(displayName);- Chat.setChatConversationMode(!!displayName);+ Chat.setChatConversationMode(Boolean(displayName));}};@@ -171,7 +219,7 @@ UI.changeDisplayName = function (id, displayName) {* currently in the interrupted state or <tt>false</tt> if the connection* is fine.*/-UI.showLocalConnectionInterrupted = function (isInterrupted) {+UI.showLocalConnectionInterrupted = function(isInterrupted) {VideoLayout.showLocalConnectionInterrupted(isInterrupted);};@@ -198,7 +246,7 @@ UI.setLocalRaisedHandStatus/*** Initialize conference UI.*/-UI.initConference = function () {+UI.initConference = function() {const { dispatch, getState } = APP.store;const { avatarID, email, id, name } = getLocalParticipant(getState);@@ -208,7 +256,7 @@ UI.initConference = function () {UI.showToolbar();- let displayName = config.displayJids ? id : name;+ const displayName = config.displayJids ? id : name;if (displayName) {UI.changeDisplayName('localVideoContainer', displayName);@@ -230,7 +278,7 @@ UI.initConference = function () {followMeHandler = new FollowMe(APP.conference, UI);};-UI.mucJoined = function () {+UI.mucJoined = function() {VideoLayout.mucJoined();// Update local video now that a conference is joined a user ID should be@@ -240,7 +288,7 @@ UI.mucJoined = function () {APP.conference.getLocalDisplayName());};-/***+/** ** Handler for toggling filmstrip*/UI.handleToggleFilmstrip = () => UI.toggleFilmstrip();@@ -249,7 +297,7 @@ UI.handleToggleFilmstrip = () => UI.toggleFilmstrip();* Returns the shared document manager object.* @return {EtherpadManager} the shared document manager object*/-UI.getSharedVideoManager = function () {+UI.getSharedVideoManager = function() {return sharedVideoManager;};@@ -259,11 +307,11 @@ UI.getSharedVideoManager = function () {* @returns {boolean} true if the UI is ready and the conference should be* established, false - otherwise (for example in the case of welcome page)*/-UI.start = function () {+UI.start = function() {document.title = interfaceConfig.APP_NAME;// Set the defaults for prompt dialogs.- $.prompt.setDefaults({persistent: false});+ $.prompt.setDefaults({ persistent: false });SideContainerToggler.init(eventEmitter);@@ -276,22 +324,24 @@ UI.start = function () {VideoLayout.resizeVideoArea(true, true);sharedVideoManager = new SharedVideoManager(eventEmitter);+ // eslint-disable-next-line no-negated-conditionif (!interfaceConfig.filmStripOnly) {// Initialise the recording module.if (config.enableRecording) {Recording.init(eventEmitter, config.recordingType);}+// Initialize side panelsSidePanels.init(eventEmitter);} else {- $("body").addClass("filmstrip-only");+ $('body').addClass('filmstrip-only');UI.showToolbar();Filmstrip.setFilmstripOnly();APP.store.dispatch(setNotificationsEnabled(false));}if (interfaceConfig.VERTICAL_FILMSTRIP) {- $("body").addClass("vertical-filmstrip");+ $('body').addClass('vertical-filmstrip');}document.title = interfaceConfig.APP_NAME;@@ -322,6 +372,9 @@ UI.unregisterListeners* Setup some DOM event listeners.*/UI.bindEvents = () => {+ /**+ *+ */function onResize() {SideContainerToggler.resize();VideoLayout.resizeVideoArea();@@ -364,7 +417,7 @@ UI.addLocalStream = track => {VideoLayout.changeLocalVideo(track);break;default:- logger.error("Unknown stream type: " + track.getType());+ logger.error(`Unknown stream type: ${track.getType()}`);break;}};@@ -413,17 +466,18 @@ UI.getSharedDocumentManager = () => etherpadManager;* Show user on UI.* @param {JitsiParticipant} user*/-UI.addUser = function (user) {- var id = user.getId();- var displayName = user.getDisplayName();+UI.addUser = function(user) {+ const id = user.getId();+ const displayName = user.getDisplayName();messageHandler.participantNotification(- displayName,'notify.somebody', 'connected', 'notify.connected'+ displayName, 'notify.somebody', 'connected', 'notify.connected');- if (!config.startAudioMuted ||- config.startAudioMuted > APP.conference.membersCount)+ if (!config.startAudioMuted+ || config.startAudioMuted > APP.conference.membersCount) {UIUtil.playSoundNotification('userJoined');+ }// Add Peer's containerVideoLayout.addParticipantContainer(user);@@ -432,8 +486,9 @@ UI.addUser = function (user) {UI.setUserEmail(id);// set initial display name- if(displayName)+ if (displayName) {UI.changeDisplayName(id, displayName);+ }};/**@@ -441,9 +496,9 @@ UI.addUser = function (user) {* @param {string} id user id* @param {string} displayName user nickname*/-UI.removeUser = function (id, displayName) {+UI.removeUser = function(id, displayName) {messageHandler.participantNotification(- displayName,'notify.somebody', 'disconnected', 'notify.disconnected'+ displayName, 'notify.somebody', 'disconnected', 'notify.disconnected');if (!config.startAudioMuted@@ -476,9 +531,10 @@ UI.updateLocalRole = isModerator => {SettingsMenu.showFollowMeOptions(isModerator);if (isModerator) {- if (!interfaceConfig.DISABLE_FOCUS_INDICATOR)+ if (!interfaceConfig.DISABLE_FOCUS_INDICATOR) {messageHandler.participantNotification(- null, "notify.me", 'connected', "notify.moderator");+ null, 'notify.me', 'connected', 'notify.moderator');+ }Recording.checkAutoRecord();}@@ -498,7 +554,8 @@ UI.updateUserRole = user => {return;}- var displayName = user.getDisplayName();+ const displayName = user.getDisplayName();+if (displayName) {messageHandler.participantNotification(displayName, 'notify.somebody',@@ -524,9 +581,10 @@ UI.updateUserStatus = (user, status) => {return;}- let displayName = user.getDisplayName();+ const displayName = user.getDisplayName();+messageHandler.participantNotification(- displayName, '', 'connected', "dialOut.statusMessage",+ displayName, '', 'connected', 'dialOut.statusMessage',{status: UIUtil.escapeHtml(status)});@@ -540,9 +598,9 @@ UI.toggleSmileys = () => Chat.toggleSmileys();/*** Toggles filmstrip.*/-UI.toggleFilmstrip = function () {- var self = Filmstrip;- self.toggleFilmstrip.apply(self, arguments);+UI.toggleFilmstrip = function() {+ // eslint-disable-next-line prefer-rest-params+ Filmstrip.toggleFilmstrip(...arguments);VideoLayout.resizeVideoArea(true, false);};@@ -555,12 +613,12 @@ UI.isFilmstripVisible = () => Filmstrip.isFilmstripVisible();/*** Toggles chat panel.*/-UI.toggleChat = () => UI.toggleSidePanel("chat_container");+UI.toggleChat = () => UI.toggleSidePanel('chat_container');/*** Toggles contact list panel.*/-UI.toggleContactList = () => UI.toggleSidePanel("contacts_container");+UI.toggleContactList = () => UI.toggleSidePanel('contacts_container');/*** Toggles the given side panel.@@ -573,7 +631,7 @@ UI.toggleSidePanel = sidePanelId => SideContainerToggler.toggle(sidePanelId);/*** Handle new user display name.*/-UI.inputDisplayNameHandler = function (newDisplayName) {+UI.inputDisplayNameHandler = function(newDisplayName) {eventEmitter.emit(UIEvents.NICKNAME_CHANGED, newDisplayName);};@@ -588,7 +646,8 @@ UI.inputDisplayNameHandler = function (newDisplayName) {* @param {number} timeout - The time to show the popup* @returns {void}*/-UI.showCustomToolbarPopup = function (buttonName, popupID, show, timeout) {+// eslint-disable-next-line max-params+UI.showCustomToolbarPopup = function(buttonName, popupID, show, timeout) {const action = show? setButtonPopupTimeout(buttonName, popupID, timeout): clearButtonPopup(buttonName);@@ -601,7 +660,7 @@ UI.showCustomToolbarPopup = function (buttonName, popupID, show, timeout) {* @param jid the jid for the remote video* @returns the video type video or screen.*/-UI.getRemoteVideoType = function (jid) {+UI.getRemoteVideoType = function(jid) {return VideoLayout.getRemoteVideoType(jid);};@@ -609,17 +668,19 @@ UI.getRemoteVideoType = function (jid) {UI.showLoginPopup = function(callback) {logger.log('password is required');- let message = (- `<input name="username" type="text"+ const message+ = `<input name="username" type="text"placeholder="[email protected]"class="input-control" autofocus><input name="password" type="password"data-i18n="[placeholder]dialog.userPassword"class="input-control"placeholder="user password">`- );- let submitFunction = (e, v, m, f) => {+ ;++ // eslint-disable-next-line max-params+ const submitFunction = (e, v, m, f) => {if (v) {if (f.username && f.password) {callback(f.username, f.password);@@ -628,7 +689,7 @@ UI.showLoginPopup = function(callback) {};messageHandler.openTwoButtonDialog({- titleKey : "dialog.passwordRequired",+ titleKey: 'dialog.passwordRequired',msgString: message,leftButtonKey: 'dialog.Ok',submitFunction,@@ -636,14 +697,15 @@ UI.showLoginPopup = function(callback) {});};-UI.askForNickname = function () {+UI.askForNickname = function() {+ // eslint-disable-next-line no-alertreturn window.prompt('Your nickname (optional)');};/*** Sets muted audio state for participant*/-UI.setAudioMuted = function (id, muted) {+UI.setAudioMuted = function(id, muted) {VideoLayout.onAudioMute(id, muted);if (APP.conference.isLocalId(id)) {APP.conference.updateAudioIconEnabled();@@ -653,7 +715,7 @@ UI.setAudioMuted = function (id, muted) {/*** Sets muted video state for participant*/-UI.setVideoMuted = function (id, muted) {+UI.setVideoMuted = function(id, muted) {VideoLayout.onVideoMute(id, muted);if (APP.conference.isLocalId(id)) {APP.conference.updateVideoIconEnabled();@@ -674,7 +736,7 @@ UI.updateAllVideos = () => VideoLayout.updateAllVideos();* @param type the type of the event we're listening for* @param listener a function that would be called when notified*/-UI.addListener = function (type, listener) {+UI.addListener = function(type, listener) {eventEmitter.on(type, listener);};@@ -684,7 +746,7 @@ UI.addListener = function (type, listener) {* @param type the type of the event we're listening for* @param listener the listener we want to remove*/-UI.removeListener = function (type, listener) {+UI.removeListener = function(type, listener) {eventEmitter.removeListener(type, listener);};@@ -696,14 +758,15 @@ UI.removeListener = function (type, listener) {*/UI.emitEvent = (type, ...options) => eventEmitter.emit(type, ...options);-UI.clickOnVideo = function (videoNumber) {- let videos = $("#remoteVideos .videocontainer:not(#mixedstream)");- let videosLength = videos.length;+UI.clickOnVideo = function(videoNumber) {+ const videos = $('#remoteVideos .videocontainer:not(#mixedstream)');+ const videosLength = videos.length;- if(videosLength <= videoNumber) {+ if (videosLength <= videoNumber) {return;}- let videoIndex = videoNumber === 0 ? 0 : videosLength - videoNumber;+ const videoIndex = videoNumber === 0 ? 0 : videosLength - videoNumber;+videos[videoIndex].click();};@@ -730,7 +793,7 @@ function changeAvatar(id, avatarUrl) {* @param {string} id user id* @param {string} email user email*/-UI.setUserEmail = function (id, email) {+UI.setUserEmail = function(id, email) {// update avatarAvatar.setUserEmail(id, email);@@ -745,7 +808,7 @@ UI.setUserEmail = function (id, email) {* @param {string} id user id* @param {string} avatarId user's avatar id*/-UI.setUserAvatarID = function (id, avatarId) {+UI.setUserAvatarID = function(id, avatarId) {// update avatarAvatar.setUserAvatarID(id, avatarId);@@ -757,7 +820,7 @@ UI.setUserAvatarID = function (id, avatarId) {* @param {string} id user id* @param {string} url user avatar url*/-UI.setUserAvatarUrl = function (id, url) {+UI.setUserAvatarUrl = function(id, url) {// update avatarAvatar.setUserAvatarUrl(id, url);@@ -768,39 +831,40 @@ UI.setUserAvatarUrl = function (id, url) {* Notify user that connection failed.* @param {string} stropheErrorMsg raw Strophe error message*/-UI.notifyConnectionFailed = function (stropheErrorMsg) {- var message;+UI.notifyConnectionFailed = function(stropheErrorMsg) {+ let message;+if (stropheErrorMsg) {message = APP.translation.generateTranslationHTML(- "dialog.connectErrorWithMsg", {msg: stropheErrorMsg});+ 'dialog.connectErrorWithMsg', { msg: stropheErrorMsg });} else {message = APP.translation.generateTranslationHTML(- "dialog.connectError");+ 'dialog.connectError');}- messageHandler.openDialog("dialog.error", message, true, {}, () => false);+ messageHandler.openDialog('dialog.error', message, true, {}, () => false);};/*** Notify user that maximum users limit has been reached.*/-UI.notifyMaxUsersLimitReached = function () {- var message = APP.translation.generateTranslationHTML(- "dialog.maxUsersLimitReached");+UI.notifyMaxUsersLimitReached = function() {+ const message = APP.translation.generateTranslationHTML(+ 'dialog.maxUsersLimitReached');- messageHandler.openDialog("dialog.error", message, true, {}, () => false);+ messageHandler.openDialog('dialog.error', message, true, {}, () => false);};/*** Notify user that he was automatically muted when joned the conference.*/-UI.notifyInitiallyMuted = function () {+UI.notifyInitiallyMuted = function() {messageHandler.participantNotification(null,- "notify.mutedTitle",- "connected",- "notify.muted",+ 'notify.mutedTitle',+ 'connected',+ 'notify.muted',null,120000);};@@ -809,11 +873,11 @@ UI.notifyInitiallyMuted = function () {* Mark user as dominant speaker.* @param {string} id user id*/-UI.markDominantSpeaker = function (id) {+UI.markDominantSpeaker = function(id) {VideoLayout.onDominantSpeakerChanged(id);};-UI.handleLastNEndpoints = function (leavingIds, enteringIds) {+UI.handleLastNEndpoints = function(leavingIds, enteringIds) {VideoLayout.onLastNEndpointsChanged(leavingIds, enteringIds);};@@ -822,7 +886,7 @@ UI.handleLastNEndpoints = function (leavingIds, enteringIds) {** @param {string} id the id of remote participant(MUC jid)*/-UI.participantConnectionStatusChanged = function (id) {+UI.participantConnectionStatusChanged = function(id) {VideoLayout.onParticipantConnectionStatusChanged(id);};@@ -854,7 +918,7 @@ UI.updateDesktopSharingButtons/*** Hide connection quality statistics from UI.*/-UI.hideStats = function () {+UI.hideStats = function() {VideoLayout.hideStats();};@@ -862,7 +926,7 @@ UI.hideStats = function () {* Mark video as interrupted or not.* @param {boolean} interrupted if video is interrupted*/-UI.markVideoInterrupted = function (interrupted) {+UI.markVideoInterrupted = function(interrupted) {if (interrupted) {VideoLayout.onVideoInterrupted();} else {@@ -877,32 +941,34 @@ UI.markVideoInterrupted = function (interrupted) {* @param {string} message message text* @param {number} stamp timestamp when message was created*/-UI.addMessage = function (from, displayName, message, stamp) {+// eslint-disable-next-line max-params+UI.addMessage = function(from, displayName, message, stamp) {Chat.updateChatConversation(from, displayName, message, stamp);};UI.updateDTMFSupport= isDTMFSupported => APP.store.dispatch(showDialPadButton(isDTMFSupported));-UI.updateRecordingState = function (state) {+UI.updateRecordingState = function(state) {Recording.updateRecordingState(state);};-UI.notifyTokenAuthFailed = function () {- messageHandler.showError( "dialog.tokenAuthFailedTitle",- "dialog.tokenAuthFailed");+UI.notifyTokenAuthFailed = function() {+ messageHandler.showError('dialog.tokenAuthFailedTitle',+ 'dialog.tokenAuthFailed');};-UI.notifyInternalError = function () {- messageHandler.showError( "dialog.internalErrorTitle",- "dialog.internalError");+UI.notifyInternalError = function() {+ messageHandler.showError('dialog.internalErrorTitle',+ 'dialog.internalError');};-UI.notifyFocusDisconnected = function (focus, retrySec) {+UI.notifyFocusDisconnected = function(focus, retrySec) {messageHandler.participantNotification(- null, "notify.focus",- 'disconnected', "notify.focusFail",- {component: focus, ms: retrySec}+ null, 'notify.focus',+ 'disconnected', 'notify.focusFail',+ { component: focus,+ ms: retrySec });};@@ -911,9 +977,9 @@ UI.notifyFocusDisconnected = function (focus, retrySec) {* @param {boolean} isAuthEnabled if authentication is enabled* @param {string} [login] current login*/-UI.updateAuthInfo = function (isAuthEnabled, login) {- let showAuth = isAuthEnabled && UIUtil.isAuthenticationEnabled();- let loggedIn = !!login;+UI.updateAuthInfo = function(isAuthEnabled, login) {+ const showAuth = isAuthEnabled && UIUtil.isAuthenticationEnabled();+ const loggedIn = Boolean(login);Profile.showAuthenticationButtons(showAuth);@@ -925,7 +991,7 @@ UI.updateAuthInfo = function (isAuthEnabled, login) {}};-UI.onStartMutedChanged = function (startAudioMuted, startVideoMuted) {+UI.onStartMutedChanged = function(startAudioMuted, startVideoMuted) {SettingsMenu.updateStartMutedBox(startAudioMuted, startVideoMuted);};@@ -935,7 +1001,7 @@ UI.onStartMutedChanged = function (startAudioMuted, startVideoMuted) {* @param {boolean} isRaisedHand indicates the current state of the* "raised hand"*/-UI.onLocalRaiseHandChanged = function (isRaisedHand) {+UI.onLocalRaiseHandChanged = function(isRaisedHand) {eventEmitter.emit(UIEvents.LOCAL_RAISE_HAND_CHANGED, isRaisedHand);};@@ -943,7 +1009,7 @@ UI.onLocalRaiseHandChanged = function (isRaisedHand) {* Update list of available physical devices.* @param {object[]} devices new list of available devices*/-UI.onAvailableDevicesChanged = function (devices) {+UI.onAvailableDevicesChanged = function(devices) {APP.store.dispatch(updateDeviceList(devices));APP.conference.updateAudioIconEnabled();APP.conference.updateVideoIconEnabled();@@ -953,7 +1019,7 @@ UI.onAvailableDevicesChanged = function (devices) {* Returns the id of the current video shown on large.* Currently used by tests (torture).*/-UI.getLargeVideoID = function () {+UI.getLargeVideoID = function() {return VideoLayout.getLargeVideoID();};@@ -961,7 +1027,7 @@ UI.getLargeVideoID = function () {* Returns the current video shown on large.* Currently used by tests (torture).*/-UI.getLargeVideo = function () {+UI.getLargeVideo = function() {return VideoLayout.getLargeVideo();};@@ -977,11 +1043,11 @@ UI.isPinned = userId => VideoLayout.getPinnedId() === userId;/*** Shows dialog with a link to FF extension.*/-UI.showExtensionRequiredDialog = function (url) {+UI.showExtensionRequiredDialog = function(url) {messageHandler.openMessageDialog(- "dialog.extensionRequired",- "[html]dialog.firefoxExtensionPrompt",- {url: url});+ 'dialog.extensionRequired',+ '[html]dialog.firefoxExtensionPrompt',+ { url });};/**@@ -989,25 +1055,25 @@ UI.showExtensionRequiredDialog = function (url) {* 2 button dialog with buttons - cancel and go to web store.* @param url {string} the url of the extension.*/-UI.showExtensionExternalInstallationDialog = function (url) {+UI.showExtensionExternalInstallationDialog = function(url) {let openedWindow = null;- let submitFunction = function(e,v){+ const submitFunction = function(e, v) {if (v) {e.preventDefault();if (openedWindow === null || openedWindow.closed) {openedWindow= window.open(url,- "extension_store_window",- "resizable,scrollbars=yes,status=1");+ 'extension_store_window',+ 'resizable,scrollbars=yes,status=1');} else {openedWindow.focus();}}};- let closeFunction = function (e, v) {+ const closeFunction = function(e, v) {if (openedWindow) {// Ideally we would close the popup, but this does not seem to work// on Chrome. Leaving it uncommented in case it could work@@ -1037,14 +1103,14 @@ UI.showExtensionExternalInstallationDialog = function (url) {* @param callback {function} function to be executed after user clicks* the install button - it should make another attempt to install the extension.*/-UI.showExtensionInlineInstallationDialog = function (callback) {- let submitFunction = function(e,v){+UI.showExtensionInlineInstallationDialog = function(callback) {+ const submitFunction = function(e, v) {if (v) {callback();}};- let closeFunction = function (e, v) {+ const closeFunction = function(e, v) {if (!v) {eventEmitter.emit(UIEvents.EXTERNAL_INSTALLATION_CANCELED);}@@ -1067,7 +1133,7 @@ UI.showExtensionInlineInstallationDialog = function (callback) {* acquiring an audio stream.* @returns {void}*/-UI.showMicErrorNotification = function (micError) {+UI.showMicErrorNotification = function(micError) {if (!micError) {return;}@@ -1103,7 +1169,7 @@ UI.showMicErrorNotification = function (micError) {* acquiring a video stream.* @returns {void}*/-UI.showCameraErrorNotification = function (cameraError) {+UI.showCameraErrorNotification = function(cameraError) {if (!cameraError) {return;}@@ -1112,8 +1178,8 @@ UI.showCameraErrorNotification = function (cameraError) {const persistenceKey = `doNotShowErrorAgain-camera-${name}`;- const cameraJitsiTrackErrorMsg =- JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[name];+ const cameraJitsiTrackErrorMsg+ = JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[name];const cameraErrorMsg = cameraJitsiTrackErrorMsg|| JITSI_TRACK_ERROR_TO_MESSAGE_KEY_MAP.camera[JitsiTrackErrors.GENERAL];@@ -1136,14 +1202,14 @@ UI.showCameraErrorNotification = function (cameraError) {* Shows error dialog that informs the user that no data is received from the* device.*/-UI.showTrackNotWorkingDialog = function (stream) {+UI.showTrackNotWorkingDialog = function(stream) {messageHandler.openMessageDialog(- "dialog.error",- stream.isAudioTrack()? "dialog.micNotSendingData" :- "dialog.cameraNotSendingData");+ 'dialog.error',+ stream.isAudioTrack() ? 'dialog.micNotSendingData'+ : 'dialog.cameraNotSendingData');};-UI.updateDevicesAvailability = function (id, devices) {+UI.updateDevicesAvailability = function(id, devices) {VideoLayout.setDeviceAvailabilityIcons(id, devices);};@@ -1153,9 +1219,10 @@ UI.updateDevicesAvailability = function (id, devices) {* @param {string} url video url* @param {string} attributes*/-UI.onSharedVideoStart = function (id, url, attributes) {- if (sharedVideoManager)+UI.onSharedVideoStart = function(id, url, attributes) {+ if (sharedVideoManager) {sharedVideoManager.onSharedVideoStart(id, url, attributes);+ }};/**@@ -1164,9 +1231,10 @@ UI.onSharedVideoStart = function (id, url, attributes) {* @param {string} url video url* @param {string} attributes*/-UI.onSharedVideoUpdate = function (id, url, attributes) {- if (sharedVideoManager)+UI.onSharedVideoUpdate = function(id, url, attributes) {+ if (sharedVideoManager) {sharedVideoManager.onSharedVideoUpdate(id, url, attributes);+ }};/**@@ -1174,9 +1242,10 @@ UI.onSharedVideoUpdate = function (id, url, attributes) {* @param {string} id the id of the sender of the command* @param {string} attributes*/-UI.onSharedVideoStop = function (id, attributes) {- if (sharedVideoManager)+UI.onSharedVideoStop = function(id, attributes) {+ if (sharedVideoManager) {sharedVideoManager.onSharedVideoStop(id, attributes);+ }};/**@@ -1211,50 +1280,6 @@ UI.setLocalRemoteControlActiveChanged = function() {VideoLayout.setLocalRemoteControlActiveChanged();};-const UIListeners = new Map([- [- UIEvents.ETHERPAD_CLICKED,- () => etherpadManager && etherpadManager.toggleEtherpad()- ], [- UIEvents.SHARED_VIDEO_CLICKED,- () => sharedVideoManager && sharedVideoManager.toggleSharedVideo()- ], [- UIEvents.TOGGLE_FULLSCREEN,- UI.toggleFullScreen- ], [- UIEvents.TOGGLE_CHAT,- UI.toggleChat- ], [- UIEvents.TOGGLE_SETTINGS,- () => {- // Opening of device selection is special-cased as it is a dialog- // opened through a button in settings and not directly displayed in- // settings itself. As it is not useful to only have a settings menu- // with a button to open a dialog, open the dialog directly instead.- if (interfaceConfig.SETTINGS_SECTIONS.length === 1- && UIUtil.isSettingEnabled('devices')) {- APP.store.dispatch(openDeviceSelectionDialog());- } else {- UI.toggleSidePanel("settings_container");- }- }- ], [- UIEvents.TOGGLE_CONTACT_LIST,- UI.toggleContactList- ], [- UIEvents.TOGGLE_PROFILE,- () => {- UI.toggleSidePanel('profile_container');- }- ], [- UIEvents.TOGGLE_FILMSTRIP,- UI.handleToggleFilmstrip- ], [- UIEvents.FOLLOW_ME_ENABLED,- enabled => (followMeHandler && followMeHandler.enableFollowMe(enabled))- ]-]);-// TODO: Export every function separately. For now there is no point of doing// this because we are importing everything.export default UI;diff --git a/modules/UI/UIErrors.js b/modules/UI/UIErrors.jsindex a7bb030004..44f385daab 100644--- a/modules/UI/UIErrors.js+++ b/modules/UI/UIErrors.js@@ -7,4 +7,4 @@** @type {{FEEDBACK_REQUEST_IN_PROGRESS: string}}*/-export const FEEDBACK_REQUEST_IN_PROGRESS = "FeedbackRequestInProgress";+export const FEEDBACK_REQUEST_IN_PROGRESS = 'FeedbackRequestInProgress';diff --git a/modules/UI/audio_levels/AudioLevels.js b/modules/UI/audio_levels/AudioLevels.jsindex f4bec666d6..a59d1193a6 100644--- a/modules/UI/audio_levels/AudioLevels.js+++ b/modules/UI/audio_levels/AudioLevels.js@@ -1,6 +1,6 @@/* global interfaceConfig */-import UIUtil from "../util/UIUtil";+import UIUtil from '../util/UIUtil';/*** Responsible for drawing audio levels.@@ -19,29 +19,31 @@ const AudioLevels = {_setDotLevel(elementID, index, opacity) {let audioSpan= document.getElementById(elementID)- .getElementsByClassName("audioindicator");+ .getElementsByClassName('audioindicator');// Make sure the audio span is still around.- if (audioSpan && audioSpan.length > 0)+ if (audioSpan && audioSpan.length > 0) {audioSpan = audioSpan[0];- else+ } else {return;+ }- let audioTopDots- = audioSpan.getElementsByClassName("audiodot-top");- let audioDotMiddle- = audioSpan.getElementsByClassName("audiodot-middle");- let audioBottomDots- = audioSpan.getElementsByClassName("audiodot-bottom");+ const audioTopDots+ = audioSpan.getElementsByClassName('audiodot-top');+ const audioDotMiddle+ = audioSpan.getElementsByClassName('audiodot-middle');+ const audioBottomDots+ = audioSpan.getElementsByClassName('audiodot-bottom');// First take care of the middle dot case.- if (index === 0){+ if (index === 0) {audioDotMiddle[0].style.opacity = opacity;+return;}// Index > 0 : we are setting non-middle dots.- index--;+ index--;// eslint-disable-line no-param-reassignaudioBottomDots[index].style.opacity = opacity;audioTopDots[this.sideDotsCount - index - 1].style.opacity = opacity;},@@ -52,19 +54,21 @@ const AudioLevels = {* @param audioLevel the new audio level to set.*/updateLargeVideoAudioLevel(elementId, audioLevel) {- let element = document.getElementById(elementId);+ const element = document.getElementById(elementId);- if(!UIUtil.isVisible(element))+ if (!UIUtil.isVisible(element)) {return;+ }let level = parseFloat(audioLevel);level = isNaN(level) ? 0 : level;- let shadowElement = element.getElementsByClassName("dynamic-shadow");+ let shadowElement = element.getElementsByClassName('dynamic-shadow');- if (shadowElement && shadowElement.length > 0)+ if (shadowElement && shadowElement.length > 0) {shadowElement = shadowElement[0];+ }shadowElement.style.boxShadow = this._updateLargeVideoShadow(level);},@@ -83,7 +87,7 @@ const AudioLevels = {// External circle audio level.const ext = {- level: (int.level * scale * level + int.level).toFixed(0),+ level: ((int.level * scale * level) + int.level).toFixed(0),color: interfaceConfig.AUDIO_LEVEL_SECONDARY_COLOR};@@ -94,8 +98,8 @@ const AudioLevels = {ext.blur = ext.level ? 6 : 0;return [- `0 0 ${ int.blur }px ${ int.level }px ${ int.color }`,- `0 0 ${ ext.blur }px ${ ext.level }px ${ ext.color }`+ `0 0 ${int.blur}px ${int.level}px ${int.color}`,+ `0 0 ${ext.blur}px ${ext.level}px ${ext.color}`].join(', ');}};diff --git a/modules/UI/authentication/AuthHandler.js b/modules/UI/authentication/AuthHandler.jsindex a9a5c8b8d1..a8940c7573 100644--- a/modules/UI/authentication/AuthHandler.js+++ b/modules/UI/authentication/AuthHandler.js@@ -9,14 +9,14 @@ import UIUtil from '../util/UIUtil';import LoginDialog from './LoginDialog';-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);let externalAuthWindow;let authRequiredDialog;-let isTokenAuthEnabled- = typeof config.tokenAuthUrl === "string" && config.tokenAuthUrl.length;-let getTokenAuthUrl+const isTokenAuthEnabled+ = typeof config.tokenAuthUrl === 'string' && config.tokenAuthUrl.length;+const getTokenAuthUrl= JitsiMeetJS.util.AuthUtil.getTokenAuthUrl.bind(null, config.tokenAuthUrl);/**@@ -26,23 +26,25 @@ let getTokenAuthUrl* @param {JitsiConference} room* @param {string} [lockPassword] password to use if the conference is locked*/-function doExternalAuth (room, lockPassword) {+function doExternalAuth(room, lockPassword) {if (externalAuthWindow) {externalAuthWindow.focus();+return;}if (room.isJoined()) {let getUrl;+if (isTokenAuthEnabled) {getUrl = Promise.resolve(getTokenAuthUrl(room.getName(), true));initJWTTokenListener(room);} else {getUrl = room.getExternalAuthUrl(true);}- getUrl.then(function (url) {+ getUrl.then(url => {externalAuthWindow = LoginDialog.showExternalAuthDialog(url,- function () {+ () => {externalAuthWindow = null;if (!isTokenAuthEnabled) {room.join(lockPassword);@@ -50,14 +52,10 @@ function doExternalAuth (room, lockPassword) {});});+ } else if (isTokenAuthEnabled) {+ redirectToTokenAuthService(room.getName());} else {- // If conference has not been started yet- // then redirect to login page- if (isTokenAuthEnabled) {- redirectToTokenAuthService(room.getName());- } else {- room.getExternalAuthUrl().then(UIUtil.redirect);- }+ room.getExternalAuthUrl().then(UIUtil.redirect);}}@@ -77,61 +75,80 @@ function redirectToTokenAuthService(roomName) {* @param room the name fo the conference room.*/function initJWTTokenListener(room) {- var listener = function ({ data, source }) {+ /**+ *+ */+ function listener({ data, source }) {if (externalAuthWindow !== source) {- logger.warn("Ignored message not coming " +- "from external authnetication window");+ logger.warn('Ignored message not coming '+ + 'from external authnetication window');+return;}let jwt;if (data && (jwt = data.jwtToken)) {- logger.info("Received JSON Web Token (JWT):", jwt);+ logger.info('Received JSON Web Token (JWT):', jwt);APP.store.dispatch(setJWT(jwt));- var roomName = room.getName();- openConnection({retry: false, roomName: roomName })- .then(function (connection) {- // Start new connection- let newRoom = connection.initJitsiConference(- roomName, APP.conference._getConferenceOptions());- // Authenticate from the new connection to get- // the session-ID from the focus, which wil then be used- // to upgrade current connection's user role- newRoom.room.moderator.authenticate().then(function () {- connection.disconnect();- // At this point we'll have session-ID stored in- // the settings. It wil be used in the call below- // to upgrade user's role- room.room.moderator.authenticate()- .then(function () {- logger.info("User role upgrade done !");- unregister();- }).catch(function (err, errCode) {- logger.error(- "Authentication failed: ", err, errCode);- unregister();- });- }).catch(function (error, code) {- unregister();- connection.disconnect();- logger.error(- 'Authentication failed on the new connection',- error, code);- });- }, function (err) {+ const roomName = room.getName();++ openConnection({+ retry: false,+ roomName+ }).then(connection => {+ // Start new connection+ const newRoom = connection.initJitsiConference(+ roomName, APP.conference._getConferenceOptions());++ // Authenticate from the new connection to get+ // the session-ID from the focus, which wil then be used+ // to upgrade current connection's user role++ newRoom.room.moderator.authenticate()+ .then(() => {+ connection.disconnect();++ // At this point we'll have session-ID stored in+ // the settings. It wil be used in the call below+ // to upgrade user's role+ room.room.moderator.authenticate()+ .then(() => {+ logger.info('User role upgrade done !');+ // eslint-disable-line no-use-before-define+ unregister();+ })+ .catch((err, errCode) => {+ logger.error('Authentication failed: ',+ err, errCode);+ unregister();+ });+ })+ .catch((error, code) => {unregister();- logger.error("Failed to open new connection", err);+ connection.disconnect();+ logger.error(+ 'Authentication failed on the new connection',+ error, code);});+ }, err => {+ unregister();+ logger.error('Failed to open new connection', err);+ });}- };- var unregister = function () {- window.removeEventListener("message", listener);- };+ }++ /**+ *+ */+ function unregister() {+ window.removeEventListener('message', listener);+ }+if (window.addEventListener) {- window.addEventListener("message", listener, false);+ window.addEventListener('message', listener, false);}}@@ -183,7 +200,7 @@ function doXmppAuth(room, lockPassword) {* @param {JitsiConference} room* @param {string} [lockPassword] password to use if the conference is locked*/-function authenticate (room, lockPassword) {+function authenticate(room, lockPassword) {if (isTokenAuthEnabled || room.isExternalAuthEnabled()) {doExternalAuth(room, lockPassword);} else {@@ -198,10 +215,10 @@ function authenticate (room, lockPassword) {* @param {string} [lockPassword] password to use if the conference is locked* @returns {Promise}*/-function logout (room) {- return new Promise(function (resolve) {+function logout(room) {+ return new Promise(resolve => {room.room.moderator.logout(resolve);- }).then(function (url) {+ }).then(url => {// de-authenticate conference on the flyif (room.isJoined()) {room.join();@@ -241,14 +258,17 @@ function closeAuth() {}}+/**+ *+ */function showXmppPasswordPrompt(roomName, connect) {- return new Promise(function (resolve, reject) {- let authDialog = LoginDialog.showAuthDialog(- function (id, password) {- connect(id, password, roomName).then(function (connection) {+ return new Promise((resolve, reject) => {+ const authDialog = LoginDialog.showAuthDialog(+ (id, password) => {+ connect(id, password, roomName).then(connection => {authDialog.close();resolve(connection);- }, function (err) {+ }, err => {if (err === JitsiConnectionErrors.PASSWORD_REQUIRED) {authDialog.displayError(err);} else {@@ -275,9 +295,10 @@ function requestAuth(roomName, connect) {if (isTokenAuthEnabled) {// This Promise never resolves as user gets redirected to another URLreturn new Promise(() => redirectToTokenAuthService(roomName));- } else {- return showXmppPasswordPrompt(roomName, connect);}++ return showXmppPasswordPrompt(roomName, connect);+}export default {diff --git a/modules/UI/authentication/LoginDialog.js b/modules/UI/authentication/LoginDialog.jsindex 0ee3a3db7d..e340b51de0 100644--- a/modules/UI/authentication/LoginDialog.js+++ b/modules/UI/authentication/LoginDialog.js@@ -10,9 +10,9 @@ import {* @returns {string} html string*/function getPasswordInputHtml() {- let placeholder = config.hosts.authdomain- ? "user identity"- : "[email protected]";+ const placeholder = config.hosts.authdomain+ ? 'user identity'+ : '[email protected]';return `<input name="username" type="text"@@ -29,7 +29,7 @@ function getPasswordInputHtml() {*/function cancelButton() {return {- title: APP.translation.generateTranslationHTML("dialog.Cancel"),+ title: APP.translation.generateTranslationHTML('dialog.Cancel'),value: false};}@@ -46,14 +46,14 @@ function cancelButton() {* @param {function} [cancelCallback] callback to invoke if user canceled.*/function LoginDialog(successCallback, cancelCallback) {- let loginButtons = [{- title: APP.translation.generateTranslationHTML("dialog.Ok"),+ const loginButtons = [ {+ title: APP.translation.generateTranslationHTML('dialog.Ok'),value: true- }];- let finishedButtons = [{+ } ];+ const finishedButtons = [ {title: APP.translation.generateTranslationHTML('dialog.retry'),value: 'retry'- }];+ } ];// show "cancel" button only if cancelCallback providedif (cancelCallback) {@@ -61,17 +61,28 @@ function LoginDialog(successCallback, cancelCallback) {finishedButtons.push(cancelButton());}+ const connDialog = APP.UI.messageHandler.openDialogWithStates(+ states, // eslint-disable-line no-use-before-define+ {+ persistent: true,+ closeText: ''+ },+ null+ );+const states = {login: {titleKey: 'dialog.passwordRequired',html: getPasswordInputHtml(),buttons: loginButtons,focus: ':input:first',- submit: function (e, v, m, f) {+ // eslint-disable-next-line max-params+ submit(e, v, m, f) {e.preventDefault();if (v) {- let jid = f.username;- let password = f.password;+ const jid = f.username;+ const password = f.password;+if (jid && password) {connDialog.goToState('connecting');successCallback(toJid(jid, config.hosts), password);@@ -84,16 +95,16 @@ function LoginDialog(successCallback, cancelCallback) {},connecting: {titleKey: 'dialog.connecting',- html: '<div id="connectionStatus"></div>',+ html: '<div id="connectionStatus"></div>',buttons: [],defaultButton: 0},finished: {titleKey: 'dialog.error',- html: '<div id="errorMessage"></div>',+ html: '<div id="errorMessage"></div>',buttons: finishedButtons,defaultButton: 0,- submit: function (e, v) {+ submit(e, v) {e.preventDefault();if (v === 'retry') {connDialog.goToState('login');@@ -105,38 +116,35 @@ function LoginDialog(successCallback, cancelCallback) {}};- var connDialog = APP.UI.messageHandler.openDialogWithStates(- states, { persistent: true, closeText: '' }, null- );-/*** Displays error message in 'finished' state which allows either to cancel* or retry.* @param error the key to the error to be displayed.* @param options the options to the error message (optional)*/- this.displayError = function (error, options) {+ this.displayError = function(error, options) {- let finishedState = connDialog.getState('finished');+ const finishedState = connDialog.getState('finished');- let errorMessageElem = finishedState.find('#errorMessage');+ const errorMessageElem = finishedState.find('#errorMessage');let messageKey;+if (error === JitsiConnectionErrors.PASSWORD_REQUIRED) {// this is a password required error, as login window was already// open once, this means username or password is wrongmessageKey = 'dialog.incorrectPassword';- }- else {+ } else {messageKey = 'dialog.connectErrorWithMsg';- if (!options)- options = {};+ if (!options) {+ options = {};// eslint-disable-line no-param-reassign+ }options.msg = error;}- errorMessageElem.attr("data-i18n", messageKey);+ errorMessageElem.attr('data-i18n', messageKey);APP.translation.translateElement($(errorMessageElem), options);@@ -147,18 +155,19 @@ function LoginDialog(successCallback, cancelCallback) {* Show message as connection status.* @param {string} messageKey the key to the message*/- this.displayConnectionStatus = function (messageKey) {- let connectingState = connDialog.getState('connecting');+ this.displayConnectionStatus = function(messageKey) {+ const connectingState = connDialog.getState('connecting');- let connectionStatus = connectingState.find('#connectionStatus');- connectionStatus.attr("data-i18n", messageKey);+ const connectionStatus = connectingState.find('#connectionStatus');++ connectionStatus.attr('data-i18n', messageKey);APP.translation.translateElement($(connectionStatus));};/*** Closes LoginDialog.*/- this.close = function () {+ this.close = function() {connDialog.close();};}@@ -173,7 +182,7 @@ export default {** @returns {LoginDialog}*/- showAuthDialog: function (successCallback, cancelCallback) {+ showAuthDialog(successCallback, cancelCallback) {return new LoginDialog(successCallback, cancelCallback);},@@ -183,15 +192,16 @@ export default {* @param {function} callback callback to invoke when auth popup is closed.* @returns auth dialog*/- showExternalAuthDialog: function (url, callback) {- var dialog = APP.UI.messageHandler.openCenteredPopup(+ showExternalAuthDialog(url, callback) {+ const dialog = APP.UI.messageHandler.openCenteredPopup(url, 910, 660,+// On closedcallback);if (!dialog) {- APP.UI.messageHandler.openMessageDialog(null, "dialog.popupError");+ APP.UI.messageHandler.openMessageDialog(null, 'dialog.popupError');}return dialog;@@ -215,10 +225,10 @@ export default {const buttonTxt = APP.translation.generateTranslationHTML('dialog.IamHost');- const buttons = [{+ const buttons = [ {title: buttonTxt,value: 'authNow'- }];+ } ];return APP.UI.messageHandler.openDialog('dialog.WaitingForHost',diff --git a/modules/UI/avatar/Avatar.js b/modules/UI/avatar/Avatar.jsindex 198dac073c..6d7ee8085a 100644--- a/modules/UI/avatar/Avatar.js+++ b/modules/UI/avatar/Avatar.js@@ -25,7 +25,7 @@import { getAvatarURL } from '../../../react/features/base/participants';-let users = {};+const users = {};export default {/**@@ -34,17 +34,19 @@ export default {* @param prop {string} name of the prop* @param val {string} value to be set*/- _setUserProp: function (id, prop, val) {+ _setUserProp(id, prop, val) {// FIXME: Fixes the issue with not be able to return avatar for the// local user when the conference has been left. Maybe there is beter// way to solve it.- if(!id || APP.conference.isLocalId(id)) {- id = "local";+ if (!id || APP.conference.isLocalId(id)) {+ id = 'local';// eslint-disable-line no-param-reassign}- if(!val || (users[id] && users[id][prop] === val))+ if (!val || (users[id] && users[id][prop] === val)) {return;- if(!users[id])+ }+ if (!users[id]) {users[id] = {};+ }users[id][prop] = val;},@@ -54,8 +56,8 @@ export default {* @param id id of the user* @param email email or nickname to be used as a hash*/- setUserEmail: function (id, email) {- this._setUserProp(id, "email", email);+ setUserEmail(id, email) {+ this._setUserProp(id, 'email', email);},/**@@ -64,8 +66,8 @@ export default {* @param id id of the user* @param url the url for the avatar*/- setUserAvatarUrl: function (id, url) {- this._setUserProp(id, "avatarUrl", url);+ setUserAvatarUrl(id, url) {+ this._setUserProp(id, 'avatarUrl', url);},/**@@ -73,8 +75,8 @@ export default {* @param id id of the user* @param avatarId an id to be used for the avatar*/- setUserAvatarID: function (id, avatarId) {- this._setUserProp(id, "avatarId", avatarId);+ setUserAvatarID(id, avatarId) {+ this._setUserProp(id, 'avatarId', avatarId);},/**@@ -82,10 +84,12 @@ export default {* identified by its id.* @param {string} userId user id*/- getAvatarUrl: function (userId) {+ getAvatarUrl(userId) {let user;+if (!userId || APP.conference.isLocalId(userId)) {user = users.local;+ // eslint-disable-next-line no-param-reassignuserId = APP.conference.getMyUserId();} else {user = users[userId];diff --git a/modules/UI/etherpad/Etherpad.js b/modules/UI/etherpad/Etherpad.jsindex 9043fd2fc8..b04edae6c9 100644--- a/modules/UI/etherpad/Etherpad.js+++ b/modules/UI/etherpad/Etherpad.js@@ -1,8 +1,8 @@/* global $ */-import VideoLayout from "../videolayout/VideoLayout";+import VideoLayout from '../videolayout/VideoLayout';import LargeContainer from '../videolayout/LargeContainer';-import UIEvents from "../../../service/UI/UIEvents";+import UIEvents from '../../../service/UI/UIEvents';import Filmstrip from '../videolayout/Filmstrip';/**@@ -15,14 +15,21 @@ const options = $.param({useMonospaceFont: false});-function bubbleIframeMouseMove(iframe){- var existingOnMouseMove = iframe.contentWindow.onmousemove;- iframe.contentWindow.onmousemove = function(e){- if(existingOnMouseMove) existingOnMouseMove(e);- var evt = document.createEvent("MouseEvents");- var boundingClientRect = iframe.getBoundingClientRect();+/**+ *+ */+function bubbleIframeMouseMove(iframe) {+ const existingOnMouseMove = iframe.contentWindow.onmousemove;++ iframe.contentWindow.onmousemove = function(e) {+ if (existingOnMouseMove) {+ existingOnMouseMove(e);+ }+ const evt = document.createEvent('MouseEvents');+ const boundingClientRect = iframe.getBoundingClientRect();+evt.initMouseEvent(- "mousemove",+ 'mousemove',true, // bubblesfalse, // not cancelablewindow,@@ -46,27 +53,30 @@ function bubbleIframeMouseMove(iframe){* Default Etherpad frame width.*/const DEFAULT_WIDTH = 640;+/*** Default Etherpad frame height.*/const DEFAULT_HEIGHT = 480;-const ETHERPAD_CONTAINER_TYPE = "etherpad";+const ETHERPAD_CONTAINER_TYPE = 'etherpad';/*** Container for Etherpad iframe.*/class Etherpad extends LargeContainer {-- constructor (domain, name) {+ /**+ * Creates new Etherpad object+ */+ constructor(domain, name) {super();const iframe = document.createElement('iframe');- iframe.id = "etherpadIFrame";- iframe.src = domain + name + '?' + options;+ iframe.id = 'etherpadIFrame';+ iframe.src = `${domain + name}?${options}`;iframe.frameBorder = 0;- iframe.scrolling = "no";+ iframe.scrolling = 'no';iframe.width = DEFAULT_WIDTH;iframe.height = DEFAULT_HEIGHT;iframe.setAttribute('style', 'visibility: hidden;');@@ -77,15 +87,17 @@ class Etherpad extends LargeContainer {document.domain = document.domain;bubbleIframeMouseMove(iframe);- setTimeout(function() {+ setTimeout(() => {const doc = iframe.contentDocument;// the iframes inside of the etherpad are// not yet loaded when the etherpad iframe is loaded- const outer = doc.getElementsByName("ace_outer")[0];+ const outer = doc.getElementsByName('ace_outer')[0];+bubbleIframeMouseMove(outer);- const inner = doc.getElementsByName("ace_inner")[0];+ const inner = doc.getElementsByName('ace_inner')[0];+bubbleIframeMouseMove(inner);}, 2000);};@@ -93,47 +105,64 @@ class Etherpad extends LargeContainer {this.iframe = iframe;}- get isOpen () {- return !!this.iframe;+ /**+ *+ */+ get isOpen() {+ return Boolean(this.iframe);}- get container () {+ /**+ *+ */+ get container() {return document.getElementById('etherpad');}- // eslint-disable-next-line no-unused-vars- resize (containerWidth, containerHeight, animate) {- let height = containerHeight - Filmstrip.getFilmstripHeight();- let width = containerWidth;+ /**+ *+ */+ resize(containerWidth, containerHeight) {+ const height = containerHeight - Filmstrip.getFilmstripHeight();+ const width = containerWidth;- $(this.iframe).width(width).height(height);+ $(this.iframe)+ .width(width)+ .height(height);}- show () {+ /**+ *+ */+ show() {const $iframe = $(this.iframe);const $container = $(this.container);- let self = this;+ const self = this;return new Promise(resolve => {- $iframe.fadeIn(300, function () {+ $iframe.fadeIn(300, () => {self.bodyBackground = document.body.style.background;document.body.style.background = '#eeeeee';- $iframe.css({visibility: 'visible'});- $container.css({zIndex: 2});+ $iframe.css({ visibility: 'visible' });+ $container.css({ zIndex: 2 });resolve();});});}- hide () {+ /**+ *+ */+ hide() {const $iframe = $(this.iframe);const $container = $(this.container);+document.body.style.background = this.bodyBackground;return new Promise(resolve => {- $iframe.fadeOut(300, function () {- $iframe.css({visibility: 'hidden'});- $container.css({zIndex: 0});+ $iframe.fadeOut(300, () => {+ $iframe.css({ visibility: 'hidden' });+ $container.css({ zIndex: 0 });resolve();});});@@ -142,7 +171,7 @@ class Etherpad extends LargeContainer {/*** @return {boolean} do not switch on dominant speaker event if on stage.*/- stayOnStage () {+ stayOnStage() {return true;}}@@ -151,9 +180,12 @@ class Etherpad extends LargeContainer {* Manager of the Etherpad frame.*/export default class EtherpadManager {- constructor (domain, name, eventEmitter) {+ /**+ *+ */+ constructor(domain, name, eventEmitter) {if (!domain || !name) {- throw new Error("missing domain or name");+ throw new Error('missing domain or name');}this.domain = domain;@@ -162,10 +194,16 @@ export default class EtherpadManager {this.etherpad = null;}- get isOpen () {- return !!this.etherpad;+ /**+ *+ */+ get isOpen() {+ return Boolean(this.etherpad);}+ /**+ *+ */isVisible() {return VideoLayout.isLargeContainerTypeVisible(ETHERPAD_CONTAINER_TYPE);}@@ -173,7 +211,7 @@ export default class EtherpadManager {/*** Create new Etherpad frame.*/- openEtherpad () {+ openEtherpad() {this.etherpad = new Etherpad(this.domain, this.name);VideoLayout.addLargeVideoContainer(ETHERPAD_CONTAINER_TYPE,@@ -185,12 +223,12 @@ export default class EtherpadManager {* Toggle Etherpad frame visibility.* Open new Etherpad frame if there is no Etherpad frame yet.*/- toggleEtherpad () {+ toggleEtherpad() {if (!this.isOpen) {this.openEtherpad();}- let isVisible = this.isVisible();+ const isVisible = this.isVisible();VideoLayout.showLargeVideoContainer(ETHERPAD_CONTAINER_TYPE, !isVisible);diff --git a/modules/UI/recording/Recording.js b/modules/UI/recording/Recording.jsindex 696d5b48e6..0b458fd533 100644--- a/modules/UI/recording/Recording.js+++ b/modules/UI/recording/Recording.js@@ -14,9 +14,9 @@* See the License for the specific language governing permissions and* limitations under the License.*/-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);-import UIEvents from "../../../service/UI/UIEvents";+import UIEvents from '../../../service/UI/UIEvents';import UIUtil from '../util/UIUtil';import VideoLayout from '../videolayout/VideoLayout';@@ -84,7 +84,7 @@ let dialog = null;*/function _isRecordingButtonEnabled() {return (- interfaceConfig.TOOLBAR_BUTTONS.indexOf("recording") !== -1+ interfaceConfig.TOOLBAR_BUTTONS.indexOf('recording') !== -1&& config.enableRecording&& APP.conference.isRecordingSupported());}@@ -95,69 +95,75 @@ function _isRecordingButtonEnabled() {*/function _requestLiveStreamId() {const cancelButton- = APP.translation.generateTranslationHTML("dialog.Cancel");- const backButton = APP.translation.generateTranslationHTML("dialog.Back");+ = APP.translation.generateTranslationHTML('dialog.Cancel');+ const backButton = APP.translation.generateTranslationHTML('dialog.Back');const startStreamingButton- = APP.translation.generateTranslationHTML("dialog.startLiveStreaming");+ = APP.translation.generateTranslationHTML('dialog.startLiveStreaming');const streamIdRequired= APP.translation.generateTranslationHTML(- "liveStreaming.streamIdRequired");+ 'liveStreaming.streamIdRequired');const streamIdHelp= APP.translation.generateTranslationHTML(- "liveStreaming.streamIdHelp");+ 'liveStreaming.streamIdHelp');- return new Promise(function (resolve, reject) {+ return new Promise((resolve, reject) => {dialog = APP.UI.messageHandler.openDialogWithStates({state0: {- titleKey: "dialog.liveStreaming",+ titleKey: 'dialog.liveStreaming',html:`<input class="input-control"name="streamId" type="text"data-i18n="[placeholder]dialog.streamKey"autofocus><div style="text-align: right"><a class="helper-link" target="_new"- href="${interfaceConfig.LIVE_STREAMING_HELP_LINK}">`- + streamIdHelp- + `</a></div>`,+ href="${interfaceConfig.LIVE_STREAMING_HELP_LINK}">${+ streamIdHelp+}</a></div>`,persistent: false,buttons: [- {title: cancelButton, value: false},- {title: startStreamingButton, value: true}+ { title: cancelButton,+ value: false },+ { title: startStreamingButton,+ value: true }],focus: ':input:first',defaultButton: 1,- submit: function (e, v, m, f) {+ submit(e, v, m, f) { // eslint-disable-line max-paramse.preventDefault();if (v) {if (f.streamId && f.streamId.length > 0) {resolve(UIUtil.escapeHtml(f.streamId));dialog.close();+return;}- else {- dialog.goToState('state1');- return false;- }- } else {- reject(APP.UI.messageHandler.CANCEL);- dialog.close();+ dialog.goToState('state1');+return false;+}+ reject(APP.UI.messageHandler.CANCEL);+ dialog.close();++ return false;+}},state1: {- titleKey: "dialog.liveStreaming",+ titleKey: 'dialog.liveStreaming',html: streamIdRequired,persistent: false,buttons: [- {title: cancelButton, value: false},- {title: backButton, value: true}+ { title: cancelButton,+ value: false },+ { title: backButton,+ value: true }],focus: ':input:first',defaultButton: 1,- submit: function (e, v) {+ submit(e, v) {e.preventDefault();if (v === 0) {reject(APP.UI.messageHandler.CANCEL);@@ -168,7 +174,7 @@ function _requestLiveStreamId() {}}}, {- close: function () {+ close() {dialog = null;}});@@ -180,26 +186,29 @@ function _requestLiveStreamId() {* @returns {Promise}*/function _requestRecordingToken() {- let titleKey = "dialog.recordingToken";- let msgString = (- `<input name="recordingToken" type="text"+ const titleKey = 'dialog.recordingToken';+ const msgString+ = `<input name="recordingToken" type="text"data-i18n="[placeholder]dialog.token"class="input-control"autofocus>`- );- return new Promise(function (resolve, reject) {++ ;+++ return new Promise((resolve, reject) => {dialog = APP.UI.messageHandler.openTwoButtonDialog({titleKey,msgString,leftButtonKey: 'dialog.Save',- submitFunction: function (e, v, m, f) {+ submitFunction(e, v, m, f) { // eslint-disable-line max-paramsif (v && f.recordingToken) {resolve(UIUtil.escapeHtml(f.recordingToken));} else {reject(APP.UI.messageHandler.CANCEL);}},- closeFunction: function () {+ closeFunction() {dialog = null;},focus: ':input:first'@@ -215,18 +224,18 @@ function _requestRecordingToken() {* @private*/function _showStopRecordingPrompt(recordingType) {- var title;- var message;- var buttonKey;- if (recordingType === "jibri") {- title = "dialog.liveStreaming";- message = "dialog.stopStreamingWarning";- buttonKey = "dialog.stopLiveStreaming";- }- else {- title = "dialog.recording";- message = "dialog.stopRecordingWarning";- buttonKey = "dialog.stopRecording";+ let title;+ let message;+ let buttonKey;++ if (recordingType === 'jibri') {+ title = 'dialog.liveStreaming';+ message = 'dialog.stopStreamingWarning';+ buttonKey = 'dialog.stopLiveStreaming';+ } else {+ title = 'dialog.recording';+ message = 'dialog.stopRecordingWarning';+ buttonKey = 'dialog.stopRecording';}return new Promise((resolve, reject) => {@@ -248,7 +257,10 @@ function _showStopRecordingPrompt(recordingType) {* @returns {boolean} true if the condition is met or false otherwise.*/function isStartingStatus(status) {- return status === JitsiRecordingStatus.PENDING || status === JitsiRecordingStatus.RETRYING;+ return (+ status === JitsiRecordingStatus.PENDING+ || status === JitsiRecordingStatus.RETRYING+ );}/**@@ -256,7 +268,7 @@ function isStartingStatus(status) {* @type {{init, initRecordingButton, showRecordingButton, updateRecordingState,* updateRecordingUI, checkAutoRecord}}*/-var Recording = {+const Recording = {/*** Initializes the recording UI.*/@@ -267,11 +279,10 @@ var Recording = {this.updateRecordingState(APP.conference.getRecordingState());if (recordingType === 'jibri') {- this.baseClass = "fa fa-play-circle";+ this.baseClass = 'fa fa-play-circle';Object.assign(this, STREAMING_TRANSLATION_KEYS);- }- else {- this.baseClass = "icon-recEnable";+ } else {+ this.baseClass = 'icon-recEnable';Object.assign(this, RECORDING_TRANSLATION_KEYS);}@@ -301,7 +312,7 @@ var Recording = {const selector = $('#toolbar_button_record');selector.addClass(this.baseClass);- selector.attr("data-i18n", "[content]" + this.recordingButtonTooltip);+ selector.attr('data-i18n', `[content]${this.recordingButtonTooltip}`);APP.translation.translateElement(selector);},@@ -310,8 +321,8 @@ var Recording = {* @param show {true} to show the recording button, {false} to hide it*/showRecordingButton(show) {- let shouldShow = show && _isRecordingButtonEnabled();- let id = 'toolbar_button_record';+ const shouldShow = show && _isRecordingButtonEnabled();+ const id = 'toolbar_button_record';UIUtil.setVisible(id, shouldShow);},@@ -322,12 +333,14 @@ var Recording = {*/updateRecordingState(recordingState) {// I'm the recorder, so I don't want to see any UI related to states.- if (config.iAmRecorder)+ if (config.iAmRecorder) {return;+ }// If there's no state change, we ignore the update.- if (!recordingState || this.currentState === recordingState)+ if (!recordingState || this.currentState === recordingState) {return;+ }this.updateRecordingUI(recordingState);},@@ -338,7 +351,8 @@ var Recording = {*/updateRecordingUI(recordingState) {- let oldState = this.currentState;+ const oldState = this.currentState;+this.currentState = recordingState;let labelDisplayConfiguration;@@ -366,6 +380,7 @@ var Recording = {// We don't want UI changes if this is an availability change.if (oldState !== JitsiRecordingStatus.ON && !wasInStartingStatus) {APP.store.dispatch(updateRecordingState({ recordingState }));+return;}@@ -378,7 +393,7 @@ var Recording = {this._setToolbarButtonToggled(false);- setTimeout(function(){+ setTimeout(() => {APP.store.dispatch(hideRecordingLabel());}, 5000);@@ -408,7 +423,8 @@ var Recording = {}// Return an empty label display configuration to indicate no label- // should be displayed. The JitsiRecordingStatus.AVAIABLE case is handled here.+ // should be displayed. The JitsiRecordingStatus.AVAIABLE case is+ // handled here.default: {labelDisplayConfiguration = null;}@@ -450,42 +466,48 @@ var Recording = {this.eventEmitter.emit(UIEvents.RECORDING_TOGGLED);sendEvent('recording.stopped');},- () => {});+ () => {}); // eslint-disable-line no-empty-functionbreak;}case JitsiRecordingStatus.AVAILABLE:case JitsiRecordingStatus.OFF: {- if (this.recordingType === 'jibri')- _requestLiveStreamId().then(streamId => {+ if (this.recordingType === 'jibri') {+ _requestLiveStreamId()+ .then(streamId => {this.eventEmitter.emit(UIEvents.RECORDING_TOGGLED,{ streamId });sendEvent('recording.started');- }).catch(reason => {- if (reason !== APP.UI.messageHandler.CANCEL)- logger.error(reason);- else+ })+ .catch(reason => {+ if (reason === APP.UI.messageHandler.CANCEL) {sendEvent('recording.canceled');+ } else {+ logger.error(reason);+ }});- else {+ } else {if (this.predefinedToken) {this.eventEmitter.emit(UIEvents.RECORDING_TOGGLED,{ token: this.predefinedToken });sendEvent('recording.started');+return;}- _requestRecordingToken().then((token) => {+ _requestRecordingToken().then(token => {this.eventEmitter.emit(UIEvents.RECORDING_TOGGLED,{ token });sendEvent('recording.started');- }).catch(reason => {- if (reason !== APP.UI.messageHandler.CANCEL)- logger.error(reason);- else+ })+ .catch(reason => {+ if (reason === APP.UI.messageHandler.CANCEL) {sendEvent('recording.canceled');+ } else {+ logger.error(reason);+ }});}break;@@ -521,7 +543,7 @@ var Recording = {* or not*/_setToolbarButtonToggled(isToggled) {- $("#toolbar_button_record").toggleClass("toggled", isToggled);+ $('#toolbar_button_record').toggleClass('toggled', isToggled);}};diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.jsindex e99fafd670..62c50a7c49 100644--- a/modules/UI/shared_video/SharedVideo.js+++ b/modules/UI/shared_video/SharedVideo.js@@ -1,10 +1,10 @@/* global $, APP, YT, onPlayerReady, onPlayerStateChange, onPlayerError */-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);import UIUtil from '../util/UIUtil';import UIEvents from '../../../service/UI/UIEvents';-import VideoLayout from "../videolayout/VideoLayout";+import VideoLayout from '../videolayout/VideoLayout';import LargeContainer from '../videolayout/LargeContainer';import Filmstrip from '../videolayout/Filmstrip';@@ -17,13 +17,13 @@ import { dockToolbox, showToolbox } from '../../../react/features/toolbox';import SharedVideoThumb from './SharedVideoThumb';-export const SHARED_VIDEO_CONTAINER_TYPE = "sharedvideo";+export const SHARED_VIDEO_CONTAINER_TYPE = 'sharedvideo';/*** Example shared video link.* @type {string}*/-const defaultSharedVideoLink = "https://www.youtube.com/watch?v=xNXN7CZk8X0";+const defaultSharedVideoLink = 'https://www.youtube.com/watch?v=xNXN7CZk8X0';const updateInterval = 5000; // milliseconds/**@@ -36,7 +36,10 @@ let dialog = null;* Manager of shared video.*/export default class SharedVideoManager {- constructor (emitter) {+ /**+ *+ */+ constructor(emitter) {this.emitter = emitter;this.isSharedVideoShown = false;this.isPlayerAPILoaded = false;@@ -52,10 +55,10 @@ export default class SharedVideoManager {* currently on.*/isSharedVideoVolumeOn() {- return (this.player+ return this.player&& this.player.getPlayerState() === YT.PlayerState.PLAYING&& !this.player.isMuted()- && this.player.getVolume() > 0);+ && this.player.getVolume() > 0;}/**@@ -70,11 +73,12 @@ export default class SharedVideoManager {* Starts shared video by asking user for url, or if its already working* asks whether the user wants to stop sharing the video.*/- toggleSharedVideo () {- if (dialog)+ toggleSharedVideo() {+ if (dialog) {return;+ }- if(!this.isSharedVideoShown) {+ if (!this.isSharedVideoShown) {requestVideoLink().then(url => {this.emitter.emit(@@ -86,10 +90,11 @@ export default class SharedVideoManager {sendEvent('sharedvideo.canceled');});+return;}- if(APP.conference.isLocalId(this.from)) {+ if (APP.conference.isLocalId(this.from)) {showStopVideoPropmpt().then(() => {// make sure we stop updates for playing before we send stop@@ -104,13 +109,13 @@ export default class SharedVideoManager {UIEvents.UPDATE_SHARED_VIDEO, this.url, 'stop');sendEvent('sharedvideo.stoped');},- () => {});+ () => {}); // eslint-disable-line no-empty-function} else {dialog = APP.UI.messageHandler.openMessageDialog(- "dialog.shareVideoTitle",- "dialog.alreadySharedVideoMsg",+ 'dialog.shareVideoTitle',+ 'dialog.alreadySharedVideoMsg',null,- function () {+ () => {dialog = null;});@@ -126,9 +131,10 @@ export default class SharedVideoManager {* @param url the video url* @param attributes*/- onSharedVideoStart (id, url, attributes) {- if (this.isSharedVideoShown)+ onSharedVideoStart(id, url, attributes) {+ if (this.isSharedVideoShown) {return;+ }this.isSharedVideoShown = true;@@ -140,15 +146,16 @@ export default class SharedVideoManager {this.mutedWithUserInteraction = APP.conference.isLocalAudioMuted();- //listen for local audio mute events+ // listen for local audio mute eventsthis.localAudioMutedListener = this.onLocalAudioMuted.bind(this);this.emitter.on(UIEvents.AUDIO_MUTED, this.localAudioMutedListener);// This code loads the IFrame Player API code asynchronously.- var tag = document.createElement('script');+ const tag = document.createElement('script');++ tag.src = 'https://www.youtube.com/iframe_api';+ const firstScriptTag = document.getElementsByTagName('script')[0];- tag.src = "https://www.youtube.com/iframe_api";- var firstScriptTag = document.getElementsByTagName('script')[0];firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);// sometimes we receive errors like player not defined@@ -158,14 +165,16 @@ export default class SharedVideoManager {// and will process any initial attributes if anythis.initialAttributes = attributes;- var self = this;- if(self.isPlayerAPILoaded)+ const self = this;++ if (self.isPlayerAPILoaded) {window.onYouTubeIframeAPIReady();- else+ } else {window.onYouTubeIframeAPIReady = function() {self.isPlayerAPILoaded = true;- let showControls = APP.conference.isLocalId(self.from) ? 1 : 0;- let p = new YT.Player('sharedVideoIFrame', {+ const showControls+ = APP.conference.isLocalId(self.from) ? 1 : 0;+ const p = new YT.Player('sharedVideoIFrame', {height: '100%',width: '100%',videoId: self.url,@@ -174,7 +183,7 @@ export default class SharedVideoManager {'fs': '0','autoplay': 0,'controls': showControls,- 'rel' : 0+ 'rel': 0},events: {'onReady': onPlayerReady,@@ -185,28 +194,28 @@ export default class SharedVideoManager {// add listener for volume changesp.addEventListener(- "onVolumeChange", "onVolumeChange");+ 'onVolumeChange', 'onVolumeChange');- if (APP.conference.isLocalId(self.from)){- // adds progress listener that will be firing events- // while we are paused and we change the progress of the- // video (seeking forward or backward on the video)+ if (APP.conference.isLocalId(self.from)) {+ // adds progress listener that will be firing events+ // while we are paused and we change the progress of the+ // video (seeking forward or backward on the video)p.addEventListener(- "onVideoProgress", "onVideoProgress");+ 'onVideoProgress', 'onVideoProgress');}};+ }/*** Indicates that a change in state has occurred for the shared video.* @param event the event notifying us of the change*/window.onPlayerStateChange = function(event) {+ // eslint-disable-next-line eqeqeqif (event.data == YT.PlayerState.PLAYING) {-self.player = event.target;- if(self.initialAttributes)- {+ if (self.initialAttributes) {// If a network update has occurred already now is the// time to process it.self.processVideoUpdate(@@ -216,10 +225,12 @@ export default class SharedVideoManager {self.initialAttributes = null;}self.smartAudioMute();+ // eslint-disable-next-line eqeqeq} else if (event.data == YT.PlayerState.PAUSED) {self.smartAudioUnmute();sendEvent('sharedvideo.paused');}+ // eslint-disable-next-line eqeqeqself.fireSharedVideoEvent(event.data == YT.PlayerState.PAUSED);};@@ -227,8 +238,10 @@ export default class SharedVideoManager {* Track player progress while paused.* @param event*/- window.onVideoProgress = function (event) {- let state = event.target.getPlayerState();+ window.onVideoProgress = function(event) {+ const state = event.target.getPlayerState();++ // eslint-disable-next-line eqeqeqif (state == YT.PlayerState.PAUSED) {self.fireSharedVideoEvent(true);}@@ -238,38 +251,44 @@ export default class SharedVideoManager {* Gets notified for volume state changed.* @param event*/- window.onVolumeChange = function (event) {+ window.onVolumeChange = function(event) {self.fireSharedVideoEvent();// let's check, if player is not muted lets mute locally- if(event.data.volume > 0 && !event.data.muted) {+ if (event.data.volume > 0 && !event.data.muted) {self.smartAudioMute();- }- else if (event.data.volume <=0 || event.data.muted) {+ } else if (event.data.volume <= 0 || event.data.muted) {self.smartAudioUnmute();}sendEvent('sharedvideo.volumechanged');};window.onPlayerReady = function(event) {- let player = event.target;+ const player = event.target;+// do not relay on autoplay as it is not sending all of the events// in onPlayerStateChange+player.playVideo();- let thumb = new SharedVideoThumb(+ const thumb = new SharedVideoThumb(self.url, SHARED_VIDEO_CONTAINER_TYPE, VideoLayout);+thumb.setDisplayName(player.getVideoData().title);VideoLayout.addRemoteVideoContainer(self.url, thumb);- let iframe = player.getIframe();+ const iframe = player.getIframe();++ // eslint-disable-next-line no-use-before-defineself.sharedVideo = new SharedVideoContainer(- {url, iframe, player});+ { url,+ iframe,+ player });- //prevents pausing participants not sharing the video+ // prevents pausing participants not sharing the video// to pause the videoif (!APP.conference.isLocalId(self.from)) {- $("#sharedVideo").css("pointer-events","none");+ $('#sharedVideo').css('pointer-events', 'none');}VideoLayout.addLargeVideoContainer(@@ -285,7 +304,7 @@ export default class SharedVideoManager {// If we are sending the command and we are starting the player// we need to continuously send the player current time position- if(APP.conference.isLocalId(self.from)) {+ if (APP.conference.isLocalId(self.from)) {self.intervalId = setInterval(self.fireSharedVideoEvent.bind(self),updateInterval);@@ -293,7 +312,8 @@ export default class SharedVideoManager {};window.onPlayerError = function(event) {- logger.error("Error in the player:", event.data);+ logger.error('Error in the player:', event.data);+// store the error player, so we can remove itself.errorInPlayer = event.target;};@@ -304,21 +324,23 @@ export default class SharedVideoManager {* @param player the player to operate over* @param attributes the attributes with the player state we want*/- processVideoUpdate (player, attributes)- {- if(!attributes)+ processVideoUpdate(player, attributes) {+ if (!attributes) {return;+ }+ // eslint-disable-next-line eqeqeqif (attributes.state == 'playing') {- let isPlayerPaused- = (this.player.getPlayerState() === YT.PlayerState.PAUSED);+ const isPlayerPaused+ = this.player.getPlayerState() === YT.PlayerState.PAUSED;// If our player is currently paused force the seek.this.processTime(player, attributes, isPlayerPaused);// Process mute.- let isAttrMuted = (attributes.muted === "true");+ const isAttrMuted = attributes.muted === 'true';+if (player.isMuted() !== isAttrMuted) {this.smartPlayerMute(isAttrMuted, true);}@@ -326,16 +348,18 @@ export default class SharedVideoManager {// Process volumeif (!isAttrMuted&& attributes.volume !== undefined+ // eslint-disable-next-line eqeqeq&& player.getVolume() != attributes.volume) {player.setVolume(attributes.volume);- logger.info("Player change of volume:" + attributes.volume);+ logger.info(`Player change of volume:${attributes.volume}`);this.showSharedVideoMutedPopup(false);}- if (isPlayerPaused)+ if (isPlayerPaused) {player.playVideo();-+ }+ // eslint-disable-next-line eqeqeq} else if (attributes.state == 'pause') {// if its not paused, pause itplayer.pauseVideo();@@ -350,23 +374,23 @@ export default class SharedVideoManager {* @param attributes the attributes with the player state we want* @param forceSeek whether seek should be forced*/- processTime (player, attributes, forceSeek)- {- if(forceSeek) {- logger.info("Player seekTo:", attributes.time);+ processTime(player, attributes, forceSeek) {+ if (forceSeek) {+ logger.info('Player seekTo:', attributes.time);player.seekTo(attributes.time);+return;}// check received time and current time- let currentPosition = player.getCurrentTime();- let diff = Math.abs(attributes.time - currentPosition);+ const currentPosition = player.getCurrentTime();+ const diff = Math.abs(attributes.time - currentPosition);// if we drift more than the interval for checking// sync, the interval is in milliseconds- if(diff > updateInterval/1000) {- logger.info("Player seekTo:", attributes.time,- " current time is:", currentPosition, " diff:", diff);+ if (diff > updateInterval / 1000) {+ logger.info('Player seekTo:', attributes.time,+ ' current time is:', currentPosition, ' diff:', diff);player.seekTo(attributes.time);}}@@ -374,24 +398,25 @@ export default class SharedVideoManager {/*** Checks current state of the player and fire an event with the values.*/- fireSharedVideoEvent(sendPauseEvent)- {+ fireSharedVideoEvent(sendPauseEvent) {// ignore update checks if we are not the owner of the video// or there is still no player defined or we are stopped// (in a process of stopping)- if(!APP.conference.isLocalId(this.from) || !this.player- || !this.isSharedVideoShown)+ if (!APP.conference.isLocalId(this.from) || !this.player+ || !this.isSharedVideoShown) {return;+ }++ const state = this.player.getPlayerState();- let state = this.player.getPlayerState();// if its paused and haven't been pause - send paused+if (state === YT.PlayerState.PAUSED && sendPauseEvent) {this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO,this.url, 'pause', this.player.getCurrentTime());- }- // if its playing and it was paused - send update with time- // if its playing and was playing just send update with time- else if (state === YT.PlayerState.PLAYING) {+ } else if (state === YT.PlayerState.PLAYING) {+ // if its playing and it was paused - send update with time+ // if its playing and was playing just send update with timethis.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO,this.url, 'playing',this.player.getCurrentTime(),@@ -407,20 +432,22 @@ export default class SharedVideoManager {* @param url the video url* @param attributes*/- onSharedVideoUpdate (id, url, attributes) {+ onSharedVideoUpdate(id, url, attributes) {// if we are sending the event ignore- if(APP.conference.isLocalId(this.from)) {+ if (APP.conference.isLocalId(this.from)) {return;}- if(!this.isSharedVideoShown) {+ if (!this.isSharedVideoShown) {this.onSharedVideoStart(id, url, attributes);+return;}- if(!this.player)+ // eslint-disable-next-line no-negated-condition+ if (!this.player) {this.initialAttributes = attributes;- else {+ } else {this.processVideoUpdate(this.player, attributes);}}@@ -431,18 +458,21 @@ export default class SharedVideoManager {* left and we want to remove video if the user sharing it left).* @param id the id of the sender of the command*/- onSharedVideoStop (id, attributes) {- if (!this.isSharedVideoShown)+ onSharedVideoStop(id, attributes) {+ if (!this.isSharedVideoShown) {return;+ }- if(this.from !== id)+ if (this.from !== id) {return;+ }- if(!this.player) {+ if (!this.player) {// if there is no error in the player till now,// store the initial attributesif (!this.errorInPlayer) {this.initialAttributes = attributes;+return;}}@@ -458,18 +488,19 @@ export default class SharedVideoManager {VideoLayout.removeLargeVideoContainer(SHARED_VIDEO_CONTAINER_TYPE);- if(this.player) {+ if (this.player) {this.player.destroy();this.player = null;- } // if there is an error in player, remove that instance- else if (this.errorInPlayer) {+ } else if (this.errorInPlayer) {+ // if there is an error in player, remove that instancethis.errorInPlayer.destroy();this.errorInPlayer = null;}this.smartAudioUnmute();+// revert to original behavior (prevents pausing// for participants not sharing the video to pause it)- $("#sharedVideo").css("pointer-events","auto");+ $('#sharedVideo').css('pointer-events', 'auto');this.emitter.emit(UIEvents.UPDATE_SHARED_VIDEO, null, 'removed');@@ -488,15 +519,16 @@ export default class SharedVideoManager {* @param {boolean} indicates if this mute was a result of user interaction,* i.e. pressing the mute button or it was programatically triggerred*/- onLocalAudioMuted (muted, userInteraction) {- if(!this.player)+ onLocalAudioMuted(muted, userInteraction) {+ if (!this.player) {return;+ }if (muted) {this.mutedWithUserInteraction = userInteraction;- }- else if (this.player.getPlayerState() !== YT.PlayerState.PAUSED) {+ } else if (this.player.getPlayerState() !== YT.PlayerState.PAUSED) {this.smartPlayerMute(true, false);+// Check if we need to update other participantsthis.fireSharedVideoEvent();}@@ -512,13 +544,14 @@ export default class SharedVideoManager {if (!this.player.isMuted() && mute) {this.player.mute();- if (isVideoUpdate)+ if (isVideoUpdate) {this.smartAudioUnmute();- }- else if (this.player.isMuted() && !mute) {+ }+ } else if (this.player.isMuted() && !mute) {this.player.unMute();- if (isVideoUpdate)+ if (isVideoUpdate) {this.smartAudioMute();+ }}this.showSharedVideoMutedPopup(mute);@@ -533,7 +566,7 @@ export default class SharedVideoManager {if (APP.conference.isLocalAudioMuted()&& !this.mutedWithUserInteraction&& !this.isSharedVideoVolumeOn()) {- sendEvent("sharedvideo.audio.unmuted");+ sendEvent('sharedvideo.audio.unmuted');logger.log('Shared video: audio unmuted');this.emitter.emit(UIEvents.AUDIO_MUTED, false, false);this.showMicMutedPopup(false);@@ -547,7 +580,7 @@ export default class SharedVideoManager {smartAudioMute() {if (!APP.conference.isLocalAudioMuted()&& this.isSharedVideoVolumeOn()) {- sendEvent("sharedvideo.audio.muted");+ sendEvent('sharedvideo.audio.muted');logger.log('Shared video: audio muted');this.emitter.emit(UIEvents.AUDIO_MUTED, true, false);this.showMicMutedPopup(true);@@ -559,9 +592,10 @@ export default class SharedVideoManager {* of automatic mute after a shared video has started.* @param show boolean, show or hide the notification*/- showMicMutedPopup (show) {- if(show)+ showMicMutedPopup(show) {+ if (show) {this.showSharedVideoMutedPopup(false);+ }APP.UI.showCustomToolbarPopup('microphone', 'micMutedPopup', show, 5000);@@ -573,9 +607,10 @@ export default class SharedVideoManager {* mic.* @param show boolean, show or hide the notification*/- showSharedVideoMutedPopup (show) {- if(show)+ showSharedVideoMutedPopup(show) {+ if (show) {this.showMicMutedPopup(false);+ }APP.UI.showCustomToolbarPopup('sharedvideo', 'sharedVideoMutedPopup', show, 5000);@@ -586,8 +621,10 @@ export default class SharedVideoManager {* Container for shared video iframe.*/class SharedVideoContainer extends LargeContainer {-- constructor ({url, iframe, player}) {+ /**+ *+ */+ constructor({ url, iframe, player }) {super();this.$iframe = $(iframe);@@ -595,43 +632,62 @@ class SharedVideoContainer extends LargeContainer {this.player = player;}- show () {- let self = this;+ /**+ *+ */+ show() {+ const self = this;++return new Promise(resolve => {this.$iframe.fadeIn(300, () => {self.bodyBackground = document.body.style.background;document.body.style.background = 'black';- this.$iframe.css({opacity: 1});+ this.$iframe.css({ opacity: 1 });APP.store.dispatch(dockToolbox(true));resolve();});});}- hide () {- let self = this;+ /**+ *+ */+ hide() {+ const self = this;+APP.store.dispatch(dockToolbox(false));+return new Promise(resolve => {this.$iframe.fadeOut(300, () => {document.body.style.background = self.bodyBackground;- this.$iframe.css({opacity: 0});+ this.$iframe.css({ opacity: 0 });resolve();});});}- onHoverIn () {+ /**+ *+ */+ onHoverIn() {APP.store.dispatch(showToolbox());}- get id () {+ /**+ *+ */+ get id() {return this.url;}- resize (containerWidth, containerHeight) {- let height = containerHeight - Filmstrip.getFilmstripHeight();+ /**+ *+ */+ resize(containerWidth, containerHeight) {+ const height = containerHeight - Filmstrip.getFilmstripHeight();- let width = containerWidth;+ const width = containerWidth;this.$iframe.width(width).height(height);}@@ -639,7 +695,7 @@ class SharedVideoContainer extends LargeContainer {/*** @return {boolean} do not switch on dominant speaker event if on stage.*/- stayOnStage () {+ stayOnStage() {return false;}}@@ -650,16 +706,18 @@ class SharedVideoContainer extends LargeContainer {* @returns {boolean}*/function getYoutubeLink(url) {- let p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;//jshint ignore:line- return (url.match(p)) ? RegExp.$1 : false;+ const p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;// eslint-disable-line max-len+++ return url.match(p) ? RegExp.$1 : false;}/*** Ask user if he want to close shared video.*/function showStopVideoPropmpt() {- return new Promise(function (resolve, reject) {- let submitFunction = function(e,v) {+ return new Promise((resolve, reject) => {+ const submitFunction = function(e, v) {if (v) {resolve();} else {@@ -667,14 +725,14 @@ function showStopVideoPropmpt() {}};- let closeFunction = function () {+ const closeFunction = function() {dialog = null;};dialog = APP.UI.messageHandler.openTwoButtonDialog({- titleKey: "dialog.removeSharedVideoTitle",- msgKey: "dialog.removeSharedVideoMsg",- leftButtonKey: "dialog.Remove",+ titleKey: 'dialog.removeSharedVideoTitle',+ msgKey: 'dialog.removeSharedVideoMsg',+ leftButtonKey: 'dialog.Remove',submitFunction,closeFunction});@@ -686,46 +744,53 @@ function showStopVideoPropmpt() {* Dialog validates client input to allow only youtube urls.*/function requestVideoLink() {- let i18n = APP.translation;- const cancelButton = i18n.generateTranslationHTML("dialog.Cancel");- const shareButton = i18n.generateTranslationHTML("dialog.Share");- const backButton = i18n.generateTranslationHTML("dialog.Back");+ const i18n = APP.translation;+ const cancelButton = i18n.generateTranslationHTML('dialog.Cancel');+ const shareButton = i18n.generateTranslationHTML('dialog.Share');+ const backButton = i18n.generateTranslationHTML('dialog.Back');const linkError- = i18n.generateTranslationHTML("dialog.shareVideoLinkError");+ = i18n.generateTranslationHTML('dialog.shareVideoLinkError');- return new Promise(function (resolve, reject) {+ return new Promise((resolve, reject) => {dialog = APP.UI.messageHandler.openDialogWithStates({state0: {- titleKey: "dialog.shareVideoTitle",- html: `- <input name="sharedVideoUrl" type="text"- class="input-control"- data-i18n="[placeholder]defaultLink"+ titleKey: 'dialog.shareVideoTitle',+ html: `+ <input name='sharedVideoUrl' type='text'+ class='input-control'+ data-i18n='[placeholder]defaultLink'autofocus>`,persistent: false,buttons: [- {title: cancelButton, value: false},- {title: shareButton, value: true}+ { title: cancelButton,+ value: false },+ { title: shareButton,+ value: true }],focus: ':input:first',defaultButton: 1,- submit: function (e, v, m, f) {+ submit(e, v, m, f) { // eslint-disable-line max-paramse.preventDefault();if (!v) {reject('cancelled');dialog.close();+return;}- let sharedVideoUrl = f.sharedVideoUrl;+ const sharedVideoUrl = f.sharedVideoUrl;+if (!sharedVideoUrl) {return;}- let urlValue = encodeURI(UIUtil.escapeHtml(sharedVideoUrl));- let yVideoId = getYoutubeLink(urlValue);+ const urlValue+ = encodeURI(UIUtil.escapeHtml(sharedVideoUrl));+ const yVideoId = getYoutubeLink(urlValue);+if (!yVideoId) {dialog.goToState('state1');+return false;}@@ -735,16 +800,18 @@ function requestVideoLink() {},state1: {- titleKey: "dialog.shareVideoTitle",+ titleKey: 'dialog.shareVideoTitle',html: linkError,persistent: false,buttons: [- {title: cancelButton, value: false},- {title: backButton, value: true}+ { title: cancelButton,+ value: false },+ { title: backButton,+ value: true }],focus: ':input:first',defaultButton: 1,- submit: function (e, v) {+ submit(e, v) {e.preventDefault();if (v === 0) {reject();@@ -755,7 +822,7 @@ function requestVideoLink() {}}}, {- close: function () {+ close() {dialog = null;}}, {diff --git a/modules/UI/shared_video/SharedVideoThumb.js b/modules/UI/shared_video/SharedVideoThumb.jsindex 4171e33a9c..a33f73fc4e 100644--- a/modules/UI/shared_video/SharedVideoThumb.js+++ b/modules/UI/shared_video/SharedVideoThumb.js@@ -1,15 +1,17 @@/* global $ */import SmallVideo from '../videolayout/SmallVideo';-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);-export default function SharedVideoThumb (url, videoType, VideoLayout)-{+/**+ *+ */+export default function SharedVideoThumb(url, videoType, VideoLayout) {this.id = url;this.url = url;this.setVideoType(videoType);- this.videoSpanId = "sharedVideoContainer";+ this.videoSpanId = 'sharedVideoContainer';this.container = this.createContainer(this.videoSpanId);this.$container = $(this.container);this.container.onclick = this.videoClick.bind(this);@@ -23,42 +25,48 @@ SharedVideoThumb.prototype.constructor = SharedVideoThumb;/*** hide display name*/+// eslint-disable-next-line no-empty-function+SharedVideoThumb.prototype.setDeviceAvailabilityIcons = function() {};-SharedVideoThumb.prototype.setDeviceAvailabilityIcons = function () {};+// eslint-disable-next-line no-empty-function+SharedVideoThumb.prototype.avatarChanged = function() {};-SharedVideoThumb.prototype.avatarChanged = function () {};+SharedVideoThumb.prototype.createContainer = function(spanId) {+ const container = document.createElement('span');-SharedVideoThumb.prototype.createContainer = function (spanId) {- var container = document.createElement('span');container.id = spanId;container.className = 'videocontainer';// add the avatar- var avatar = document.createElement('img');+ const avatar = document.createElement('img');+avatar.className = 'sharedVideoAvatar';- avatar.src = "https://img.youtube.com/vi/" + this.url + "/0.jpg";+ avatar.src = `https://img.youtube.com/vi/${this.url}/0.jpg`;container.appendChild(avatar);const displayNameContainer = document.createElement('div');+displayNameContainer.className = 'displayNameContainer';container.appendChild(displayNameContainer);- var remotes = document.getElementById('filmstripRemoteVideosContainer');+ const remotes = document.getElementById('filmstripRemoteVideosContainer');++return remotes.appendChild(container);};/*** The thumb click handler.*/-SharedVideoThumb.prototype.videoClick = function () {+SharedVideoThumb.prototype.videoClick = function() {this.VideoLayout.handleVideoThumbClicked(this.url);};/*** Removes RemoteVideo from the page.*/-SharedVideoThumb.prototype.remove = function () {- logger.log("Remove shared video thumb", this.id);+SharedVideoThumb.prototype.remove = function() {+ logger.log('Remove shared video thumb', this.id);// Make sure that the large video is updated if are removing its// corresponding small video.@@ -75,8 +83,9 @@ SharedVideoThumb.prototype.remove = function () {*/SharedVideoThumb.prototype.setDisplayName = function(displayName) {if (!this.container) {- logger.warn( "Unable to set displayName - " + this.videoSpanId +- " does not exist");+ logger.warn(`Unable to set displayName - ${this.videoSpanId+ } does not exist`);+return;}diff --git a/modules/UI/side_pannels/SideContainerToggler.js b/modules/UI/side_pannels/SideContainerToggler.jsindex b845a59e5b..37900c67cd 100644--- a/modules/UI/side_pannels/SideContainerToggler.js+++ b/modules/UI/side_pannels/SideContainerToggler.js@@ -1,5 +1,5 @@/* global $ */-import UIEvents from "../../../service/UI/UIEvents";+import UIEvents from '../../../service/UI/UIEvents';/*** Handles open and close of the extended toolbar side panel@@ -19,22 +19,28 @@ const SideContainerToggler = {// We may not have a side toolbar container, for example, in// filmstrip-only mode.const sideToolbarContainer- = document.getElementById("sideToolbarContainer");+ = document.getElementById('sideToolbarContainer');- if (!sideToolbarContainer)+ if (!sideToolbarContainer) {return;+ }// Adds a listener for the animationend event that would take care of// hiding all internal containers when the extendedToolbarPanel is// closed.sideToolbarContainer.addEventListener(- "animationend",- function(e) {- if (e.animationName === "slideOutExt")- $("#sideToolbarContainer").children().each(function() {- if ($(this).hasClass("show"))+ 'animationend',+ e => {+ if (e.animationName === 'slideOutExt') {+ $('#sideToolbarContainer').children()+ .each(function() {+ /* eslint-disable no-invalid-this */+ if ($(this).hasClass('show')) {SideContainerToggler.hideInnerContainer($(this));+ }+ /* eslint-enable no-invalid-this */});+ }},false);},@@ -46,21 +52,26 @@ const SideContainerToggler = {* toggle*/toggle(elementId) {- let elementSelector = $(`#${elementId}`);- let isSelectorVisible = elementSelector.hasClass("show");+ const elementSelector = $(`#${elementId}`);+ const isSelectorVisible = elementSelector.hasClass('show');if (isSelectorVisible) {this.hide();- }- else {- if (this.isVisible())- $("#sideToolbarContainer").children().each(function() {- if ($(this).id !== elementId && $(this).hasClass("show"))+ } else {+ if (this.isVisible()) {+ $('#sideToolbarContainer').children()+ .each(function() {+ /* eslint-disable no-invalid-this */+ if ($(this).id !== elementId && $(this).hasClass('show')) {SideContainerToggler.hideInnerContainer($(this));+ }+ /* eslint-enable no-invalid-this */});+ }- if (!this.isVisible())+ if (!this.isVisible()) {this.show();+ }this.showInnerContainer(elementSelector);}@@ -71,7 +82,7 @@ const SideContainerToggler = {* otherwise returns {false}.*/isVisible() {- return $("#sideToolbarContainer").hasClass("slideInExt");+ return $('#sideToolbarContainer').hasClass('slideInExt');},/**@@ -79,24 +90,27 @@ const SideContainerToggler = {* {false} otherwise.*/isHovered() {- return $("#sideToolbarContainer:hover").length > 0;+ return $('#sideToolbarContainer:hover').length > 0;},/*** Hides the side toolbar panel with a slide out animation.*/hide() {- $("#sideToolbarContainer")- .removeClass("slideInExt").addClass("slideOutExt");+ $('#sideToolbarContainer')+ .removeClass('slideInExt')+.addClass('slideOutExt');},/*** Shows the side toolbar panel with a slide in animation.*/show() {- if (!this.isVisible())- $("#sideToolbarContainer")- .removeClass("slideOutExt").addClass("slideInExt");+ if (!this.isVisible()) {+ $('#sideToolbarContainer')+ .removeClass('slideOutExt')+.addClass('slideInExt');+ }},/**@@ -106,7 +120,7 @@ const SideContainerToggler = {* element to hide*/hideInnerContainer(containerSelector) {- containerSelector.removeClass("show").addClass("hide");+ containerSelector.removeClass('show').addClass('hide');this.eventEmitter.emit(UIEvents.SIDE_TOOLBAR_CONTAINER_TOGGLED,containerSelector.attr('id'), false);@@ -124,12 +138,16 @@ const SideContainerToggler = {// If we quickly show a container, while another one is animating// and animation never ends, so we do not really hide the first one and// we end up with to shown panels- $("#sideToolbarContainer").children().each(function() {- if ($(this).hasClass("show"))+ $('#sideToolbarContainer').children()+ .each(function() {+ /* eslint-disable no-invalid-this */+ if ($(this).hasClass('show')) {SideContainerToggler.hideInnerContainer($(this));+ }+ /* eslint-enable no-invalid-this */});- containerSelector.removeClass("hide").addClass("show");+ containerSelector.removeClass('hide').addClass('show');this.eventEmitter.emit(UIEvents.SIDE_TOOLBAR_CONTAINER_TOGGLED,containerSelector.attr('id'), true);@@ -138,9 +156,9 @@ const SideContainerToggler = {/*** TO FIX: do we need to resize the chat?*/- resize () {- //let [width, height] = UIUtil.getSidePanelSize();- //Chat.resizeChat(width, height);+ resize() {+ // let [width, height] = UIUtil.getSidePanelSize();+ // Chat.resizeChat(width, height);}};diff --git a/modules/UI/side_pannels/SidePanels.js b/modules/UI/side_pannels/SidePanels.jsindex 316c7713f3..37c9d9330c 100644--- a/modules/UI/side_pannels/SidePanels.js+++ b/modules/UI/side_pannels/SidePanels.js@@ -5,7 +5,7 @@ import ContactListView from './contactlist/ContactListView';import { isButtonEnabled } from '../../../react/features/toolbox';const SidePanels = {- init (eventEmitter) {+ init(eventEmitter) {// Initialize chatif (isButtonEnabled('chat')) {Chat.init(eventEmitter);diff --git a/modules/UI/side_pannels/chat/Chat.js b/modules/UI/side_pannels/chat/Chat.jsindex d4b44c0bf6..29ba2c4a9e 100644--- a/modules/UI/side_pannels/chat/Chat.js+++ b/modules/UI/side_pannels/chat/Chat.js@@ -1,8 +1,8 @@/* global APP, $ */-import {processReplacements, linkify} from './Replacement';+import { processReplacements, linkify } from './Replacement';import CommandsProcessor from './Commands';-import VideoLayout from "../../videolayout/VideoLayout";+import VideoLayout from '../../videolayout/VideoLayout';import UIUtil from '../../util/UIUtil';import UIEvents from '../../../../service/UI/UIEvents';@@ -36,6 +36,9 @@ const htmlStr = `</div></div>`;+/**+ *+ */function initHTML() {$(`#${sidePanelsContainerId}`).append(htmlStr);@@ -44,7 +47,7 @@ function initHTML() {/*** The container id, which is and the element id.*/-var CHAT_CONTAINER_ID = "chat_container";+const CHAT_CONTAINER_ID = 'chat_container';/*** Updates visual notification, indicating that a message has arrived.@@ -66,19 +69,15 @@ function updateVisualNotification() {= document.getElementById('toolbar_button_chat');const leftIndent= (UIUtil.getTextWidth(chatButtonElement)- - UIUtil.getTextWidth(unreadMsgElement))- / 2;+ - UIUtil.getTextWidth(unreadMsgElement)) / 2;const topIndent- = (UIUtil.getTextHeight(chatButtonElement)- - UIUtil.getTextHeight(unreadMsgElement))- / 2- - 5;+ = ((UIUtil.getTextHeight(chatButtonElement)+ - UIUtil.getTextHeight(unreadMsgElement)) / 2) - 5;unreadMsgElement.setAttribute('style',- 'top:' + topIndent + '; left:' + leftIndent + ';');- }- else {+ `top:${topIndent}; left:${leftIndent};`);+ } else {unreadMsgSelector.html('');}@@ -93,37 +92,49 @@ function updateVisualNotification() {* @returns {string}*/function getCurrentTime(stamp) {- var now = (stamp? new Date(stamp): new Date());- var hour = now.getHours();- var minute = now.getMinutes();- var second = now.getSeconds();- if(hour.toString().length === 1) {- hour = '0'+hour;+ const now = stamp ? new Date(stamp) : new Date();+ let hour = now.getHours();+ let minute = now.getMinutes();+ let second = now.getSeconds();++ if (hour.toString().length === 1) {+ hour = `0${hour}`;}- if(minute.toString().length === 1) {- minute = '0'+minute;+ if (minute.toString().length === 1) {+ minute = `0${minute}`;}- if(second.toString().length === 1) {- second = '0'+second;+ if (second.toString().length === 1) {+ second = `0${second}`;}- return hour+':'+minute+':'+second;++ return `${hour}:${minute}:${second}`;}+/**+ *+ */function toggleSmileys() {- var smileys = $('#smileysContainer');- if(!smileys.is(':visible')) {- smileys.show("slide", { direction: "down", duration: 300});+ const smileys = $('#smileysContainer'); // eslint-disable-line no-shadow++ if (smileys.is(':visible')) {+ smileys.hide('slide', { direction: 'down',+ duration: 300 });} else {- smileys.hide("slide", { direction: "down", duration: 300});+ smileys.show('slide', { direction: 'down',+ duration: 300 });}$('#usermsg').focus();}+/**+ *+ */function addClickFunction(smiley, number) {smiley.onclick = function addSmileyToMessage() {- var usermsg = $('#usermsg');- var message = usermsg.val();- message += smileys['smiley' + number];+ const usermsg = $('#usermsg');+ let message = usermsg.val();++ message += smileys[`smiley${number}`];usermsg.val(message);usermsg.get(0).setSelectionRange(message.length, message.length);toggleSmileys();@@ -135,35 +146,38 @@ function addClickFunction(smiley, number) {* Adds the smileys container to the chat*/function addSmileys() {- var smileysContainer = document.createElement('div');+ const smileysContainer = document.createElement('div');+smileysContainer.id = 'smileysContainer';- for(var i = 1; i <= 21; i++) {- var smileyContainer = document.createElement('div');- smileyContainer.id = 'smiley' + i;+ for (let i = 1; i <= 21; i++) {+ const smileyContainer = document.createElement('div');++ smileyContainer.id = `smiley${i}`;smileyContainer.className = 'smileyContainer';- var smiley = document.createElement('img');- smiley.src = 'images/smileys/smiley' + i + '.svg';- smiley.className = 'smiley';+ const smiley = document.createElement('img');++ smiley.src = `images/smileys/smiley${i}.svg`;+ smiley.className = 'smiley';addClickFunction(smiley, i);smileyContainer.appendChild(smiley);smileysContainer.appendChild(smileyContainer);}- $("#chat_container").append(smileysContainer);+ $('#chat_container').append(smileysContainer);}/*** Resizes the chat conversation.*/function resizeChatConversation() {- var msgareaHeight = $('#usermsg').outerHeight();- var chatspace = $('#' + CHAT_CONTAINER_ID);- var width = chatspace.width();- var chat = $('#chatconversation');- var smileys = $('#smileysarea');+ const msgareaHeight = $('#usermsg').outerHeight();+ const chatspace = $(`#${CHAT_CONTAINER_ID}`);+ const width = chatspace.width();+ const chat = $('#chatconversation');+ const smileys = $('#smileysarea'); // eslint-disable-line no-shadowsmileys.height(msgareaHeight);- $("#smileys").css('bottom', (msgareaHeight - 26) / 2);+ $('#smileys').css('bottom', (msgareaHeight - 26) / 2);$('#smileysContainer').css('bottom', msgareaHeight);chat.width(width - 10);chat.height(window.innerHeight - 15 - msgareaHeight);@@ -175,63 +189,71 @@ function resizeChatConversation() {** @param id {string} input id*/-function deferredFocus(id){+function deferredFocus(id) {setTimeout(() => $(`#${id}`).focus(), 400);}+/*** Chat related user interface.*/-var Chat = {+const Chat = {/*** Initializes chat related interface.*/- init (eventEmitter) {+ init(eventEmitter) {initHTML();if (APP.conference.getLocalDisplayName()) {Chat.setChatConversationMode(true);}- $("#smileys").click(function() {+ $('#smileys').click(() => {Chat.toggleSmileys();});- $('#nickinput').keydown(function (event) {+ $('#nickinput').keydown(function(event) {if (event.keyCode === 13) {event.preventDefault();- let val = this.value;- this.value = '';+ const val = this.value; // eslint-disable-line no-invalid-this++ this.value = '';// eslint-disable-line no-invalid-thiseventEmitter.emit(UIEvents.NICKNAME_CHANGED, val);deferredFocus('usermsg');}});- var usermsg = $('#usermsg');- usermsg.keydown(function (event) {+ const usermsg = $('#usermsg');++ usermsg.keydown(function(event) {if (event.keyCode === 13) {event.preventDefault();- var value = this.value;+ const value = this.value; // eslint-disable-line no-invalid-this+usermsg.val('').trigger('autosize.resize');- this.focus();- var command = new CommandsProcessor(value, eventEmitter);+ this.focus();// eslint-disable-line no-invalid-this+ const command = new CommandsProcessor(value, eventEmitter);+if (command.isCommand()) {command.processCommand();} else {- var message = UIUtil.escapeHtml(value);+ const message = UIUtil.escapeHtml(value);+eventEmitter.emit(UIEvents.MESSAGE_CREATED, message);}}});- var onTextAreaResize = function () {+ const onTextAreaResize = function() {resizeChatConversation();Chat.scrollChatToBottom();};- usermsg.autosize({callback: onTextAreaResize});++ usermsg.autosize({ callback: onTextAreaResize });eventEmitter.on(UIEvents.SIDE_TOOLBAR_CONTAINER_TOGGLED,- function(containerId, isVisible) {- if (containerId !== CHAT_CONTAINER_ID || !isVisible)+ (containerId, isVisible) => {+ if (containerId !== CHAT_CONTAINER_ID || !isVisible) {return;+ }unreadMessages = 0;updateVisualNotification();@@ -257,13 +279,14 @@ var Chat = {/*** Appends the given message to the chat conversation.*/- updateChatConversation (id, displayName, message, stamp) {- var divClassName = '';+ // eslint-disable-next-line max-params+ updateChatConversation(id, displayName, message, stamp) {+ let divClassName = '';if (APP.conference.isLocalId(id)) {- divClassName = "localuser";+ divClassName = 'localuser';} else {- divClassName = "remoteuser";+ divClassName = 'remoteuser';if (!Chat.isVisible()) {unreadMessages++;@@ -275,22 +298,25 @@ var Chat = {// replace links and smileys// Strophe already escapes special symbols on sending,// so we escape here only tags to avoid double &- var escMessage = message.replace(/</g, '<').- replace(/>/g, '>').replace(/\n/g, '<br/>');- var escDisplayName = UIUtil.escapeHtml(displayName);+ const escMessage = message.replace(/</g, '<')+ .replace(/>/g, '>')+.replace(/\n/g, '<br/>');+ const escDisplayName = UIUtil.escapeHtml(displayName);++ // eslint-disable-next-line no-param-reassignmessage = processReplacements(escMessage);- var messageContainer =- '<div class="chatmessage">'+- '<img src="images/chatArrow.svg" class="chatArrow">' +- '<div class="username ' + divClassName +'">' + escDisplayName +- '</div>' + '<div class="timestamp">' + getCurrentTime(stamp) +- '</div>' + '<div class="usermessage">' + message + '</div>' +- '</div>';+ const messageContainer+ = `${'<div class="chatmessage">'+ + '<img src="images/chatArrow.svg" class="chatArrow">'+ + '<div class="username '}${divClassName}">${escDisplayName+ }</div><div class="timestamp">${getCurrentTime(stamp)+ }</div><div class="usermessage">${message}</div>`+ + '</div>';$('#chatconversation').append(messageContainer);$('#chatconversation').animate(- { scrollTop: $('#chatconversation')[0].scrollHeight}, 1000);+ { scrollTop: $('#chatconversation')[0].scrollHeight }, 1000);},/**@@ -298,25 +324,28 @@ var Chat = {* @param errorMessage the received error message.* @param originalText the original message.*/- chatAddError (errorMessage, originalText) {+ chatAddError(errorMessage, originalText) {+ // eslint-disable-next-line no-param-reassignerrorMessage = UIUtil.escapeHtml(errorMessage);+ // eslint-disable-next-line no-param-reassignoriginalText = UIUtil.escapeHtml(originalText);$('#chatconversation').append(- '<div class="errorMessage"><b>Error: </b>' + 'Your message' +- (originalText? (` "${originalText}"`) : "") +- ' was not sent.' +- (errorMessage? (' Reason: ' + errorMessage) : '') + '</div>');+ `${'<div class="errorMessage"><b>Error: </b>Your message'}${+ originalText ? ` "${originalText}"` : ''+ } was not sent.${+ errorMessage ? ` Reason: ${errorMessage}` : ''}</div>`);$('#chatconversation').animate(- { scrollTop: $('#chatconversation')[0].scrollHeight}, 1000);+ { scrollTop: $('#chatconversation')[0].scrollHeight }, 1000);},/*** Sets the subject to the UI* @param subject the subject*/- setSubject (subject) {+ setSubject(subject) {if (subject) {+ // eslint-disable-next-line no-param-reassignsubject = subject.trim();}@@ -332,16 +361,17 @@ var Chat = {* @param {boolean} isConversationMode if chat should be in* conversation mode or not.*/- setChatConversationMode (isConversationMode) {- $('#' + CHAT_CONTAINER_ID)+ setChatConversationMode(isConversationMode) {+ $(`#${CHAT_CONTAINER_ID}`).toggleClass('is-conversation-mode', isConversationMode);},/*** Resizes the chat area.*/- resizeChat (width, height) {- $('#' + CHAT_CONTAINER_ID).width(width).height(height);+ resizeChat(width, height) {+ $(`#${CHAT_CONTAINER_ID}`).width(width)+.height(height);resizeChatConversation();},@@ -349,10 +379,11 @@ var Chat = {/*** Indicates if the chat is currently visible.*/- isVisible () {+ isVisible() {return UIUtil.isVisible(document.getElementById(CHAT_CONTAINER_ID));},+/*** Shows and hides the window with the smileys*/@@ -361,7 +392,7 @@ var Chat = {/*** Scrolls chat to the bottom.*/- scrollChatToBottom () {+ scrollChatToBottom() {setTimeout(() => {const chatconversation = $('#chatconversation');diff --git a/modules/UI/side_pannels/chat/Commands.js b/modules/UI/side_pannels/chat/Commands.jsindex 9970d60c52..7602abf2ef 100644--- a/modules/UI/side_pannels/chat/Commands.js+++ b/modules/UI/side_pannels/chat/Commands.js@@ -7,7 +7,7 @@ import UIEvents from '../../../../service/UI/UIEvents';* @type {{String: function}}*/const commands = {- "topic" : processTopic+ 'topic': processTopic};/**@@ -16,13 +16,15 @@ const commands = {* @returns {string} the command*/function getCommand(message) {- if(message) {- for(var command in commands) {- if(message.indexOf("/" + command) === 0)+ if (message) {+ for (const command in commands) {+ if (message.indexOf(`/${command}`) === 0) {return command;+ }}}- return "";++ return '';}/**@@ -30,7 +32,8 @@ function getCommand(message) {* @param commandArguments the arguments of the topic command.*/function processTopic(commandArguments, emitter) {- var topic = UIUtil.escapeHtml(commandArguments);+ const topic = UIUtil.escapeHtml(commandArguments);+emitter.emit(UIEvents.SUBJECT_CHANGED, topic);}@@ -41,7 +44,7 @@ function processTopic(commandArguments, emitter) {* @constructor*/function CommandsProcessor(message, emitter) {- var command = getCommand(message);+ const command = getCommand(message);this.emitter = emitter;@@ -54,7 +57,7 @@ function CommandsProcessor(message, emitter) {};- var messageArgument = message.substr(command.length + 2);+ const messageArgument = message.substr(command.length + 2);/*** Returns the arguments of the command.@@ -70,8 +73,10 @@ function CommandsProcessor(message, emitter) {* @returns {boolean}*/CommandsProcessor.prototype.isCommand = function() {- if (this.getCommand())+ if (this.getCommand()) {return true;+ }+return false;};@@ -79,8 +84,9 @@ CommandsProcessor.prototype.isCommand = function() {* Processes the command.*/CommandsProcessor.prototype.processCommand = function() {- if(!this.isCommand())+ if (!this.isCommand()) {return;+ }commands[this.getCommand()](this.getArgument(), this.emitter);};diff --git a/modules/UI/side_pannels/chat/Replacement.js b/modules/UI/side_pannels/chat/Replacement.jsindex 544b5191ae..fe1801ba8b 100644--- a/modules/UI/side_pannels/chat/Replacement.js+++ b/modules/UI/side_pannels/chat/Replacement.js@@ -1,17 +1,11 @@-/* jshint -W101 */import { regexes } from './smileys';/*** Processes links and smileys in "body"*/export function processReplacements(body) {- //make links clickable- body = linkify(body);-- //add smileys- body = smilify(body);-- return body;+ // make links clickable + add smileys+ return smilify(linkify(body));}/**@@ -19,20 +13,23 @@ export function processReplacements(body) {* with their <a href=""></a>*/export function linkify(inputText) {- var replacedText, replacePattern1, replacePattern2, replacePattern3;+ let replacedText;++ /* eslint-disable no-useless-escape, max-len */- /* eslint-disable no-useless-escape */+ // URLs starting with http://, https://, or ftp://+ const replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;- //URLs starting with http://, https://, or ftp://- replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank" rel="noopener noreferrer">$1</a>');- //URLs starting with "www." (without // before it, or it'd re-link the ones done above).- replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;+ // URLs starting with "www." (without // before it, or it'd re-link the ones done above).+ const replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;+replacedText = replacedText.replace(replacePattern2, '$1<a href="https://$2" target="_blank" rel="noopener noreferrer">$2</a>');- //Change email addresses to mailto: links.- replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim;+ // Change email addresses to mailto: links.+ const replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim;+replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');/* eslint-enable no-useless-escape */@@ -44,14 +41,16 @@ export function linkify(inputText) {* Replaces common smiley strings with images*/function smilify(body) {- if(!body) {+ if (!body) {return body;}- for(var smiley in regexes) {- if(regexes.hasOwnProperty(smiley)) {- body = body.replace(regexes[smiley],- '<img class="smiley" src="images/smileys/' + smiley + '.svg">');+ let formattedBody = body;++ for (const smiley in regexes) {+ if (regexes.hasOwnProperty(smiley)) {+ formattedBody = formattedBody.replace(regexes[smiley],+ `<img class="smiley" src="images/smileys/${smiley}.svg">`);}}diff --git a/modules/UI/side_pannels/chat/smileys.js b/modules/UI/side_pannels/chat/smileys.jsindex 0a52e43ac2..7b1220c9d1 100644--- a/modules/UI/side_pannels/chat/smileys.js+++ b/modules/UI/side_pannels/chat/smileys.js@@ -1,25 +1,25 @@export const smileys = {- smiley1: ":)",- smiley2: ":(",- smiley3: ":D",- smiley4: "(y)",- smiley5: " :P",- smiley6: "(wave)",- smiley7: "(blush)",- smiley8: "(chuckle)",- smiley9: "(shocked)",- smiley10: ":*",- smiley11: "(n)",- smiley12: "(search)",- smiley13: " <3",- smiley14: "(oops)",- smiley15: "(angry)",- smiley16: "(angel)",- smiley17: "(sick)",- smiley18: ";(",- smiley19: "(bomb)",- smiley20: "(clap)",- smiley21: " ;)"+ smiley1: ':)',+ smiley2: ':(',+ smiley3: ':D',+ smiley4: '(y)',+ smiley5: ' :P',+ smiley6: '(wave)',+ smiley7: '(blush)',+ smiley8: '(chuckle)',+ smiley9: '(shocked)',+ smiley10: ':*',+ smiley11: '(n)',+ smiley12: '(search)',+ smiley13: ' <3',+ smiley14: '(oops)',+ smiley15: '(angry)',+ smiley16: '(angel)',+ smiley17: '(sick)',+ smiley18: ';(',+ smiley19: '(bomb)',+ smiley20: '(clap)',+ smiley21: ' ;)'};export const regexes = {diff --git a/modules/UI/side_pannels/contactlist/ContactListView.js b/modules/UI/side_pannels/contactlist/ContactListView.jsindex 1fb2699fa4..dc3099e170 100644--- a/modules/UI/side_pannels/contactlist/ContactListView.js+++ b/modules/UI/side_pannels/contactlist/ContactListView.js@@ -19,7 +19,7 @@ import UIUtil from '../../util/UIUtil';* the term "contact" is not used elsewhere. Normally people in the conference* are internally refered to as "participants" or externally as "members".*/-var ContactListView = {+const ContactListView = {/*** Creates and appends the contact list to the side panel.*@@ -33,7 +33,6 @@ var ContactListView = {$('#sideToolbarContainer').append(contactListPanelContainer);- /* jshint ignore:start */ReactDOM.render(<Provider store = { APP.store }><I18nextProvider i18n = { i18next }>@@ -42,7 +41,6 @@ var ContactListView = {</Provider>,contactListPanelContainer);- /* jshint ignore:end */},/**@@ -50,8 +48,8 @@ var ContactListView = {** @return {boolean) true if the contact list is currently visible.*/- isVisible () {- return UIUtil.isVisible(document.getElementById("contactlist"));+ isVisible() {+ return UIUtil.isVisible(document.getElementById('contactlist'));}};diff --git a/modules/UI/side_pannels/profile/Profile.js b/modules/UI/side_pannels/profile/Profile.jsindex 16048d4a8b..9c12543fe0 100644--- a/modules/UI/side_pannels/profile/Profile.js+++ b/modules/UI/side_pannels/profile/Profile.js@@ -1,98 +1,117 @@/* global $, APP */-import UIUtil from "../../util/UIUtil";-import UIEvents from "../../../../service/UI/UIEvents";+import UIUtil from '../../util/UIUtil';+import UIEvents from '../../../../service/UI/UIEvents';import Settings from '../../../settings/Settings';import { sendEvent } from '../../../../react/features/analytics';const sidePanelsContainerId = 'sideToolbarContainer';const htmlStr = `- <div id="profile_container" class="sideToolbarContainer__inner">- <div class="title" data-i18n="profile.title"></div>- <div class="sideToolbarBlock first">- <label class="first" data-i18n="profile.setDisplayNameLabel">+ <div id='profile_container' class='sideToolbarContainer__inner'>+ <div class='title' data-i18n='profile.title'></div>+ <div class='sideToolbarBlock first'>+ <label class='first' data-i18n='profile.setDisplayNameLabel'></label>- <input class="input-control" type="text" id="setDisplayName"- data-i18n="[placeholder]settings.name">+ <input class='input-control' type='text' id='setDisplayName'+ data-i18n='[placeholder]settings.name'></div>- <div class="sideToolbarBlock">- <label data-i18n="profile.setEmailLabel"></label>- <input id="setEmail" type="text" class="input-control"- data-i18n="[placeholder]profile.setEmailInput">+ <div class='sideToolbarBlock'>+ <label data-i18n='profile.setEmailLabel'></label>+ <input id='setEmail' type='text' class='input-control'+ data-i18n='[placeholder]profile.setEmailInput'></div>- <div id="profile_auth_container"- class="sideToolbarBlock auth_container">- <p data-i18n="toolbar.authenticate"></p>+ <div id='profile_auth_container'+ class='sideToolbarBlock auth_container'>+ <p data-i18n='toolbar.authenticate'></p><ul>- <li id="profile_auth_identity"></li>- <li id="profile_button_login">- <a class="authButton" data-i18n="toolbar.login"></a>+ <li id='profile_auth_identity'></li>+ <li id='profile_button_login'>+ <a class='authButton' data-i18n='toolbar.login'></a></li>- <li id="profile_button_logout">- <a class="authButton" data-i18n="toolbar.logout"></a>+ <li id='profile_button_logout'>+ <a class='authButton' data-i18n='toolbar.logout'></a></li></ul></div></div>`;+/**+ *+ */function initHTML() {$(`#${sidePanelsContainerId}`).append(htmlStr);+// make sure we translate the panel, as adding it can be after i18n// library had initialized and translated already present htmlAPP.translation.translateElement($(`#${sidePanelsContainerId}`));}export default {- init (emitter) {+ init(emitter) {initHTML();- // DISPLAY NAME- function updateDisplayName () {++ /**+ * Updates display name.+ *+ * @returns {void}+ */+ function updateDisplayName() {emitter.emit(UIEvents.NICKNAME_CHANGED, $('#setDisplayName').val());}$('#setDisplayName').val(Settings.getDisplayName())- .keyup(function (event) {+ .keyup(event => {if (event.keyCode === 13) { // enterupdateDisplayName();}}).focusout(updateDisplayName);-- function updateEmail () {+ /**+ * Updates the email.+ *+ * @returns {void}+ */+ function updateEmail() {emitter.emit(UIEvents.EMAIL_CHANGED, $('#setEmail').val());}$('#setEmail').val(Settings.getEmail())- .keyup(function (event) {+ .keyup(event => {if (event.keyCode === 13) { // enterupdateEmail();}- }).focusout(updateEmail);+ })+ .focusout(updateEmail);- // LOGIN- function loginClicked () {+ /**+ *+ */+ function loginClicked() {sendEvent('authenticate.login.clicked');emitter.emit(UIEvents.AUTH_CLICKED);}$('#profile_button_login').click(loginClicked);- // LOGOUT- function logoutClicked () {- let titleKey = "dialog.logoutTitle";- let msgKey = "dialog.logoutQuestion";+ /**+ *+ */+ function logoutClicked() {+ const titleKey = 'dialog.logoutTitle';+ const msgKey = 'dialog.logoutQuestion';+sendEvent('authenticate.logout.clicked');+// Ask for confirmationAPP.UI.messageHandler.openTwoButtonDialog({- titleKey: titleKey,- msgKey: msgKey,- leftButtonKey: "dialog.Yes",- submitFunction: function (evt, yes) {+ titleKey,+ msgKey,+ leftButtonKey: 'dialog.Yes',+ submitFunction(evt, yes) {if (yes) {emitter.emit(UIEvents.LOGOUT);}@@ -107,15 +126,15 @@ export default {* Check if settings menu is visible or not.* @returns {boolean}*/- isVisible () {- return UIUtil.isVisible(document.getElementById("profile_container"));+ isVisible() {+ return UIUtil.isVisible(document.getElementById('profile_container'));},/*** Change user display name in the settings menu.* @param {string} newDisplayName*/- changeDisplayName (newDisplayName) {+ changeDisplayName(newDisplayName) {$('#setDisplayName').val(newDisplayName);},@@ -123,7 +142,7 @@ export default {* Change user avatar in the settings menu.* @param {string} avatarUrl url of the new avatar*/- changeAvatar (avatarUrl) {+ changeAvatar(avatarUrl) {$('#avatar').attr('src', avatarUrl);},@@ -131,7 +150,7 @@ export default {* Change the value of the field for the user email.* @param {string} email the new value that will be displayed in the field.*/- changeEmail (email) {+ changeEmail(email) {$('#setEmail').val(email);},@@ -139,8 +158,9 @@ export default {* Shows or hides authentication related buttons* @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide*/- showAuthenticationButtons (show) {- let id = 'profile_auth_container';+ showAuthenticationButtons(show) {+ const id = 'profile_auth_container';+UIUtil.setVisible(id, show);},@@ -148,8 +168,8 @@ export default {* Shows/hides login button.* @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide*/- showLoginButton (show) {- let id = 'profile_button_login';+ showLoginButton(show) {+ const id = 'profile_button_login';UIUtil.setVisible(id, show);},@@ -158,8 +178,8 @@ export default {* Shows/hides logout button.* @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide*/- showLogoutButton (show) {- let id = 'profile_button_logout';+ showLogoutButton(show) {+ const id = 'profile_button_logout';UIUtil.setVisible(id, show);},@@ -168,10 +188,10 @@ export default {* Displays user's authenticated identity name (login).* @param {string} authIdentity identity name to be displayed.*/- setAuthenticatedIdentity (authIdentity) {- let id = 'profile_auth_identity';+ setAuthenticatedIdentity(authIdentity) {+ const id = 'profile_auth_identity';- UIUtil.setVisible(id, !!authIdentity);+ UIUtil.setVisible(id, Boolean(authIdentity));$(`#${id}`).text(authIdentity ? authIdentity : '');}diff --git a/modules/UI/side_pannels/settings/SettingsMenu.js b/modules/UI/side_pannels/settings/SettingsMenu.jsindex 201ed00c82..76a35a1d0d 100644--- a/modules/UI/side_pannels/settings/SettingsMenu.js+++ b/modules/UI/side_pannels/settings/SettingsMenu.js@@ -1,10 +1,10 @@/* global $, APP, AJS, interfaceConfig */-import { LANGUAGES } from "../../../../react/features/base/i18n";+import { LANGUAGES } from '../../../../react/features/base/i18n';import { openDeviceSelectionDialog }from '../../../../react/features/device-selection';-import UIUtil from "../../util/UIUtil";-import UIEvents from "../../../../service/UI/UIEvents";+import UIUtil from '../../util/UIUtil';+import UIEvents from '../../../../service/UI/UIEvents';const sidePanelsContainerId = 'sideToolbarContainer';const deviceSelectionButtonClasses@@ -13,12 +13,12 @@ const htmlStr = `<div id="settings_container" class="sideToolbarContainer__inner"><div class="title" data-i18n="settings.title"></div><form class="aui">- <div id="languagesSelectWrapper"+ <div id="languagesSelectWrapper"class="sideToolbarBlock first hide"><select id="languagesSelect"></select></div><div id="deviceOptionsWrapper" class="hide">- <div id="deviceOptionsTitle" class="subTitle hide"+ <div id="deviceOptionsTitle" class="subTitle hide"data-i18n="settings.audioVideo"></div><div class="sideToolbarBlock first"><button@@ -29,24 +29,24 @@ const htmlStr = `</div></div><div id="moderatorOptionsWrapper" class="hide">- <div id="moderatorOptionsTitle" class="subTitle hide"+ <div id="moderatorOptionsTitle" class="subTitle hide"data-i18n="settings.moderator"></div><div id="startMutedOptions" class="hide"><div class="sideToolbarBlock first"><input type="checkbox" id="startAudioMuted">- <label class="startMutedLabel" for="startAudioMuted"+ <label class="startMutedLabel" for="startAudioMuted"data-i18n="settings.startAudioMuted"></label></div><div class="sideToolbarBlock"><input type="checkbox" id="startVideoMuted">- <label class="startMutedLabel" for="startVideoMuted"+ <label class="startMutedLabel" for="startVideoMuted"data-i18n="settings.startVideoMuted"></label></div></div><div id="followMeOptions" class="hide"><div class="sideToolbarBlock"><input type="checkbox" id="followMeCheckBox">- <label class="followMeLabel" for="followMeCheckBox"+ <label class="followMeLabel" for="followMeCheckBox"data-i18n="settings.followMe"></label></div></div>@@ -54,9 +54,13 @@ const htmlStr = `</form></div>`;+/**+ *+ */function initHTML() {$(`#${sidePanelsContainerId}`).append(htmlStr);+// make sure we translate the panel, as adding it can be after i18n// library had initialized and translated already present htmlAPP.translation.translateElement($(`#${sidePanelsContainerId}`));@@ -70,8 +74,8 @@ function initHTML() {* @returns {string}*/function generateLanguagesOptions(items, currentLang) {- return items.map(function (lang) {- let attrs = {+ return items.map(lang => {+ const attrs = {value: lang,'data-i18n': `languages:${lang}`};@@ -80,7 +84,9 @@ function generateLanguagesOptions(items, currentLang) {attrs.selected = 'selected';}- let attrsStr = UIUtil.attrsToString(attrs);+ const attrsStr = UIUtil.attrsToString(attrs);++return `<option ${attrsStr}></option>`;}).join('');}@@ -101,14 +107,15 @@ function initSelect2($el, onSelectedCb) {}export default {- init (emitter) {+ init(emitter) {initHTML();- //LANGUAGES BOX++ // LANGUAGES BOXif (UIUtil.isSettingEnabled('language')) {const wrapperId = 'languagesSelectWrapper';const selectId = 'languagesSelect';const selectEl = AJS.$(`#${selectId}`);- let selectInput;+ let selectInput; // eslint-disable-line prefer-constselectEl.html(generateLanguagesOptions(LANGUAGES,@@ -121,11 +128,13 @@ export default {APP.translation.translateElement(selectInput);emitter.emit(UIEvents.LANG_CHANGED, val);});- //find new selectInput element++ // find new selectInput elementselectInput = $(`#s2id_${selectId} .select2-chosen`);- //first select fix for languages options- selectInput[0].dataset.i18n =- `languages:${APP.translation.getCurrentLanguage()}`;++ // first select fix for languages options+ selectInput[0].dataset.i18n+ = `languages:${APP.translation.getCurrentLanguage()}`;// translate selectInput, which is the currently selected language// otherwise there will be no selected option@@ -133,10 +142,13 @@ export default {APP.translation.translateElement(selectEl);APP.translation.addLanguageChangedListener(- lng => selectInput[0].dataset.i18n = `languages:${lng}`);+ lng => {+ selectInput[0].dataset.i18n = `languages:${lng}`;+ });UIUtil.setVisible(wrapperId, true);}+// DEVICES LISTif (UIUtil.isSettingEnabled('devices')) {const wrapperId = 'deviceOptionsWrapper';@@ -145,19 +157,21 @@ export default {APP.store.dispatch(openDeviceSelectionDialog()));// Only show the subtitle if this isn't the only setting section.- if (interfaceConfig.SETTINGS_SECTIONS.length > 1)- UIUtil.setVisible("deviceOptionsTitle", true);+ if (interfaceConfig.SETTINGS_SECTIONS.length > 1) {+ UIUtil.setVisible('deviceOptionsTitle', true);+ }UIUtil.setVisible(wrapperId, true);}+// MODERATORif (UIUtil.isSettingEnabled('moderator')) {const wrapperId = 'moderatorOptionsWrapper';// START MUTED- $("#startMutedOptions").change(function () {- let startAudioMuted = $("#startAudioMuted").is(":checked");- let startVideoMuted = $("#startVideoMuted").is(":checked");+ $('#startMutedOptions').change(() => {+ const startAudioMuted = $('#startAudioMuted').is(':checked');+ const startVideoMuted = $('#startVideoMuted').is(':checked');emitter.emit(UIEvents.START_MUTED_CHANGED,@@ -168,8 +182,10 @@ export default {// FOLLOW MEconst followMeToggle = document.getElementById('followMeCheckBox');+followMeToggle.addEventListener('change', () => {const isFollowMeEnabled = followMeToggle.checked;+emitter.emit(UIEvents.FOLLOW_ME_ENABLED, isFollowMeEnabled);});@@ -181,26 +197,28 @@ export default {* If start audio muted/start video muted options should be visible or not.* @param {boolean} show*/- showStartMutedOptions (show) {+ showStartMutedOptions(show) {if (show && UIUtil.isSettingEnabled('moderator')) {// Only show the subtitle if this isn't the only setting section.- if (!$("#moderatorOptionsTitle").is(":visible")- && interfaceConfig.SETTINGS_SECTIONS.length > 1)- UIUtil.setVisible("moderatorOptionsTitle", true);+ if (!$('#moderatorOptionsTitle').is(':visible')+ && interfaceConfig.SETTINGS_SECTIONS.length > 1) {+ UIUtil.setVisible('moderatorOptionsTitle', true);+ }- UIUtil.setVisible("startMutedOptions", true);+ UIUtil.setVisible('startMutedOptions', true);} else {// Only show the subtitle if this isn't the only setting section.- if ($("#moderatorOptionsTitle").is(":visible"))- UIUtil.setVisible("moderatorOptionsTitle", false);+ if ($('#moderatorOptionsTitle').is(':visible')) {+ UIUtil.setVisible('moderatorOptionsTitle', false);+ }- UIUtil.setVisible("startMutedOptions", false);+ UIUtil.setVisible('startMutedOptions', false);}},- updateStartMutedBox (startAudioMuted, startVideoMuted) {- $("#startAudioMuted").attr("checked", startAudioMuted);- $("#startVideoMuted").attr("checked", startVideoMuted);+ updateStartMutedBox(startAudioMuted, startVideoMuted) {+ $('#startAudioMuted').attr('checked', startAudioMuted);+ $('#startVideoMuted').attr('checked', startVideoMuted);},/**@@ -208,9 +226,9 @@ export default {** @param {boolean} show {true} to show those options, {false} to hide them*/- showFollowMeOptions (show) {+ showFollowMeOptions(show) {UIUtil.setVisible(- "followMeOptions",+ 'followMeOptions',show && UIUtil.isSettingEnabled('moderator'));},@@ -218,7 +236,7 @@ export default {* Check if settings menu is visible or not.* @returns {boolean}*/- isVisible () {- return UIUtil.isVisible(document.getElementById("settings_container"));+ isVisible() {+ return UIUtil.isVisible(document.getElementById('settings_container'));}};diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.jsindex ae33c38344..dbeedf6806 100644--- a/modules/UI/util/MessageHandler.js+++ b/modules/UI/util/MessageHandler.js@@ -1,5 +1,5 @@/* global $, APP */-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);import jitsiLocalStorage from '../../util/JitsiLocalStorage';@@ -31,12 +31,14 @@ let twoButtonDialog = null;* @returns {string}*/function generateDontShowCheckbox(options) {- if(!isDontShowAgainEnabled(options)) {- return "";+ if (!isDontShowAgainEnabled(options)) {+ return '';}- let checked- = (options.checked === true) ? "checked" : "";+ const checked+ = options.checked === true ? 'checked' : '';++return `<br /><label><input type='checkbox' ${checked} id='${options.id}' />@@ -54,12 +56,13 @@ function generateDontShowCheckbox(options) {* false otherwise.*/function dontShowTheDialog(options) {- if(isDontShowAgainEnabled(options)) {- if(jitsiLocalStorage.getItem(options.localStorageKey || options.id)- === "true") {+ if (isDontShowAgainEnabled(options)) {+ if (jitsiLocalStorage.getItem(options.localStorageKey || options.id)+ === 'true') {return true;}}+return false;}@@ -76,24 +79,27 @@ function dontShowTheDialog(options) {* @returns {Function} wrapped function*/function dontShowAgainSubmitFunctionWrapper(options, submitFunction) {- if(isDontShowAgainEnabled(options)) {+ if (isDontShowAgainEnabled(options)) {return (...args) => {logger.debug(args, options.buttonValues);- //args[1] is the value associated with the pressed button- if(!options.buttonValues || options.buttonValues.length === 0- || options.buttonValues.indexOf(args[1]) !== -1 ) {- let checkbox = $(`#${options.id}`);++ // args[1] is the value associated with the pressed button+ if (!options.buttonValues || options.buttonValues.length === 0+ || options.buttonValues.indexOf(args[1]) !== -1) {+ const checkbox = $(`#${options.id}`);+if (checkbox.length) {jitsiLocalStorage.setItem(options.localStorageKey || options.id,- checkbox.prop("checked"));+ checkbox.prop('checked'));}}submitFunction(...args);};- } else {- return submitFunction;}++ return submitFunction;+}/**@@ -102,12 +108,12 @@ function dontShowAgainSubmitFunctionWrapper(options, submitFunction) {* @returns {boolean} true if enabled and false if not.*/function isDontShowAgainEnabled(options) {- return typeof options === "object";+ return typeof options === 'object';}-var messageHandler = {- OK: "dialog.OK",- CANCEL: "dialog.Cancel",+const messageHandler = {+ OK: 'dialog.OK',+ CANCEL: 'dialog.Cancel',/*** Shows a message to the user.@@ -120,25 +126,32 @@ var messageHandler = {* the prompt is closed (optional)* @return the prompt that was created, or null*/+ // eslint-disable-next-line max-paramsopenMessageDialog(titleKey, messageKey, i18nOptions, closeFunction) {- if (!popupEnabled)+ if (!popupEnabled) {return null;+ }- let dialog = $.prompt(+ const dialog = $.prompt(APP.translation.generateTranslationHTML(messageKey, i18nOptions),{title: this._getFormattedTitleString(titleKey),persistent: false,promptspeed: 0,classes: this._getDialogClasses(),+ // eslint-disable-next-line max-paramsclose(e, v, m, f) {- if(closeFunction)+ if (closeFunction) {closeFunction(e, v, m, f);+ }}});+APP.translation.translateElement(dialog, i18nOptions);+return $.prompt.getApi();},+/*** Shows a message to the user with two buttons: first is given as a* parameter and the second is Cancel.@@ -169,8 +182,8 @@ var messageHandler = {* storage. if not provided dontShowAgain.id will be used.* @return the prompt that was created, or null*/- openTwoButtonDialog: function(options) {- let {+ openTwoButtonDialog(options) {+ const {titleKey,msgKey,msgString,@@ -182,32 +195,40 @@ var messageHandler = {size,defaultButton,wrapperClass,- classes,dontShowAgain} = options;- if (!popupEnabled || twoButtonDialog)+ let { classes } = options;++ if (!popupEnabled || twoButtonDialog) {return null;+ }- if(dontShowTheDialog(dontShowAgain)) {+ if (dontShowTheDialog(dontShowAgain)) {// Maybe we should pass some parameters here? I'm not sure// and currently we don't need any parameters.submitFunction();+return null;}- var buttons = [];+ const buttons = [];++ const leftButton = leftButtonKey+ ? APP.translation.generateTranslationHTML(leftButtonKey)+ : APP.translation.generateTranslationHTML('dialog.Submit');- var leftButton = leftButtonKey ?- APP.translation.generateTranslationHTML(leftButtonKey) :- APP.translation.generateTranslationHTML('dialog.Submit');- buttons.push({ title: leftButton, value: true});+ buttons.push({ title: leftButton,+ value: true });- var cancelButton- = APP.translation.generateTranslationHTML("dialog.Cancel");- buttons.push({title: cancelButton, value: false});+ const cancelButton+ = APP.translation.generateTranslationHTML('dialog.Cancel');++ buttons.push({ title: cancelButton,+ value: false });++ let message = msgString;- var message = msgString;if (msgKey) {message = APP.translation.generateTranslationHTML(msgKey);}@@ -220,20 +241,20 @@ var messageHandler = {twoButtonDialog = $.prompt(message, {title: this._getFormattedTitleString(titleKey),persistent: false,- buttons: buttons,- defaultButton: defaultButton,- focus: focus,+ buttons,+ defaultButton,+ focus,loaded: loadedFunction,promptspeed: 0,classes,submit: dontShowAgainSubmitFunctionWrapper(dontShowAgain,- function (e, v, m, f) {+ (e, v, m, f) => { // eslint-disable-line max-paramstwoButtonDialog = null;if (v && submitFunction) {submitFunction(e, v, m, f);}}),- close: function (e, v, m, f) {+ close(e, v, m, f) { // eslint-disable-line max-paramstwoButtonDialog = null;if (closeFunction) {closeFunction(e, v, m, f);@@ -241,6 +262,7 @@ var messageHandler = {}});APP.translation.translateElement(twoButtonDialog);+return $.prompt.getApi();},@@ -270,7 +292,7 @@ var messageHandler = {* @param {string} dontShowAgain.localStorageKey the key for the local* storage. if not provided dontShowAgain.id will be used.*/- openDialog(+ openDialog(// eslint-disable-line max-paramstitleKey,msgString,persistent,@@ -279,29 +301,33 @@ var messageHandler = {loadedFunction,closeFunction,dontShowAgain) {- if (!popupEnabled)+ if (!popupEnabled) {return;+ }- if(dontShowTheDialog(dontShowAgain)) {+ if (dontShowTheDialog(dontShowAgain)) {// Maybe we should pass some parameters here? I'm not sure// and currently we don't need any parameters.submitFunction();+return;}- let args = {+ const args = {title: this._getFormattedTitleString(titleKey),- persistent: persistent,- buttons: buttons,+ persistent,+ buttons,defaultButton: 1,promptspeed: 0,- loaded: function() {+ loaded() {if (loadedFunction) {+ // eslint-disable-next-line prefer-rest-paramsloadedFunction.apply(this, arguments);}+// Hide the close buttonif (persistent) {- $(".jqiclose", this).hide();+ $('.jqiclose', this).hide();}},submit: dontShowAgainSubmitFunctionWrapper(@@ -314,9 +340,11 @@ var messageHandler = {args.closeText = '';}- let dialog = $.prompt(+ const dialog = $.prompt(msgString + generateDontShowCheckbox(dontShowAgain), args);+APP.translation.translateElement(dialog);+return $.prompt.getApi();},@@ -326,10 +354,13 @@ var messageHandler = {* @return the title string formatted as a div.*/_getFormattedTitleString(titleKey) {- let $titleString = $('<h2>');+ const $titleString = $('<h2>');+$titleString.addClass('aui-dialog2-header-main');- $titleString.attr('data-i18n',titleKey);- return $('<div>').append($titleString).html();+ $titleString.attr('data-i18n', titleKey);++ return $('<div>').append($titleString)+.html();},/**@@ -359,23 +390,28 @@ var messageHandler = {* @param options impromptu options* @param translateOptions options passed to translation*/- openDialogWithStates: function (statesObject, options, translateOptions) {- if (!popupEnabled)+ openDialogWithStates(statesObject, options, translateOptions) {+ if (!popupEnabled) {return;- let { classes, size } = options;- let defaultClasses = this._getDialogClasses(size);+ }+ const { classes, size } = options;+ const defaultClasses = this._getDialogClasses(size);+options.classes = Object.assign({}, defaultClasses, classes);options.promptspeed = options.promptspeed || 0;- for (let state in statesObject) {- let currentState = statesObject[state];- if(currentState.titleKey) {+ for (const state in statesObject) { // eslint-disable-line guard-for-in+ const currentState = statesObject[state];++ if (currentState.titleKey) {currentState.title= this._getFormattedTitleString(currentState.titleKey);}}- let dialog = $.prompt(statesObject, options);+ const dialog = $.prompt(statesObject, options);+APP.translation.translateElement(dialog, translateOptions);+return $.prompt.getApi();},@@ -392,17 +428,20 @@ var messageHandler = {* @returns {object} popup window object if opened successfully or undefined* in case we failed to open it(popup blocked)*/- openCenteredPopup: function (url, w, h, onPopupClosed) {- if (!popupEnabled)+ // eslint-disable-next-line max-params+ openCenteredPopup(url, w, h, onPopupClosed) {+ if (!popupEnabled) {return;+ }- var l = window.screenX + (window.innerWidth / 2) - (w / 2);- var t = window.screenY + (window.innerHeight / 2) - (h / 2);- var popup = window.open(+ const l = window.screenX + (window.innerWidth / 2) - (w / 2);+ const t = window.screenY + (window.innerHeight / 2) - (h / 2);+ const popup = window.open(url, '_blank',- 'top=' + t + ', left=' + l + ', width=' + w + ', height=' + h + '');+ String(`top=${t}, left=${l}, width=${w}, height=${h}`));+if (popup && onPopupClosed) {- var pollTimer = window.setInterval(function () {+ const pollTimer = window.setInterval(() => {if (popup.closed !== false) {window.clearInterval(pollTimer);onPopupClosed();@@ -420,10 +459,11 @@ var messageHandler = {* @param msgKey the text of the message* @param error the error that is being reported*/- openReportDialog: function(titleKey, msgKey, error) {+ openReportDialog(titleKey, msgKey, error) {this.openMessageDialog(titleKey, msgKey);logger.log(error);- //FIXME send the error to the server++ // FIXME send the error to the server},/**@@ -431,14 +471,7 @@ var messageHandler = {* @param titleKey the title of the message.* @param msgKey the text of the message.*/- showError: function(titleKey, msgKey) {-- if (!titleKey) {- titleKey = "dialog.oops";- }- if (!msgKey) {- msgKey = "dialog.defaultError";- }+ showError(titleKey = 'dialog.oops', msgKey = 'dialog.defaultError') {messageHandler.openMessageDialog(titleKey, msgKey);},@@ -454,7 +487,7 @@ var messageHandler = {* @param messageArguments object with the arguments for the message.* @param optional configurations for the notification (e.g. timeout)*/- participantNotification(+ participantNotification( // eslint-disable-line max-paramsdisplayName,displayNameKey,cls,@@ -484,12 +517,12 @@ var messageHandler = {* translation.* @returns {void}*/- notify: function(titleKey, messageKey, messageArguments) {+ notify(titleKey, messageKey, messageArguments) {this.participantNotification(null, titleKey, null, messageKey, messageArguments);},- enablePopups: function (enable) {+ enablePopups(enable) {popupEnabled = enable;},@@ -498,8 +531,8 @@ var messageHandler = {* false otherwise* @returns {boolean} isOpened*/- isDialogOpened: function () {- return !!$.prompt.getCurrentStateName();+ isDialogOpened() {+ return Boolean($.prompt.getCurrentStateName());}};diff --git a/modules/UI/util/UIUtil.js b/modules/UI/util/UIUtil.jsindex c347af1f4e..6b93cfbae0 100644--- a/modules/UI/util/UIUtil.js+++ b/modules/UI/util/UIUtil.js@@ -31,7 +31,7 @@ const IndicatorFontSizes = {/*** Created by hristo on 12/22/14.*/-var UIUtil = {+const UIUtil = {/*** Returns the available video width.@@ -43,17 +43,18 @@ var UIUtil = {/*** Changes the style class of the element given by id.*/- buttonClick: function(id, classname) {+ buttonClick(id, classname) {// add the class to the clicked element- $("#" + id).toggleClass(classname);+ $(`#${id}`).toggleClass(classname);},+/*** Returns the text width for the given element.** @param el the element*/getTextWidth(el) {- return (el.clientWidth + 1);+ return el.clientWidth + 1;},/**@@ -62,7 +63,7 @@ var UIUtil = {* @param el the element*/getTextHeight(el) {- return (el.clientHeight + 1);+ return el.clientHeight + 1;},/**@@ -78,7 +79,8 @@ var UIUtil = {* Escapes the given text.*/escapeHtml(unsafeText) {- return $('<div/>').text(unsafeText).html();+ return $('<div/>').text(unsafeText)+ .html();},/**@@ -88,22 +90,27 @@ var UIUtil = {* @returns {string} unescaped html string.*/unescapeHtml(safe) {- return $('<div />').html(safe).text();+ return $('<div />').html(safe)+ .text();},imageToGrayScale(canvas) {- var context = canvas.getContext('2d');- var imgData = context.getImageData(0, 0, canvas.width, canvas.height);- var pixels = imgData.data;-- for (var i = 0, n = pixels.length; i < n; i += 4) {- var grayscale- = pixels[i] * 0.3 + pixels[i+1] * 0.59 + pixels[i+2] * 0.11;- pixels[i ] = grayscale; // red- pixels[i+1] = grayscale; // green- pixels[i+2] = grayscale; // blue+ const context = canvas.getContext('2d');+ const imgData = context.getImageData(0, 0, canvas.width, canvas.height);+ const pixels = imgData.data;++ for (let i = 0, n = pixels.length; i < n; i += 4) {+ const grayscale+ = (pixels[i] * 0.3)+ + (pixels[i + 1] * 0.59)+ + (pixels[i + 2] * 0.11);++ pixels[i] = grayscale; // red+ pixels[i + 1] = grayscale; // green+ pixels[i + 2] = grayscale; // blue// pixels[i+3] is alpha}+// redraw the image in black & whitecontext.putImageData(imgData, 0, 0);},@@ -114,7 +121,8 @@ var UIUtil = {* @param newChild the new element that will be inserted into the container*/prependChild(container, newChild) {- var firstChild = container.childNodes[0];+ const firstChild = container.childNodes[0];+if (firstChild) {container.insertBefore(newChild, firstChild);} else {@@ -152,6 +160,7 @@ var UIUtil = {*/setVisible(id, visible) {let element;+if (id instanceof HTMLElement) {element = id;} else {@@ -162,20 +171,20 @@ var UIUtil = {return;}- if (!visible)+ if (!visible) {element.classList.add('hide');- else if (element.classList.contains('hide')) {+ } else if (element.classList.contains('hide')) {element.classList.remove('hide');}- let type = this._getElementDefaultDisplay(element.tagName);- let className = SHOW_CLASSES[type];+ const type = this._getElementDefaultDisplay(element.tagName);+ const className = SHOW_CLASSES[type];if (visible) {element.classList.add(className);- }- else if (element.classList.contains(className))+ } else if (element.classList.contains(className)) {element.classList.remove(className);+ }},/**@@ -185,10 +194,11 @@ var UIUtil = {* @private*/_getElementDefaultDisplay(tag) {- let tempElement = document.createElement(tag);+ const tempElement = document.createElement(tag);document.body.appendChild(tempElement);- let style = window.getComputedStyle(tempElement).display;+ const style = window.getComputedStyle(tempElement).display;+document.body.removeChild(tempElement);return style;@@ -203,7 +213,7 @@ var UIUtil = {*/setVisibleBySelector(jquerySelector, isVisible) {if (jquerySelector && jquerySelector.length > 0) {- jquerySelector.css("visibility", isVisible ? "visible" : "hidden");+ jquerySelector.css('visibility', isVisible ? 'visible' : 'hidden');}},@@ -264,7 +274,8 @@ var UIUtil = {*/attrsToString(attrs) {return (- Object.keys(attrs).map(key => ` ${key}="${attrs[key]}"`).join(' '));+ Object.keys(attrs).map(key => ` ${key}="${attrs[key]}"`)+.join(' '));},/**@@ -275,7 +286,7 @@ var UIUtil = {* @param {el} The DOM element we'd like to check for visibility*/isVisible(el) {- return (el.offsetParent !== null);+ return el.offsetParent !== null;},/**@@ -288,26 +299,33 @@ var UIUtil = {* element*/animateShowElement(selector, show, hideDelay) {- if(show) {- if (!selector.is(":visible"))- selector.css("display", "inline-block");+ if (show) {+ if (!selector.is(':visible')) {+ selector.css('display', 'inline-block');+ }selector.fadeIn(300,- () => {selector.css({opacity: 1});}+ () => {+ selector.css({ opacity: 1 });+ });- if (hideDelay && hideDelay > 0)+ if (hideDelay && hideDelay > 0) {setTimeout(() => {selector.fadeOut(300,- () => { selector.css({opacity: 0}); });+ () => {+ selector.css({ opacity: 0 });+ });},hideDelay);- }- else {+ }+ } else {selector.fadeOut(300,- () => {selector.css({opacity: 0});}+ () => {+ selector.css({ opacity: 0 });+ });}},@@ -318,7 +336,7 @@ var UIUtil = {* @param cssValue the string value we obtain when querying css properties*/parseCssInt(cssValue) {- return parseInt(cssValue) || 0;+ return parseInt(cssValue, 10) || 0;},/**@@ -332,8 +350,8 @@ var UIUtil = {aLinkElement.attr('href', link);} else {aLinkElement.css({- "pointer-events": "none",- "cursor": "default"+ 'pointer-events': 'none',+ 'cursor': 'default'});}},diff --git a/modules/UI/videolayout/Filmstrip.js b/modules/UI/videolayout/Filmstrip.jsindex f9dd7d9347..edaf3daf89 100644--- a/modules/UI/videolayout/Filmstrip.js+++ b/modules/UI/videolayout/Filmstrip.js@@ -2,8 +2,8 @@import { setFilmstripVisibility } from '../../../react/features/filmstrip';-import UIEvents from "../../../service/UI/UIEvents";-import UIUtil from "../util/UIUtil";+import UIEvents from '../../../service/UI/UIEvents';+import UIUtil from '../util/UIUtil';import { sendEvent } from '../../../react/features/analytics';@@ -13,7 +13,7 @@ const Filmstrip = {* @param eventEmitter the {EventEmitter} through which {Filmstrip} is to* emit/fire {UIEvents} (such as {UIEvents.TOGGLED_FILMSTRIP}).*/- init (eventEmitter) {+ init(eventEmitter) {this.iconMenuDownClassName = 'icon-menu-down';this.iconMenuUpClassName = 'icon-menu-up';this.filmstripContainerClassName = 'filmstrip';@@ -33,13 +33,14 @@ const Filmstrip = {* Initializes the filmstrip toolbar.*/_initFilmstripToolbar() {- let toolbarContainerHTML = this._generateToolbarHTML();- let className = this.filmstripContainerClassName;- let container = document.querySelector(`.${className}`);+ const toolbarContainerHTML = this._generateToolbarHTML();+ const className = this.filmstripContainerClassName;+ const container = document.querySelector(`.${className}`);UIUtil.prependChild(container, toolbarContainerHTML);- let iconSelector = '#toggleFilmstripButton i';+ const iconSelector = '#toggleFilmstripButton i';+this.toggleFilmstripIcon = document.querySelector(iconSelector);},@@ -49,8 +50,9 @@ const Filmstrip = {* @private*/_generateToolbarHTML() {- let container = document.createElement('div');- let isVisible = this.isFilmstripVisible();+ const container = document.createElement('div');+ const isVisible = this.isFilmstripVisible();+container.className = 'filmstrip__toolbar';container.innerHTML = `<button id="toggleFilmstripButton">@@ -81,14 +83,15 @@ const Filmstrip = {* @private*/_registerToggleFilmstripShortcut() {- let shortcut = 'F';- let shortcutAttr = 'filmstripPopover';- let description = 'keyboardShortcuts.toggleFilmstrip';+ const shortcut = 'F';+ const shortcutAttr = 'filmstripPopover';+ const description = 'keyboardShortcuts.toggleFilmstrip';+// Important:// Firing the event instead of executing toggleFilmstrip method because// it's important to hide the filmstrip by UI.toggleFilmstrip in order// to correctly resize the video area.- let handler = () => this.eventEmitter.emit(UIEvents.TOGGLE_FILMSTRIP);+ const handler = () => this.eventEmitter.emit(UIEvents.TOGGLE_FILMSTRIP);APP.keyboardshortcut.registerShortcut(shortcut,@@ -102,8 +105,9 @@ const Filmstrip = {* Changes classes of icon for showing down state*/showMenuDownIcon() {- let icon = this.toggleFilmstripIcon;- if(icon) {+ const icon = this.toggleFilmstripIcon;++ if (icon) {icon.classList.add(this.iconMenuDownClassName);icon.classList.remove(this.iconMenuUpClassName);}@@ -113,8 +117,9 @@ const Filmstrip = {* Changes classes of icon for showing up state*/showMenuUpIcon() {- let icon = this.toggleFilmstripIcon;- if(icon) {+ const icon = this.toggleFilmstripIcon;++ if (icon) {icon.classList.add(this.iconMenuUpClassName);icon.classList.remove(this.iconMenuDownClassName);}@@ -137,7 +142,9 @@ const Filmstrip = {*/toggleFilmstrip(visible, sendAnalytics = true) {const isVisibleDefined = typeof visible === 'boolean';+if (!isVisibleDefined) {+ // eslint-disable-next-line no-param-reassignvisible = this.isFilmstripVisible();} else if (this.isFilmstripVisible() === visible) {return;@@ -145,7 +152,7 @@ const Filmstrip = {if (sendAnalytics) {sendEvent('toolbar.filmstrip.toggled');}- this.filmstrip.toggleClass("hidden");+ this.filmstrip.toggleClass('hidden');if (visible) {this.showMenuUpIcon();@@ -190,9 +197,10 @@ const Filmstrip = {// display should be.if (this.isFilmstripVisible() && !interfaceConfig.VERTICAL_FILMSTRIP) {return $(`.${this.filmstripContainerClassName}`).outerHeight();- } else {- return 0;}++ return 0;+},/**@@ -200,9 +208,9 @@ const Filmstrip = {* @returns {*|{localVideo, remoteVideo}}*/calculateThumbnailSize() {- let availableSizes = this.calculateAvailableSize();- let width = availableSizes.availableWidth;- let height = availableSizes.availableHeight;+ const availableSizes = this.calculateAvailableSize();+ const width = availableSizes.availableWidth;+ const height = availableSizes.availableHeight;return this.calculateThumbnailSizeFromAvailable(width, height);},@@ -215,17 +223,17 @@ const Filmstrip = {*/calculateAvailableSize() {let availableHeight = interfaceConfig.FILM_STRIP_MAX_HEIGHT;- let thumbs = this.getThumbs(true);- let numvids = thumbs.remoteThumbs.length;+ const thumbs = this.getThumbs(true);+ const numvids = thumbs.remoteThumbs.length;- let localVideoContainer = $("#localVideoContainer");+ const localVideoContainer = $('#localVideoContainer');/*** If the videoAreaAvailableWidth is set we use this one to calculate* the filmstrip width, because we're probably in a state where the* filmstrip size hasn't been updated yet, but it will be.*/- let videoAreaAvailableWidth+ const videoAreaAvailableWidth= UIUtil.getAvailableVideoWidth()- this._getFilmstripExtraPanelsWidth()- UIUtil.parseCssInt(this.filmstrip.css('right'), 10)@@ -238,9 +246,9 @@ const Filmstrip = {let availableWidth = videoAreaAvailableWidth;// If local thumb is not hidden- if(thumbs.localThumb) {+ if (thumbs.localThumb) {availableWidth = Math.floor(- (videoAreaAvailableWidth - (+ videoAreaAvailableWidth - (UIUtil.parseCssInt(localVideoContainer.css('borderLeftWidth'), 10)+ UIUtil.parseCssInt(@@ -252,7 +260,7 @@ const Filmstrip = {+ UIUtil.parseCssInt(localVideoContainer.css('marginLeft'), 10)+ UIUtil.parseCssInt(- localVideoContainer.css('marginRight'), 10)))+ localVideoContainer.css('marginRight'), 10)));}@@ -260,9 +268,10 @@ const Filmstrip = {// filmstrip mode we don't need to calculate further any adjustments// to width based on the number of videos present.if (numvids && !interfaceConfig.VERTICAL_FILMSTRIP) {- let remoteVideoContainer = thumbs.remoteThumbs.eq(0);+ const remoteVideoContainer = thumbs.remoteThumbs.eq(0);+availableWidth = Math.floor(- (videoAreaAvailableWidth - numvids * (+ videoAreaAvailableWidth - (numvids * (UIUtil.parseCssInt(remoteVideoContainer.css('borderLeftWidth'), 10)+ UIUtil.parseCssInt(@@ -278,7 +287,8 @@ const Filmstrip = {);}- let maxHeight+ const maxHeight+// If the MAX_HEIGHT property hasn't been specified// we have the static value.= Math.min(interfaceConfig.FILM_STRIP_MAX_HEIGHT || 120,@@ -287,7 +297,8 @@ const Filmstrip = {availableHeight= Math.min(maxHeight, window.innerHeight - 18);- return { availableWidth, availableHeight };+ return { availableWidth,+ availableHeight };},/**@@ -300,15 +311,19 @@ const Filmstrip = {* @private*/_getFilmstripExtraPanelsWidth() {- let className = this.filmstripContainerClassName;+ const className = this.filmstripContainerClassName;let width = 0;+$(`.${className}`).children()- .each(function () {+ .each(function() {+ /* eslint-disable no-invalid-this */if (this.id !== 'remoteVideos') {width += $(this).outerWidth();}+ /* eslint-enable no-invalid-this */});+return width;},@@ -362,16 +377,17 @@ const Filmstrip = {const remoteThumbsInRow = interfaceConfig.VERTICAL_FILMSTRIP? 0 : this.getThumbs(true).remoteThumbs.length;- const remoteLocalWidthRatio = interfaceConfig.REMOTE_THUMBNAIL_RATIO /- interfaceConfig.LOCAL_THUMBNAIL_RATIO;- const lW = Math.min(availableWidth /- (remoteLocalWidthRatio * remoteThumbsInRow + 1), availableHeight *- interfaceConfig.LOCAL_THUMBNAIL_RATIO);+ const remoteLocalWidthRatio = interfaceConfig.REMOTE_THUMBNAIL_RATIO+ / interfaceConfig.LOCAL_THUMBNAIL_RATIO;+ const lW = Math.min(availableWidth+ / ((remoteLocalWidthRatio * remoteThumbsInRow) + 1), availableHeight+ * interfaceConfig.LOCAL_THUMBNAIL_RATIO);const h = lW / interfaceConfig.LOCAL_THUMBNAIL_RATIO;const remoteVideoWidth = lW * remoteLocalWidthRatio;let localVideo;+if (interfaceConfig.VERTICAL_FILMSTRIP) {localVideo = {thumbWidth: remoteVideoWidth,@@ -401,28 +417,32 @@ const Filmstrip = {* @param forceUpdate* @returns {Promise}*/+ // eslint-disable-next-line max-paramsresizeThumbnails(local, remote, animate = false, forceUpdate = false) {return new Promise(resolve => {- let thumbs = this.getThumbs(!forceUpdate);- let promises = [];+ const thumbs = this.getThumbs(!forceUpdate);+ const promises = [];- if(thumbs.localThumb) {- promises.push(new Promise((resolve) => {+ if (thumbs.localThumb) {+ // eslint-disable-next-line no-shadow+ promises.push(new Promise(resolve => {thumbs.localThumb.animate({height: local.thumbHeight,width: local.thumbWidth}, this._getAnimateOptions(animate, resolve));}));}- if(thumbs.remoteThumbs) {- promises.push(new Promise((resolve) => {+ if (thumbs.remoteThumbs) {+ // eslint-disable-next-line no-shadow+ promises.push(new Promise(resolve => {thumbs.remoteThumbs.animate({height: remote.thumbHeight,width: remote.thumbWidth}, this._getAnimateOptions(animate, resolve));}));}- promises.push(new Promise((resolve) => {+ // eslint-disable-next-line no-shadow+ promises.push(new Promise(resolve => {// Let CSS take care of height in vertical filmstrip mode.if (interfaceConfig.VERTICAL_FILMSTRIP) {$('#filmstripLocalVideo').animate({@@ -438,9 +458,10 @@ const Filmstrip = {}));promises.push(new Promise(() => {- let { localThumb } = this.getThumbs();- let height = localThumb ? localThumb.height() : 0;- let fontSize = UIUtil.getIndicatorFontSize(height);+ const { localThumb } = this.getThumbs();+ const height = localThumb ? localThumb.height() : 0;+ const fontSize = UIUtil.getIndicatorFontSize(height);+this.filmstrip.find('.indicator').animate({fontSize}, this._getAnimateOptions(animate, resolve));@@ -471,24 +492,27 @@ const Filmstrip = {/*** Returns thumbnails of the filmstrip- * @param only_visible+ * @param onlyVisible* @returns {object} thumbnails*/- getThumbs(only_visible = false) {+ getThumbs(onlyVisible = false) {let selector = 'span';- if (only_visible) {++ if (onlyVisible) {selector += ':visible';}- let localThumb = $("#localVideoContainer");- let remoteThumbs = this.filmstripRemoteVideos.children(selector);+ const localThumb = $('#localVideoContainer');+ const remoteThumbs = this.filmstripRemoteVideos.children(selector);// Exclude the local video container if it has been hidden.- if (localThumb.hasClass("hidden")) {+ if (localThumb.hasClass('hidden')) {return { remoteThumbs };- } else {- return { remoteThumbs, localThumb };}++ return { remoteThumbs,+ localThumb };+}};diff --git a/modules/UI/videolayout/LargeContainer.js b/modules/UI/videolayout/LargeContainer.jsindex e0a4a5f3b8..1fe130fd4a 100644--- a/modules/UI/videolayout/LargeContainer.js+++ b/modules/UI/videolayout/LargeContainer.js@@ -3,19 +3,19 @@* Base class for all Large containers which we can show.*/export default class LargeContainer {-+ /* eslint-disable no-unused-vars, no-empty-function *//*** Show this container.* @returns Promise*/- show () {+ show() {}/*** Hide this container.* @returns Promise*/- hide () {+ hide() {}/**@@ -24,20 +24,19 @@ export default class LargeContainer {* @param {number} containerHeight available height* @param {boolean} animate if container should animate it's resize process*/- // eslint-disable-next-line no-unused-vars- resize (containerWidth, containerHeight, animate) {+ resize(containerWidth, containerHeight, animate) {}/*** Handler for "hover in" events.*/- onHoverIn (e) { // eslint-disable-line no-unused-vars+ onHoverIn(e) {}/*** Handler for "hover out" events.*/- onHoverOut (e) { // eslint-disable-line no-unused-vars+ onHoverOut(e) {}/**@@ -46,14 +45,14 @@ export default class LargeContainer {* @param {JitsiTrack?} stream new stream* @param {string} videoType video type*/- setStream (userID, stream, videoType) {// eslint-disable-line no-unused-vars+ setStream(userID, stream, videoType) {}/*** Show or hide user avatar.* @param {boolean} show*/- showAvatar (show) { // eslint-disable-line no-unused-vars+ showAvatar(show) {}/**@@ -61,6 +60,8 @@ export default class LargeContainer {* when the container is on stage.* @return {boolean}*/- stayOnStage () {+ stayOnStage() {}++ /* eslint-enable no-unused-vars, no-empty-function */}diff --git a/modules/UI/videolayout/LargeVideoManager.js b/modules/UI/videolayout/LargeVideoManager.jsindex 5bea2db560..97d0c3e458 100644--- a/modules/UI/videolayout/LargeVideoManager.js+++ b/modules/UI/videolayout/LargeVideoManager.js@@ -7,7 +7,7 @@ import { Provider } from 'react-redux';import { PresenceLabel } from '../../../react/features/presence-status';/* eslint-enable no-unused-vars */-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);import {JitsiParticipantConnectionStatus@@ -16,15 +16,16 @@ import {updateKnownLargeVideoResolution} from '../../../react/features/large-video';-import Avatar from "../avatar/Avatar";-import {createDeferred} from '../../util/helpers';-import UIEvents from "../../../service/UI/UIEvents";-import UIUtil from "../util/UIUtil";-import {VideoContainer, VIDEO_CONTAINER_TYPE} from "./VideoContainer";+import Avatar from '../avatar/Avatar';+import { createDeferred } from '../../util/helpers';+import UIEvents from '../../../service/UI/UIEvents';+import UIUtil from '../util/UIUtil';+import { VideoContainer, VIDEO_CONTAINER_TYPE } from './VideoContainer';-import AudioLevels from "../audio_levels/AudioLevels";+import AudioLevels from '../audio_levels/AudioLevels';const DESKTOP_CONTAINER_TYPE = 'desktop';+/*** The time interval in milliseconds to check the video resolution of the video* being displayed.@@ -49,7 +50,10 @@ export default class LargeVideoManager {|| containerType === DESKTOP_CONTAINER_TYPE;}- constructor (emitter) {+ /**+ *+ */+ constructor(emitter) {/*** The map of <tt>LargeContainer</tt>s where the key is the video* container type.@@ -59,6 +63,7 @@ export default class LargeVideoManager {this.eventEmitter = emitter;this.state = VIDEO_CONTAINER_TYPE;+// FIXME: We are passing resizeContainer as parameter which is calling// Container.resize. Probably there's better way to implement this.this.videoContainer = new VideoContainer(@@ -125,7 +130,10 @@ export default class LargeVideoManager {this.removePresenceLabel();}- onHoverIn (e) {+ /**+ *+ */+ onHoverIn(e) {if (!this.state) {return;}@@ -134,7 +142,10 @@ export default class LargeVideoManager {container.onHoverIn(e);}- onHoverOut (e) {+ /**+ *+ */+ onHoverOut(e) {if (!this.state) {return;}@@ -146,9 +157,10 @@ export default class LargeVideoManager {/*** Called when the media connection has been interrupted.*/- onVideoInterrupted () {+ onVideoInterrupted() {this.enableLocalConnectionProblemFilter(true);- this._setLocalConnectionMessage("connection.RECONNECTING");+ this._setLocalConnectionMessage('connection.RECONNECTING');+// Show the message only if the video is currently being displayedthis.showLocalConnectionMessage(LargeVideoManager.isVideoContainer(this.state));@@ -157,17 +169,25 @@ export default class LargeVideoManager {/*** Called when the media connection has been restored.*/- onVideoRestored () {+ onVideoRestored() {this.enableLocalConnectionProblemFilter(false);this.showLocalConnectionMessage(false);}- get id () {+ /**+ *+ */+ get id() {const container = this.getCurrentContainer();++return container.id;}- scheduleLargeVideoUpdate () {+ /**+ *+ */+ scheduleLargeVideoUpdate() {if (this.updateInProcess || !this.newStreamData) {return;}@@ -175,6 +195,7 @@ export default class LargeVideoManager {this.updateInProcess = true;// Include hide()/fadeOut only if we're switching between users+ // eslint-disable-next-line eqeqeqconst isUserSwitch = this.newStreamData.id != this.id;const container = this.getCurrentContainer();const preUpdate = isUserSwitch ? container.hide() : Promise.resolve();@@ -190,9 +211,11 @@ export default class LargeVideoManager {this.newStreamData = null;- logger.info("hover in %s", id);+ logger.info('hover in %s', id);this.state = videoType;+ // eslint-disable-next-line no-shadowconst container = this.getCurrentContainer();+container.setStream(id, stream, videoType);// change the avatar url on large@@ -215,7 +238,7 @@ export default class LargeVideoManager {=== JitsiParticipantConnectionStatus.ACTIVE|| wasUsersImageCached);- let showAvatar+ const showAvatar= isVideoContainer&& (APP.conference.isAudioOnly() || !isVideoRenderable);@@ -225,6 +248,7 @@ export default class LargeVideoManager {// but we still should show watermarkif (showAvatar) {this.showWatermark(true);+// If the intention of this switch is to show the avatar// we need to make sure that the video is hiddenpromise = container.hide();@@ -246,10 +270,10 @@ export default class LargeVideoManager {let messageKey = null;if (isConnectionInterrupted) {- messageKey = "connection.USER_CONNECTION_INTERRUPTED";+ messageKey = 'connection.USER_CONNECTION_INTERRUPTED';} else if (connectionStatus=== JitsiParticipantConnectionStatus.INACTIVE) {- messageKey = "connection.LOW_BANDWIDTH";+ messageKey = 'connection.LOW_BANDWIDTH';}// Make sure no notification about remote failure is shown as@@ -302,21 +326,23 @@ export default class LargeVideoManager {this.videoContainer.showRemoteConnectionProblemIndicator(showProblemsIndication);- if (!messageKey) {- // Hide the message- this.showRemoteConnectionMessage(false);- } else {+ if (messageKey) {// Get user's display name- let displayName+ const displayName= APP.conference.getParticipantDisplayName(id);+this._setRemoteConnectionMessage(messageKey,- { displayName: displayName });+ { displayName });// Show it now only if the VideoContainer is on topthis.showRemoteConnectionMessage(LargeVideoManager.isVideoContainer(this.state));+ } else {+ // Hide the message+ this.showRemoteConnectionMessage(false);}+}/**@@ -327,7 +353,7 @@ export default class LargeVideoManager {* @param {string?} videoType new video type* @returns {Promise}*/- updateLargeVideo (userID, stream, videoType) {+ updateLargeVideo(userID, stream, videoType) {if (this.newStreamData) {this.newStreamData.reject();}@@ -345,7 +371,7 @@ export default class LargeVideoManager {/*** Update container size.*/- updateContainerSize () {+ updateContainerSize() {this.width = UIUtil.getAvailableVideoWidth();this.height = window.innerHeight;}@@ -355,8 +381,9 @@ export default class LargeVideoManager {* @param {string} type type of container which should be resized.* @param {boolean} [animate=false] if resize process should be animated.*/- resizeContainer (type, animate = false) {- let container = this.getContainer(type);+ resizeContainer(type, animate = false) {+ const container = this.getContainer(type);+container.resize(this.width, this.height, animate);}@@ -364,7 +391,7 @@ export default class LargeVideoManager {* Resize all Large containers.* @param {boolean} animate if resize process should be animated.*/- resize (animate) {+ resize(animate) {// resize all containersObject.keys(this.containers).forEach(type => this.resizeContainer(type, animate));@@ -384,15 +411,15 @@ export default class LargeVideoManager {** @param enable <tt>true</tt> to enable, <tt>false</tt> to disable*/- enableLocalConnectionProblemFilter (enable) {+ enableLocalConnectionProblemFilter(enable) {this.videoContainer.enableLocalConnectionProblemFilter(enable);}/*** Updates the src of the dominant speaker avatar*/- updateAvatar (avatarUrl) {- $("#dominantSpeakerAvatar").attr('src', avatarUrl);+ updateAvatar(avatarUrl) {+ $('#dominantSpeakerAvatar').attr('src', avatarUrl);}/**@@ -400,8 +427,8 @@ export default class LargeVideoManager {** @param lvl the new audio level to set*/- updateLargeVideoAudioLevel (lvl) {- AudioLevels.updateLargeVideoAudioLevel("dominantSpeaker", lvl);+ updateLargeVideoAudioLevel(lvl) {+ AudioLevels.updateLargeVideoAudioLevel('dominantSpeaker', lvl);}/**@@ -418,19 +445,18 @@ export default class LargeVideoManager {if (isConnectionMessageVisible) {this.removePresenceLabel();+return;}const presenceLabelContainer = $('#remotePresenceMessage');if (presenceLabelContainer.length) {- /* jshint ignore:start */ReactDOM.render(<Provider store = { APP.store }><PresenceLabel participantID = { id } /></Provider>,presenceLabelContainer.get(0));- /* jshint ignore:end */}}@@ -443,9 +469,7 @@ export default class LargeVideoManager {const presenceLabelContainer = $('#remotePresenceMessage');if (presenceLabelContainer.length) {- /* jshint ignore:start */ReactDOM.unmountComponentAtNode(presenceLabelContainer.get(0));- /* jshint ignore:end */}}@@ -453,7 +477,7 @@ export default class LargeVideoManager {* Show or hide watermark.* @param {boolean} show*/- showWatermark (show) {+ showWatermark(show) {$('.watermark').css('visibility', show ? 'visible' : 'hidden');}@@ -463,12 +487,13 @@ export default class LargeVideoManager {* displayed or not. If missing the condition will be based on the value* obtained from {@link APP.conference.isConnectionInterrupted}.*/- showLocalConnectionMessage (show) {+ showLocalConnectionMessage(show) {if (typeof show !== 'boolean') {+ // eslint-disable-next-line no-param-reassignshow = APP.conference.isConnectionInterrupted();}- let id = 'localConnectionMessage';+ const id = 'localConnectionMessage';UIUtil.setVisible(id, show);@@ -489,11 +514,12 @@ export default class LargeVideoManager {* obtained form "APP.conference" and the message will be displayed if* the user's connection is either interrupted or inactive.*/- showRemoteConnectionMessage (show) {+ showRemoteConnectionMessage(show) {if (typeof show !== 'boolean') {const connStatus= APP.conference.getParticipantConnectionStatus(this.id);+ // eslint-disable-next-line no-param-reassignshow = !APP.conference.isLocalId(this.id)&& (connStatus === JitsiParticipantConnectionStatus.INTERRUPTED|| connStatus@@ -501,7 +527,8 @@ export default class LargeVideoManager {}if (show) {- $('#remoteConnectionMessage').css({display: "block"});+ $('#remoteConnectionMessage').css({ display: 'block' });+// 'videoConnectionMessage' message conflicts with 'avatarMessage',// so it must be hiddenthis.showLocalConnectionMessage(false);@@ -520,11 +547,11 @@ export default class LargeVideoManager {** @private*/- _setRemoteConnectionMessage (msgKey, msgOptions) {+ _setRemoteConnectionMessage(msgKey, msgOptions) {if (msgKey) {$('#remoteConnectionMessage')- .attr("data-i18n", msgKey)- .attr("data-i18n-options", JSON.stringify(msgOptions));+ .attr('data-i18n', msgKey)+ .attr('data-i18n-options', JSON.stringify(msgOptions));APP.translation.translateElement($('#remoteConnectionMessage'), msgOptions);}@@ -539,9 +566,9 @@ export default class LargeVideoManager {** @private*/- _setLocalConnectionMessage (msgKey) {+ _setLocalConnectionMessage(msgKey) {$('#localConnectionMessage')- .attr("data-i18n", msgKey);+ .attr('data-i18n', msgKey);APP.translation.translateElement($('#localConnectionMessage'));}@@ -550,7 +577,7 @@ export default class LargeVideoManager {* @param {string} type container type* @param {LargeContainer} container container to add.*/- addContainer (type, container) {+ addContainer(type, container) {if (this.containers[type]) {throw new Error(`container of type ${type} already exist`);}@@ -564,8 +591,8 @@ export default class LargeVideoManager {* @param {string} type container type.* @returns {LargeContainer}*/- getContainer (type) {- let container = this.containers[type];+ getContainer(type) {+ const container = this.containers[type];if (!container) {throw new Error(`container of type ${type} doesn't exist`);@@ -598,7 +625,7 @@ export default class LargeVideoManager {* Remove Large container of specified type.* @param {string} type container type.*/- removeContainer (type) {+ removeContainer(type) {if (!this.containers[type]) {throw new Error(`container of type ${type} doesn't exist`);}@@ -612,15 +639,17 @@ export default class LargeVideoManager {* @param {string} type container type.* @returns {Promise}*/- showContainer (type) {+ showContainer(type) {if (this.state === type) {return Promise.resolve();}- let oldContainer = this.containers[this.state];+ const oldContainer = this.containers[this.state];+// FIXME when video is being replaced with other content we need to hide// companion icons/messages. It would be best if the container would// be taking care of it by itself, but that is a bigger refactoring+if (LargeVideoManager.isVideoContainer(this.state)) {this.showWatermark(false);this.showLocalConnectionMessage(false);@@ -629,7 +658,7 @@ export default class LargeVideoManager {oldContainer.hide();this.state = type;- let container = this.getContainer(type);+ const container = this.getContainer(type);return container.show().then(() => {if (LargeVideoManager.isVideoContainer(type)) {@@ -638,6 +667,7 @@ export default class LargeVideoManager {// the container would be taking care of it by itself, but that// is a bigger refactoringthis.showWatermark(true);+// "avatar" and "video connection" can not be displayed both// at the same time, but the latter is of higher priority and it// will hide the avatar one if will be displayed.diff --git a/modules/UI/videolayout/LocalVideo.js b/modules/UI/videolayout/LocalVideo.jsindex 8fa9982729..2e5233f251 100644--- a/modules/UI/videolayout/LocalVideo.js+++ b/modules/UI/videolayout/LocalVideo.js@@ -9,29 +9,33 @@ import { JitsiTrackEvents } from '../../../react/features/base/lib-jitsi-meet';import { VideoTrack } from '../../../react/features/base/media';/* eslint-enable no-unused-vars */-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);-import UIEvents from "../../../service/UI/UIEvents";-import SmallVideo from "./SmallVideo";+import UIEvents from '../../../service/UI/UIEvents';+import SmallVideo from './SmallVideo';+/**+ *+ */function LocalVideo(VideoLayout, emitter) {- this.videoSpanId = "localVideoContainer";+ this.videoSpanId = 'localVideoContainer';this.container = this.createContainer();this.$container = $(this.container);- $("#filmstripLocalVideo").append(this.container);+ $('#filmstripLocalVideo').append(this.container);this.localVideoId = null;this.bindHoverHandler();- if(config.enableLocalVideoFlip)+ if (config.enableLocalVideoFlip) {this._buildContextMenu();+ }this.isLocal = true;this.emitter = emitter;this.statsPopoverLocation = interfaceConfig.VERTICAL_FILMSTRIP? 'left top' : 'top center';Object.defineProperty(this, 'id', {- get: function () {+ get() {return APP.conference.getMyUserId();}});@@ -49,8 +53,9 @@ function LocalVideo(VideoLayout, emitter) {LocalVideo.prototype = Object.create(SmallVideo.prototype);LocalVideo.prototype.constructor = LocalVideo;-LocalVideo.prototype.createContainer = function () {+LocalVideo.prototype.createContainer = function() {const containerSpan = document.createElement('span');+containerSpan.classList.add('videocontainer');containerSpan.id = this.videoSpanId;@@ -72,24 +77,25 @@ LocalVideo.prototype.createContainer = function () {LocalVideo.prototype.setDisplayName = function(displayName) {if (!this.container) {logger.warn(- "Unable to set displayName - " + this.videoSpanId +- " does not exist");+ `Unable to set displayName - ${this.videoSpanId+ } does not exist`);+return;}this.updateDisplayName({allowEditing: true,- displayName: displayName,+ displayName,displayNameSuffix: interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME,elementID: 'localDisplayName',participantID: this.id});};-LocalVideo.prototype.changeVideo = function (stream) {+LocalVideo.prototype.changeVideo = function(stream) {this.videoStream = stream;- let localVideoClick = (event) => {+ const localVideoClick = event => {// TODO Checking the classes is a workround to allow events to bubble// into the DisplayName component if it was clicked. React's synthetic// events will fire after jQuery handlers execute, so stop propogation@@ -125,11 +131,10 @@ LocalVideo.prototype.changeVideo = function (stream) {this.$container.off('click');this.$container.on('click', localVideoClick);- this.localVideoId = 'localVideo_' + stream.getId();+ this.localVideoId = `localVideo_${stream.getId()}`;- var localVideoContainer = document.getElementById('localVideoWrapper');+ const localVideoContainer = document.getElementById('localVideoWrapper');- /* jshint ignore:start */ReactDOM.render(<Provider store = { APP.store }><VideoTrack@@ -138,13 +143,15 @@ LocalVideo.prototype.changeVideo = function (stream) {</Provider>,localVideoContainer);- /* jshint ignore:end */- let isVideo = stream.videoType != "desktop";+ // eslint-disable-next-line eqeqeq+ const isVideo = stream.videoType != 'desktop';+this._enableDisableContextMenu(isVideo);- this.setFlipX(isVideo? APP.settings.getLocalFlipX() : false);+ this.setFlipX(isVideo ? APP.settings.getLocalFlipX() : false);++ const endedHandler = () => {- let endedHandler = () => {// Only remove if there is no video and not a transition state.// Previous non-react logic created a new video element with each track// removal whereas react reuses the video component so it could be the@@ -160,6 +167,7 @@ LocalVideo.prototype.changeVideo = function (stream) {}stream.off(JitsiTrackEvents.LOCAL_TRACK_STOPPED, endedHandler);};+stream.on(JitsiTrackEvents.LOCAL_TRACK_STOPPED, endedHandler);};@@ -172,15 +180,14 @@ LocalVideo.prototype.setVisible = function(visible) {// We toggle the hidden class as an indication to other interested parties// that this container has been hidden on purpose.- this.$container.toggleClass("hidden");+ this.$container.toggleClass('hidden');// We still show/hide it as we need to overwrite the style property if we// want our action to take effect. Toggling the display property through// the above css class didn't succeed in overwriting the style.if (visible) {this.$container.show();- }- else {+ } else {this.$container.hide();}};@@ -189,39 +196,41 @@ LocalVideo.prototype.setVisible = function(visible) {* Sets the flipX state of the video.* @param val {boolean} true for flipped otherwise false;*/-LocalVideo.prototype.setFlipX = function (val) {+LocalVideo.prototype.setFlipX = function(val) {this.emitter.emit(UIEvents.LOCAL_FLIPX_CHANGED, val);- if(!this.localVideoId)+ if (!this.localVideoId) {return;- if(val) {- this.selectVideoElement().addClass("flipVideoX");+ }+ if (val) {+ this.selectVideoElement().addClass('flipVideoX');} else {- this.selectVideoElement().removeClass("flipVideoX");+ this.selectVideoElement().removeClass('flipVideoX');}};/*** Builds the context menu for the local video.*/-LocalVideo.prototype._buildContextMenu = function () {+LocalVideo.prototype._buildContextMenu = function() {$.contextMenu({- selector: '#' + this.videoSpanId,+ selector: `#${this.videoSpanId}`,zIndex: 10000,items: {flip: {- name: "Flip",+ name: 'Flip',callback: () => {- let val = !APP.settings.getLocalFlipX();+ const val = !APP.settings.getLocalFlipX();+this.setFlipX(val);APP.settings.setLocalFlipX(val);}}},events: {- show : function(options){- options.items.flip.name =- APP.translation.generateTranslationHTML(- "videothumbnail.flip");+ show(options) {+ options.items.flip.name+ = APP.translation.generateTranslationHTML(+ 'videothumbnail.flip');}}});@@ -231,9 +240,10 @@ LocalVideo.prototype._buildContextMenu = function () {* Enables or disables the context menu for the local video.* @param enable {boolean} true for enable, false for disable*/-LocalVideo.prototype._enableDisableContextMenu = function (enable) {- if(this.$container.contextMenu)+LocalVideo.prototype._enableDisableContextMenu = function(enable) {+ if (this.$container.contextMenu) {this.$container.contextMenu(enable);+ }};export default LocalVideo;diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.jsindex 50a3e8917f..47eb3d0ddf 100644--- a/modules/UI/videolayout/RemoteVideo.js+++ b/modules/UI/videolayout/RemoteVideo.js@@ -18,11 +18,11 @@ import {} from '../../../react/features/remote-video-menu';/* eslint-enable no-unused-vars */-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);-import SmallVideo from "./SmallVideo";-import UIUtils from "../util/UIUtil";+import SmallVideo from './SmallVideo';+import UIUtils from '../util/UIUtil';/*** Creates new instance of the <tt>RemoteVideo</tt>.@@ -52,6 +52,7 @@ function RemoteVideo(user, VideoLayout, emitter) {this.isLocal = false;this.popupMenuIsHovered = false;this._isRemoteControlSessionActive = false;+/*** The flag is set to <tt>true</tt> after the 'onplay' event has been* triggered on the current video element. It goes back to <tt>false</tt>@@ -60,6 +61,7 @@ function RemoteVideo(user, VideoLayout, emitter) {* @type {boolean}*/this.wasVideoPlayed = false;+/*** The flag is set to <tt>true</tt> if remote participant's video gets muted* during his media connection disruption. This is to prevent black video@@ -107,9 +109,11 @@ RemoteVideo.prototype.addRemoteVideoContainer = function() {* @private* NOTE: extends SmallVideo's method*/-RemoteVideo.prototype._isHovered = function () {- let isHovered = SmallVideo.prototype._isHovered.call(this)+RemoteVideo.prototype._isHovered = function() {+ const isHovered = SmallVideo.prototype._isHovered.call(this)|| this.popupMenuIsHovered;++return isHovered;};@@ -119,7 +123,7 @@ RemoteVideo.prototype._isHovered = function () {* @returns {Element|*} the constructed element, containing popup menu items* @private*/-RemoteVideo.prototype._generatePopupContent = function () {+RemoteVideo.prototype._generatePopupContent = function() {if (interfaceConfig.filmStripOnly) {return;}@@ -139,14 +143,13 @@ RemoteVideo.prototype._generatePopupContent = function () {&& ((!APP.remoteControl.active && !this._isRemoteControlSessionActive)|| APP.remoteControl.controller.activeParticipant === this.id)) {if (controller.getRequestedParticipant() === this.id) {- onRemoteControlToggle = () => {};remoteControlState = REMOTE_CONTROL_MENU_STATES.REQUESTING;- } else if (!controller.isStarted()) {- onRemoteControlToggle = this._requestRemoteControlPermissions;- remoteControlState = REMOTE_CONTROL_MENU_STATES.NOT_STARTED;- } else {+ } else if (controller.isStarted()) {onRemoteControlToggle = this._stopRemoteControl;remoteControlState = REMOTE_CONTROL_MENU_STATES.STARTED;+ } else {+ onRemoteControlToggle = this._requestRemoteControlPermissions;+ remoteControlState = REMOTE_CONTROL_MENU_STATES.NOT_STARTED;}}@@ -161,7 +164,6 @@ RemoteVideo.prototype._generatePopupContent = function () {const { isModerator } = APP.conference;const participantID = this.id;- /* jshint ignore:start */ReactDOM.render(<Provider store = { APP.store }><I18nextProvider i18n = { i18next }>@@ -169,7 +171,7 @@ RemoteVideo.prototype._generatePopupContent = function () {initialVolumeValue = { initialVolumeValue }isAudioMuted = { this.isAudioMuted }isModerator = { isModerator }- onMenuDisplay = { this._onRemoteVideoMenuDisplay.bind(this) }+ onMenuDisplay = {this._onRemoteVideoMenuDisplay.bind(this)}onRemoteControlToggle = { onRemoteControlToggle }onVolumeChange = { onVolumeChange }participantID = { participantID }@@ -177,10 +179,9 @@ RemoteVideo.prototype._generatePopupContent = function () {</I18nextProvider></Provider>,remoteVideoMenuContainer);- /* jshint ignore:end */};-RemoteVideo.prototype._onRemoteVideoMenuDisplay = function () {+RemoteVideo.prototype._onRemoteVideoMenuDisplay = function() {this.updateRemoteVideoMenu();};@@ -201,7 +202,7 @@ RemoteVideo.prototype.setRemoteControlActiveStatus = function(isActive) {* @param {boolean} isSupported*/RemoteVideo.prototype.setRemoteControlSupport = function(isSupported = false) {- if(this._supportsRemoteControl === isSupported) {+ if (this._supportsRemoteControl === isSupported) {return;}this._supportsRemoteControl = isSupported;@@ -211,24 +212,26 @@ RemoteVideo.prototype.setRemoteControlSupport = function(isSupported = false) {/*** Requests permissions for remote control session.*/-RemoteVideo.prototype._requestRemoteControlPermissions = function () {+RemoteVideo.prototype._requestRemoteControlPermissions = function() {APP.remoteControl.controller.requestPermissions(this.id, this.VideoLayout.getLargeVideoWrapper()).then(result => {- if(result === null) {+ if (result === null) {return;}this.updateRemoteVideoMenu();APP.UI.messageHandler.notify(- "dialog.remoteControlTitle",- (result === false) ? "dialog.remoteControlDeniedMessage"- : "dialog.remoteControlAllowedMessage",- {user: this.user.getDisplayName()- || interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME}+ 'dialog.remoteControlTitle',+ result === false ? 'dialog.remoteControlDeniedMessage'+ : 'dialog.remoteControlAllowedMessage',+ { user: this.user.getDisplayName()+ || interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME });- if(result === true) {//the remote control permissions has been granted+ if (result === true) {+ // the remote control permissions has been granted// pin the controlled participant- let pinnedId = this.VideoLayout.getPinnedId();- if(pinnedId !== this.id) {+ const pinnedId = this.VideoLayout.getPinnedId();++ if (pinnedId !== this.id) {this.VideoLayout.handleVideoThumbClicked(this.id);}}@@ -236,10 +239,10 @@ RemoteVideo.prototype._requestRemoteControlPermissions = function () {logger.error(error);this.updateRemoteVideoMenu();APP.UI.messageHandler.notify(- "dialog.remoteControlTitle",- "dialog.remoteControlErrorMessage",- {user: this.user.getDisplayName()- || interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME}+ 'dialog.remoteControlTitle',+ 'dialog.remoteControlErrorMessage',+ { user: this.user.getDisplayName()+ || interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME });});this.updateRemoteVideoMenu();@@ -248,7 +251,7 @@ RemoteVideo.prototype._requestRemoteControlPermissions = function () {/*** Stops remote control session.*/-RemoteVideo.prototype._stopRemoteControl = function () {+RemoteVideo.prototype._stopRemoteControl = function() {// send message about stoppingAPP.remoteControl.controller.stop();this.updateRemoteVideoMenu();@@ -259,7 +262,7 @@ RemoteVideo.prototype._stopRemoteControl = function () {** @returns {Element} audio element*/-RemoteVideo.prototype._getAudioElement = function () {+RemoteVideo.prototype._getAudioElement = function() {return this._audioStreamElement;};@@ -268,8 +271,10 @@ RemoteVideo.prototype._getAudioElement = function () {** @returns {boolean} true if the volume can be adjusted.*/-RemoteVideo.prototype._canSetAudioVolume = function () {+RemoteVideo.prototype._canSetAudioVolume = function() {const audioElement = this._getAudioElement();++return audioElement && audioElement.volume !== undefined;};@@ -278,7 +283,7 @@ RemoteVideo.prototype._canSetAudioVolume = function () {** @param {int} newVal - The value to set the slider to.*/-RemoteVideo.prototype._setAudioVolume = function (newVal) {+RemoteVideo.prototype._setAudioVolume = function(newVal) {if (this._canSetAudioVolume()) {this._getAudioElement().volume = newVal;}@@ -289,7 +294,7 @@ RemoteVideo.prototype._setAudioVolume = function (newVal) {** @param isMuted the new muted state to update to*/-RemoteVideo.prototype.updateRemoteVideoMenu = function (+RemoteVideo.prototype.updateRemoteVideoMenu = function(isMuted = this.isAudioMuted) {this.isAudioMuted = isMuted;@@ -302,6 +307,7 @@ RemoteVideo.prototype.updateRemoteVideoMenu = function (*/RemoteVideo.prototype.setVideoMutedView = function(isMuted) {SmallVideo.prototype.setVideoMutedView.call(this, isMuted);+// Update 'mutedWhileDisconnected' flagthis._figureOutMutedWhileDisconnected();};@@ -314,6 +320,7 @@ RemoteVideo.prototype.setVideoMutedView = function(isMuted) {*/RemoteVideo.prototype._figureOutMutedWhileDisconnected = function() {const isActive = this.isConnectionActive();+if (!isActive && this.isVideoMuted) {this.mutedWhileDisconnected = true;} else if (isActive && !this.isVideoMuted) {@@ -326,7 +333,7 @@ RemoteVideo.prototype._figureOutMutedWhileDisconnected = function() {* given <tt>parentElement</tt>.**/-RemoteVideo.prototype.addRemoteVideoMenu = function () {+RemoteVideo.prototype.addRemoteVideoMenu = function() {if (interfaceConfig.filmStripOnly) {return;}@@ -343,22 +350,24 @@ RemoteVideo.prototype.addRemoteVideoMenu = function () {* @param stream the MediaStream* @param isVideo <tt>true</tt> if given <tt>stream</tt> is a video one.*/-RemoteVideo.prototype.removeRemoteStreamElement = function (stream) {- if (!this.container)+RemoteVideo.prototype.removeRemoteStreamElement = function(stream) {+ if (!this.container) {return false;+ }- var isVideo = stream.isVideoTrack();+ const isVideo = stream.isVideoTrack();++ const elementID = SmallVideo.getStreamElementID(stream);+ const select = $(`#${elementID}`);- var elementID = SmallVideo.getStreamElementID(stream);- var select = $('#' + elementID);select.remove();if (isVideo) {this.wasVideoPlayed = false;}- logger.info((isVideo ? "Video" : "Audio") +- " removed " + this.id, select);+ logger.info(`${isVideo ? 'Video' : 'Audio'+ } removed ${this.id}`, select);// when removing only the video element and we are on stage// update the stage@@ -386,15 +395,16 @@ RemoteVideo.prototype.isConnectionActive = function() {* The remote video is considered "playable" once the stream has started* according to the {@link #hasVideoStarted} result.* It will be allowed to display video also in- * {@link JitsiParticipantConnectionStatus.INTERRUPTED} if the video was ever played- * and was not muted while not in ACTIVE state. This basically means that there- * is stalled video image cached that could be displayed. It's used to show- * "grey video image" in user's thumbnail when there are connectivity issues.+ * {@link JitsiParticipantConnectionStatus.INTERRUPTED} if the video was ever+ * played and was not muted while not in ACTIVE state. This basically means+ * that there is stalled video image cached that could be displayed. It's used+ * to show "grey video image" in user's thumbnail when there are connectivity+ * issues.** @inheritdoc* @override*/-RemoteVideo.prototype.isVideoPlayable = function () {+RemoteVideo.prototype.isVideoPlayable = function() {const connectionState= APP.conference.getParticipantConnectionStatus(this.id);@@ -408,7 +418,7 @@ RemoteVideo.prototype.isVideoPlayable = function () {/*** @inheritDoc*/-RemoteVideo.prototype.updateView = function () {+RemoteVideo.prototype.updateView = function() {this.$container.toggleClass('audio-only', APP.conference.isAudioOnly());this.updateConnectionStatusIndicator();@@ -421,7 +431,7 @@ RemoteVideo.prototype.updateView = function () {/*** Updates the UI to reflect user's connectivity status.*/-RemoteVideo.prototype.updateConnectionStatusIndicator = function () {+RemoteVideo.prototype.updateConnectionStatusIndicator = function() {const connectionStatus = this.user.getConnectionStatus();logger.debug(`${this.id} thumbnail connection status: ${connectionStatus}`);@@ -433,18 +443,20 @@ RemoteVideo.prototype.updateConnectionStatusIndicator = function () {const isInterrupted= connectionStatus === JitsiParticipantConnectionStatus.INTERRUPTED;+// Toggle thumbnail video problem filter+this.selectVideoElement().toggleClass(- "videoThumbnailProblemFilter", isInterrupted);+ 'videoThumbnailProblemFilter', isInterrupted);this.$avatar().toggleClass(- "videoThumbnailProblemFilter", isInterrupted);+ 'videoThumbnailProblemFilter', isInterrupted);};/*** Removes RemoteVideo from the page.*/-RemoteVideo.prototype.remove = function () {- logger.log("Remove thumbnail", this.id);+RemoteVideo.prototype.remove = function() {+ logger.log('Remove thumbnail', this.id);this.removeAudioLevelIndicator();@@ -470,30 +482,34 @@ RemoteVideo.prototype.remove = function () {// Make sure that the large video is updated if are removing its// corresponding small video.this.VideoLayout.updateAfterThumbRemoved(this.id);+// Remove whole containerif (this.container.parentNode) {this.container.parentNode.removeChild(this.container);}};-RemoteVideo.prototype.waitForPlayback = function (streamElement, stream) {+RemoteVideo.prototype.waitForPlayback = function(streamElement, stream) {++ const webRtcStream = stream.getOriginalStream();+ const isVideo = stream.isVideoTrack();- var webRtcStream = stream.getOriginalStream();- var isVideo = stream.isVideoTrack();if (!isVideo || webRtcStream.id === 'mixedmslabel') {return;}- var self = this;+ const self = this;// Triggers when video playback starts- var onPlayingHandler = function () {+ const onPlayingHandler = function() {self.wasVideoPlayed = true;self.VideoLayout.remoteVideoActive(streamElement, self.id);streamElement.onplaying = null;+// Refresh to show the videoself.updateView();};+streamElement.onplaying = onPlayingHandler;};@@ -503,23 +519,25 @@ RemoteVideo.prototype.waitForPlayback = function (streamElement, stream) {* @returns {boolean} true if this RemoteVideo has a video stream for which* the playback has been started.*/-RemoteVideo.prototype.hasVideoStarted = function () {+RemoteVideo.prototype.hasVideoStarted = function() {return this.wasVideoPlayed;};-RemoteVideo.prototype.addRemoteStreamElement = function (stream) {+RemoteVideo.prototype.addRemoteStreamElement = function(stream) {if (!this.container) {return;}- let isVideo = stream.isVideoTrack();+ const isVideo = stream.isVideoTrack();+isVideo ? this.videoStream = stream : this.audioStream = stream;- if (isVideo)+ if (isVideo) {this.setVideoType(stream.videoType);+ }// Add click handler.- let onClickHandler = (event) => {+ const onClickHandler = event => {const $source = $(event.target || event.srcElement);const { classList } = event.target;@@ -546,12 +564,15 @@ RemoteVideo.prototype.addRemoteStreamElement = function (stream) {event.stopPropagation();event.preventDefault();}+return false;};+this.container.onclick = onClickHandler;- if(!stream.getOriginalStream())+ if (!stream.getOriginalStream()) {return;+ }let streamElement = SmallVideo.createStreamElement(stream);@@ -591,8 +612,9 @@ RemoteVideo.prototype.addRemoteStreamElement = function (stream) {*/RemoteVideo.prototype.setDisplayName = function(displayName) {if (!this.container) {- logger.warn( "Unable to set displayName - " + this.videoSpanId +- " does not exist");+ logger.warn(`Unable to set displayName - ${this.videoSpanId+ } does not exist`);+return;}@@ -610,7 +632,7 @@ RemoteVideo.prototype.setDisplayName = function(displayName) {* @param videoElementId the id of local or remote video element.*/RemoteVideo.prototype.removeRemoteVideoMenu = function() {- var menuSpan = this.$container.find('.remotevideomenu');+ const menuSpan = this.$container.find('.remotevideomenu');if (menuSpan.length) {ReactDOM.unmountComponentAtNode(menuSpan.get(0));@@ -625,18 +647,16 @@ RemoteVideo.prototype.removeRemoteVideoMenu = function() {** @return {void}*/-RemoteVideo.prototype.addPresenceLabel = function () {+RemoteVideo.prototype.addPresenceLabel = function() {const presenceLabelContainer= this.container.querySelector('.presence-label-container');if (presenceLabelContainer) {- /* jshint ignore:start */ReactDOM.render(<Provider store = { APP.store }><PresenceLabel participantID = { this.id } /></Provider>,presenceLabelContainer);- /* jshint ignore:end */}};@@ -645,7 +665,7 @@ RemoteVideo.prototype.addPresenceLabel = function () {** @return {void}*/-RemoteVideo.prototype.removePresenceLabel = function () {+RemoteVideo.prototype.removePresenceLabel = function() {const presenceLabelContainer= this.container.querySelector('.presence-label-container');@@ -654,8 +674,9 @@ RemoteVideo.prototype.removePresenceLabel = function () {}};-RemoteVideo.createContainer = function (spanId) {+RemoteVideo.createContainer = function(spanId) {const container = document.createElement('span');+container.id = spanId;container.className = 'videocontainer';@@ -669,7 +690,9 @@ RemoteVideo.createContainer = function (spanId) {<div class ='presence-label-container'></div><span class = 'remotevideomenu'></span>`;- var remotes = document.getElementById('filmstripRemoteVideosContainer');+ const remotes = document.getElementById('filmstripRemoteVideosContainer');++return remotes.appendChild(container);};diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.jsindex d944cd3b19..08d4d6f090 100644--- a/modules/UI/videolayout/SmallVideo.js+++ b/modules/UI/videolayout/SmallVideo.js@@ -25,11 +25,11 @@ import {} from '../../../react/features/filmstrip';/* eslint-enable no-unused-vars */-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);-import Avatar from "../avatar/Avatar";-import UIUtil from "../util/UIUtil";-import UIEvents from "../../../service/UI/UIEvents";+import Avatar from '../avatar/Avatar';+import UIUtil from '../util/UIUtil';+import UIEvents from '../../../service/UI/UIEvents';const RTCUIHelper = JitsiMeetJS.util.RTCUIHelper;@@ -39,6 +39,7 @@ const RTCUIHelper = JitsiMeetJS.util.RTCUIHelper;* @constant*/const DISPLAY_VIDEO = 0;+/*** Display mode constant used when the user's avatar is being displayed on* the small video.@@ -46,6 +47,7 @@ const DISPLAY_VIDEO = 0;* @constant*/const DISPLAY_AVATAR = 1;+/*** Display mode constant used when neither video nor avatar is being displayed* on the small video. And we just show the display name.@@ -70,6 +72,9 @@ const DISPLAY_VIDEO_WITH_NAME = 3;*/const DISPLAY_AVATAR_WITH_NAME = 4;+/**+ * Constructor.+ */function SmallVideo(VideoLayout) {this._isModerator = false;this.isAudioMuted = false;@@ -80,6 +85,7 @@ function SmallVideo(VideoLayout) {this.VideoLayout = VideoLayout;this.videoIsHovered = false;this.hideDisplayName = false;+// we can stop updating the thumbnailthis.disableUpdateView = false;@@ -136,7 +142,7 @@ function SmallVideo(VideoLayout) {** @returns the identifier of this small video*/-SmallVideo.prototype.getId = function () {+SmallVideo.prototype.getId = function() {return this.id;};@@ -145,7 +151,7 @@ SmallVideo.prototype.getId = function () {* @return <tt>true</tt> if this small video isn't currently visible and* <tt>false</tt> - otherwise.*/-SmallVideo.prototype.isVisible = function () {+SmallVideo.prototype.isVisible = function() {return this.$container.is(':visible');};@@ -153,9 +159,10 @@ SmallVideo.prototype.isVisible = function () {* Enables / disables the device availability icons for this small video.* @param {enable} set to {true} to enable and {false} to disable*/-SmallVideo.prototype.enableDeviceAvailabilityIcons = function (enable) {- if (typeof enable === "undefined")+SmallVideo.prototype.enableDeviceAvailabilityIcons = function(enable) {+ if (typeof enable === 'undefined') {return;+ }this.deviceAvailabilityIconsEnabled = enable;};@@ -164,32 +171,34 @@ SmallVideo.prototype.enableDeviceAvailabilityIcons = function (enable) {* Sets the device "non" availability icons.* @param devices the devices, which will be checked for availability*/-SmallVideo.prototype.setDeviceAvailabilityIcons = function (devices) {- if (!this.deviceAvailabilityIconsEnabled)+SmallVideo.prototype.setDeviceAvailabilityIcons = function(devices) {+ if (!this.deviceAvailabilityIconsEnabled) {return;+ }- if(!this.container)+ if (!this.container) {return;+ }- var noMic = this.$container.find('.noMic');- var noVideo = this.$container.find('.noVideo');+ const noMic = this.$container.find('.noMic');+ const noVideo = this.$container.find('.noVideo');noMic.remove();noVideo.remove();if (!devices.audio) {this.container.appendChild(- document.createElement("div")).setAttribute("class", "noMic");+ document.createElement('div')).setAttribute('class', 'noMic');}if (!devices.video) {this.container.appendChild(- document.createElement("div")).setAttribute("class", "noVideo");+ document.createElement('div')).setAttribute('class', 'noVideo');}if (!devices.audio && !devices.video) {- noMic.css("background-position", "75%");- noVideo.css("background-position", "25%");- noVideo.css("background-color", "transparent");+ noMic.css('background-position', '75%');+ noVideo.css('background-position', '25%');+ noVideo.css('background-color', 'transparent');}};@@ -200,7 +209,7 @@ SmallVideo.prototype.setDeviceAvailabilityIcons = function (devices) {* lib-jitsi-meet.* @param videoType 'camera' or 'desktop', or 'sharedvideo'.*/-SmallVideo.prototype.setVideoType = function (videoType) {+SmallVideo.prototype.setVideoType = function(videoType) {this.videoType = videoType;};@@ -211,21 +220,22 @@ SmallVideo.prototype.setVideoType = function (videoType) {* lib-jitsi-meet.* @returns {String} 'camera', 'screen', 'sharedvideo', or undefined.*/-SmallVideo.prototype.getVideoType = function () {+SmallVideo.prototype.getVideoType = function() {return this.videoType;};/*** Creates an audio or video element for a particular MediaStream.*/-SmallVideo.createStreamElement = function (stream) {- let isVideo = stream.isVideoTrack();+SmallVideo.createStreamElement = function(stream) {+ const isVideo = stream.isVideoTrack();- let element = isVideo+ const element = isVideo? document.createElement('video'): document.createElement('audio');+if (isVideo) {- element.setAttribute("muted", "true");+ element.setAttribute('muted', 'true');}RTCUIHelper.setAutoPlay(element, true);@@ -238,8 +248,8 @@ SmallVideo.createStreamElement = function (stream) {/*** Returns the element id for a particular MediaStream.*/-SmallVideo.getStreamElementID = function (stream) {- let isVideo = stream.isVideoTrack();+SmallVideo.getStreamElementID = function(stream) {+ const isVideo = stream.isVideoTrack();return (isVideo ? 'remoteVideo_' : 'remoteAudio_') + stream.getId();};@@ -247,7 +257,7 @@ SmallVideo.getStreamElementID = function (stream) {/*** Configures hoverIn/hoverOut handlers. Depends on connection indicator.*/-SmallVideo.prototype.bindHoverHandler = function () {+SmallVideo.prototype.bindHoverHandler = function() {// Add hover handlerthis.$container.hover(() => {@@ -268,7 +278,7 @@ SmallVideo.prototype.bindHoverHandler = function () {* @returns {void}*/-SmallVideo.prototype.removeConnectionIndicator = function () {+SmallVideo.prototype.removeConnectionIndicator = function() {this._showConnectionIndicator = false;this.updateIndicators();@@ -279,7 +289,7 @@ SmallVideo.prototype.removeConnectionIndicator = function () {* @returns {void}*/-SmallVideo.prototype.updateConnectionStatus = function (connectionStatus) {+SmallVideo.prototype.updateConnectionStatus = function(connectionStatus) {this._connectionStatus = connectionStatus;this.updateIndicators();};@@ -290,7 +300,7 @@ SmallVideo.prototype.updateConnectionStatus = function (connectionStatus) {* @param {boolean} isMuted indicates if the muted element should be shown* or hidden*/-SmallVideo.prototype.showAudioIndicator = function (isMuted) {+SmallVideo.prototype.showAudioIndicator = function(isMuted) {this.isAudioMuted = isMuted;this.updateStatusBar();};@@ -315,12 +325,11 @@ SmallVideo.prototype.setVideoMutedView = function(isMuted) {** @returns {void}*/-SmallVideo.prototype.updateStatusBar = function () {+SmallVideo.prototype.updateStatusBar = function() {const statusBarContainer= this.container.querySelector('.videocontainer__toolbar');const tooltipPosition = interfaceConfig.VERTICAL_FILMSTRIP ? 'left' : 'top';- /* jshint ignore:start */ReactDOM.render(<I18nextProvider i18n = { i18next }><div>@@ -339,13 +348,12 @@ SmallVideo.prototype.updateStatusBar = function () {</div></I18nextProvider>,statusBarContainer);- /* jshint ignore:end */};/*** Adds the element indicating the moderator(owner) of the conference.*/-SmallVideo.prototype.addModeratorIndicator = function () {+SmallVideo.prototype.addModeratorIndicator = function() {this._isModerator = true;this.updateStatusBar();};@@ -355,7 +363,7 @@ SmallVideo.prototype.addModeratorIndicator = function () {** @returns {void}*/-SmallVideo.prototype.addAudioLevelIndicator = function () {+SmallVideo.prototype.addAudioLevelIndicator = function() {let audioLevelContainer = this._getAudioLevelContainer();if (audioLevelContainer) {@@ -374,7 +382,7 @@ SmallVideo.prototype.addAudioLevelIndicator = function () {** @returns {void}*/-SmallVideo.prototype.removeAudioLevelIndicator = function () {+SmallVideo.prototype.removeAudioLevelIndicator = function() {const audioLevelContainer = this._getAudioLevelContainer();if (audioLevelContainer) {@@ -388,16 +396,14 @@ SmallVideo.prototype.removeAudioLevelIndicator = function () {* @param lvl the new audio level to set* @returns {void}*/-SmallVideo.prototype.updateAudioLevelIndicator = function (lvl = 0) {+SmallVideo.prototype.updateAudioLevelIndicator = function(lvl = 0) {const audioLevelContainer = this._getAudioLevelContainer();if (audioLevelContainer) {- /* jshint ignore:start */ReactDOM.render(<AudioLevelIndicatoraudioLevel = { lvl }/>,audioLevelContainer);- /* jshint ignore:end */}};@@ -407,14 +413,14 @@ SmallVideo.prototype.updateAudioLevelIndicator = function (lvl = 0) {** @returns {HTMLElement} The DOM element that holds the AudioLevelIndicator.*/-SmallVideo.prototype._getAudioLevelContainer = function () {+SmallVideo.prototype._getAudioLevelContainer = function() {return this.container.querySelector('.audioindicator-container');};/*** Removes the element indicating the moderator(owner) of the conference.*/-SmallVideo.prototype.removeModeratorIndicator = function () {+SmallVideo.prototype.removeModeratorIndicator = function() {this._isModerator = false;this.updateStatusBar();};@@ -429,7 +435,7 @@ SmallVideo.prototype.removeModeratorIndicator = function () {* this function to access the video element via the 0th element of the returned* array (after checking its length of course!).*/-SmallVideo.prototype.selectVideoElement = function () {+SmallVideo.prototype.selectVideoElement = function() {return $(RTCUIHelper.findVideoElement(this.container));};@@ -439,7 +445,7 @@ SmallVideo.prototype.selectVideoElement = function () {* @return {jQuery|HTMLElement} a jQuery selector pointing to the HTML image* element which displays the user's avatar.*/-SmallVideo.prototype.$avatar = function () {+SmallVideo.prototype.$avatar = function() {return this.$container.find('.avatar-container');};@@ -449,7 +455,7 @@ SmallVideo.prototype.$avatar = function () {* @return {jQuery} a jQuery selector pointing to the display name element of* the video thumbnail*/-SmallVideo.prototype.$displayName = function () {+SmallVideo.prototype.$displayName = function() {return this.$container.find('.displayNameContainer');};@@ -459,12 +465,11 @@ SmallVideo.prototype.$displayName = function () {** @returns {void}*/-SmallVideo.prototype.updateDisplayName = function (props) {+SmallVideo.prototype.updateDisplayName = function(props) {const displayNameContainer= this.container.querySelector('.displayNameContainer');if (displayNameContainer) {- /* jshint ignore:start */ReactDOM.render(<Provider store = { APP.store }><I18nextProvider i18n = { i18next }>@@ -472,7 +477,6 @@ SmallVideo.prototype.updateDisplayName = function (props) {</I18nextProvider></Provider>,displayNameContainer);- /* jshint ignore:end */}};@@ -482,7 +486,7 @@ SmallVideo.prototype.updateDisplayName = function (props) {** @returns {void}*/-SmallVideo.prototype.removeDisplayName = function () {+SmallVideo.prototype.removeDisplayName = function() {const displayNameContainer= this.container.querySelector('.displayNameContainer');@@ -498,18 +502,17 @@ SmallVideo.prototype.removeDisplayName = function () {* @param isFocused indicates if the thumbnail should be focused/pinned or not*/SmallVideo.prototype.focus = function(isFocused) {- var focusedCssClass = "videoContainerFocused";- var isFocusClassEnabled = this.$container.hasClass(focusedCssClass);+ const focusedCssClass = 'videoContainerFocused';+ const isFocusClassEnabled = this.$container.hasClass(focusedCssClass);if (!isFocused && isFocusClassEnabled) {this.$container.removeClass(focusedCssClass);- }- else if (isFocused && !isFocusClassEnabled) {+ } else if (isFocused && !isFocusClassEnabled) {this.$container.addClass(focusedCssClass);}};-SmallVideo.prototype.hasVideo = function () {+SmallVideo.prototype.hasVideo = function() {return this.selectVideoElement().length !== 0;};@@ -520,7 +523,7 @@ SmallVideo.prototype.hasVideo = function () {* @return {boolean} <tt>true</tt> if the user is displayed on the large video* or <tt>false</tt> otherwise.*/-SmallVideo.prototype.isCurrentlyOnLargeVideo = function () {+SmallVideo.prototype.isCurrentlyOnLargeVideo = function() {return this.VideoLayout.isCurrentlyOnLarge(this.id);};@@ -550,13 +553,14 @@ SmallVideo.prototype.selectDisplayMode = function() {&& this.selectVideoElement().length&& !APP.conference.isAudioOnly()) {// check hovering and change state to video with name- return this._isHovered() ?- DISPLAY_VIDEO_WITH_NAME : DISPLAY_VIDEO;- } else {- // check hovering and change state to avatar with name- return this._isHovered() ?- DISPLAY_AVATAR_WITH_NAME : DISPLAY_AVATAR;+ return this._isHovered()+ ? DISPLAY_VIDEO_WITH_NAME : DISPLAY_VIDEO;}++ // check hovering and change state to avatar with name+ return this._isHovered()+ ? DISPLAY_AVATAR_WITH_NAME : DISPLAY_AVATAR;+};/**@@ -565,7 +569,7 @@ SmallVideo.prototype.selectDisplayMode = function() {* indicator is shown(hovered).* @private*/-SmallVideo.prototype._isHovered = function () {+SmallVideo.prototype._isHovered = function() {return this.videoIsHovered || this._popoverIsHovered;};@@ -577,42 +581,49 @@ SmallVideo.prototype._isHovered = function () {* @param show whether we should show the avatar or not* video because there is no dominant speaker and no focused speaker*/-SmallVideo.prototype.updateView = function () {- if (this.disableUpdateView)+SmallVideo.prototype.updateView = function() {+ if (this.disableUpdateView) {return;+ }if (!this.hasAvatar) {if (this.id) {// Init avatarthis.avatarChanged(Avatar.getAvatarUrl(this.id));} else {- logger.error("Unable to init avatar - no id", this);+ logger.error('Unable to init avatar - no id', this);+return;}}// Determine whether video, avatar or blackness should be displayed- let displayMode = this.selectDisplayMode();+ const displayMode = this.selectDisplayMode();+// Show/hide video.+UIUtil.setVisibleBySelector(this.selectVideoElement(),- (displayMode === DISPLAY_VIDEO- || displayMode === DISPLAY_VIDEO_WITH_NAME));+ displayMode === DISPLAY_VIDEO+ || displayMode === DISPLAY_VIDEO_WITH_NAME);+// Show/hide the avatar.UIUtil.setVisibleBySelector(this.$avatar(),- (displayMode === DISPLAY_AVATAR- || displayMode === DISPLAY_AVATAR_WITH_NAME));+ displayMode === DISPLAY_AVATAR+ || displayMode === DISPLAY_AVATAR_WITH_NAME);+// Show/hide the display name.UIUtil.setVisibleBySelector(this.$displayName(),!this.hideDisplayName&& (displayMode === DISPLAY_BLACKNESS_WITH_NAME|| displayMode === DISPLAY_VIDEO_WITH_NAME|| displayMode === DISPLAY_AVATAR_WITH_NAME));+// show hide overlay when there is a video or avatar under// the display nameUIUtil.setVisibleBySelector(this.$container.find('.videocontainer__hoverOverlay'),- (displayMode === DISPLAY_AVATAR_WITH_NAME- || displayMode === DISPLAY_VIDEO_WITH_NAME));+ displayMode === DISPLAY_AVATAR_WITH_NAME+ || displayMode === DISPLAY_VIDEO_WITH_NAME);};/**@@ -622,19 +633,18 @@ SmallVideo.prototype.updateView = function () {* @param {string} avatarUrl - The uri to the avatar image.* @returns {void}*/-SmallVideo.prototype.avatarChanged = function (avatarUrl) {+SmallVideo.prototype.avatarChanged = function(avatarUrl) {const thumbnail = this.$avatar().get(0);+this.hasAvatar = true;if (thumbnail) {- /* jshint ignore:start */ReactDOM.render(<AvatarDisplayclassName = 'userAvatar'uri = { avatarUrl } />,thumbnail);- /* jshint ignore:end */}};@@ -644,7 +654,7 @@ SmallVideo.prototype.avatarChanged = function (avatarUrl) {** @returns {void}*/-SmallVideo.prototype.removeAvatar = function () {+SmallVideo.prototype.removeAvatar = function() {const thumbnail = this.$avatar().get(0);if (thumbnail) {@@ -656,15 +666,17 @@ SmallVideo.prototype.removeAvatar = function () {* Shows or hides the dominant speaker indicator.* @param show whether to show or hide.*/-SmallVideo.prototype.showDominantSpeakerIndicator = function (show) {+SmallVideo.prototype.showDominantSpeakerIndicator = function(show) {// Don't create and show dominant speaker indicator if// DISABLE_DOMINANT_SPEAKER_INDICATOR is true- if (interfaceConfig.DISABLE_DOMINANT_SPEAKER_INDICATOR)+ if (interfaceConfig.DISABLE_DOMINANT_SPEAKER_INDICATOR) {return;+ }if (!this.container) {- logger.warn( "Unable to set dominant speaker indicator - "- + this.videoSpanId + " does not exist");+ logger.warn(`Unable to set dominant speaker indicator - ${+ this.videoSpanId} does not exist`);+return;}@@ -677,10 +689,11 @@ SmallVideo.prototype.showDominantSpeakerIndicator = function (show) {* Shows or hides the raised hand indicator.* @param show whether to show or hide.*/-SmallVideo.prototype.showRaisedHandIndicator = function (show) {+SmallVideo.prototype.showRaisedHandIndicator = function(show) {if (!this.container) {- logger.warn( "Unable to raised hand indication - "- + this.videoSpanId + " does not exist");+ logger.warn(`Unable to raised hand indication - ${+ this.videoSpanId} does not exist`);+return;}@@ -695,26 +708,31 @@ SmallVideo.prototype.showRaisedHandIndicator = function (show) {* is added, and will fire a RESOLUTION_CHANGED event.*/SmallVideo.prototype.waitForResolutionChange = function() {- let beforeChange = window.performance.now();- let videos = this.selectVideoElement();- if (!videos || !videos.length || videos.length <= 0)+ const beforeChange = window.performance.now();+ const videos = this.selectVideoElement();++ if (!videos || !videos.length || videos.length <= 0) {return;- let video = videos[0];- let oldWidth = video.videoWidth;- let oldHeight = video.videoHeight;+ }+ const video = videos[0];+ const oldWidth = video.videoWidth;+ const oldHeight = video.videoHeight;+video.onresize = () => {+ // eslint-disable-next-line eqeqeqif (video.videoWidth != oldWidth || video.videoHeight != oldHeight) {// Only run once.video.onresize = null;- let delay = window.performance.now() - beforeChange;- let emitter = this.VideoLayout.getEventEmitter();+ const delay = window.performance.now() - beforeChange;+ const emitter = this.VideoLayout.getEventEmitter();+if (emitter) {emitter.emit(UIEvents.RESOLUTION_CHANGED,this.getId(),- oldWidth + "x" + oldHeight,- video.videoWidth + "x" + video.videoHeight,+ `${oldWidth}x${oldHeight}`,+ `${video.videoWidth}x${video.videoHeight}`,delay);}}@@ -735,11 +753,12 @@ SmallVideo.prototype.waitForResolutionChange = function() {*/SmallVideo.prototype.initBrowserSpecificProperties = function() {- var userAgent = window.navigator.userAgent;- if (userAgent.indexOf("QtWebEngine") > -1- && (userAgent.indexOf("Windows") > -1- || userAgent.indexOf("Linux") > -1)) {- this.$container.css("overflow", "hidden");+ const userAgent = window.navigator.userAgent;++ if (userAgent.indexOf('QtWebEngine') > -1+ && (userAgent.indexOf('Windows') > -1+ || userAgent.indexOf('Linux') > -1)) {+ this.$container.css('overflow', 'hidden');}};@@ -751,7 +770,7 @@ SmallVideo.prototype.initBrowserSpecificProperties = function() {* @private* @returns {void}*/-SmallVideo.prototype.updateIndicators = function () {+SmallVideo.prototype.updateIndicators = function() {const indicatorToolbar= this.container.querySelector('.videocontainer__toptoolbar');@@ -760,7 +779,6 @@ SmallVideo.prototype.updateIndicators = function () {|| !interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_ENABLED;const tooltipPosition = interfaceConfig.VERTICAL_FILMSTRIP ? 'left' : 'top';- /* jshint ignore:start */ReactDOM.render(<I18nextProvider i18n = { i18next }><div>@@ -788,7 +806,6 @@ SmallVideo.prototype.updateIndicators = function () {</I18nextProvider>,indicatorToolbar);- /* jshint ignore:end */};/**@@ -798,7 +815,7 @@ SmallVideo.prototype.updateIndicators = function () {* @private* @returns {void}*/-SmallVideo.prototype._unmountIndicators = function () {+SmallVideo.prototype._unmountIndicators = function() {const indicatorToolbar= this.container.querySelector('.videocontainer__toptoolbar');@@ -815,7 +832,7 @@ SmallVideo.prototype._unmountIndicators = function () {* currently over the connection indicator popover.* @returns {void}*/-SmallVideo.prototype._onPopoverHover = function (popoverIsHovered) {+SmallVideo.prototype._onPopoverHover = function(popoverIsHovered) {this._popoverIsHovered = popoverIsHovered;this.updateView();};diff --git a/modules/UI/videolayout/VideoContainer.js b/modules/UI/videolayout/VideoContainer.jsindex 0b25b8ec7e..e13a33d96b 100644--- a/modules/UI/videolayout/VideoContainer.js+++ b/modules/UI/videolayout/VideoContainer.js@@ -23,16 +23,17 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);* @param videoSpaceHeight the height of the available space* @return an array with 2 elements, the video width and the video height*/-function computeDesktopVideoSize(+function computeDesktopVideoSize( // eslint-disable-line max-paramsvideoWidth,videoHeight,videoSpaceWidth,videoSpaceHeight) {- let aspectRatio = videoWidth / videoHeight;+ const aspectRatio = videoWidth / videoHeight;let availableWidth = Math.max(videoWidth, videoSpaceWidth);let availableHeight = Math.max(videoHeight, videoSpaceHeight);+ // eslint-disable-next-line no-param-reassignvideoSpaceHeight -= Filmstrip.getFilmstripHeight();if (availableWidth / aspectRatio >= videoSpaceHeight) {@@ -60,13 +61,14 @@ function computeDesktopVideoSize(* @param videoSpaceHeight the height of the video space* @return an array with 2 elements, the video width and the video height*/-function computeCameraVideoSize(+function computeCameraVideoSize( // eslint-disable-line max-paramsvideoWidth,videoHeight,videoSpaceWidth,videoSpaceHeight,videoLayoutFit) {const aspectRatio = videoWidth / videoHeight;+switch (videoLayoutFit) {case 'height':return [ videoSpaceHeight * aspectRatio, videoSpaceHeight ];@@ -78,10 +80,10 @@ function computeCameraVideoSize(|| Infinity;if (videoSpaceRatio === aspectRatio) {- return [videoSpaceWidth, videoSpaceHeight];+ return [ videoSpaceWidth, videoSpaceHeight ];}- let [ width, height] = computeCameraVideoSize(+ let [ width, height ] = computeCameraVideoSize(videoWidth,videoHeight,videoSpaceWidth,@@ -97,7 +99,8 @@ function computeCameraVideoSize(height = maxHeight;width = height * aspectRatio;}- return [width, height];++ return [ width, height ];}default:return [ videoWidth, videoHeight ];@@ -111,7 +114,7 @@ function computeCameraVideoSize(* @return an array with 2 elements, the horizontal indent and the vertical* indent*/-function getCameraVideoPosition(+function getCameraVideoPosition( // eslint-disable-line max-paramsvideoWidth,videoHeight,videoSpaceWidth,@@ -120,13 +123,15 @@ function getCameraVideoPosition(// full screen mode and this is why we use the screen height in this case.// Need to think it further at some point and implement it properly.if (UIUtil.isFullScreen()) {+ // eslint-disable-next-line no-param-reassignvideoSpaceHeight = window.innerHeight;}- let horizontalIndent = (videoSpaceWidth - videoWidth) / 2;- let verticalIndent = (videoSpaceHeight - videoHeight) / 2;+ const horizontalIndent = (videoSpaceWidth - videoWidth) / 2;+ const verticalIndent = (videoSpaceHeight - videoHeight) / 2;- return { horizontalIndent, verticalIndent };+ return { horizontalIndent,+ verticalIndent };}/**@@ -137,11 +142,12 @@ function getCameraVideoPosition(* indent*/function getDesktopVideoPosition(videoWidth, videoHeight, videoSpaceWidth) {- let horizontalIndent = (videoSpaceWidth - videoWidth) / 2;+ const horizontalIndent = (videoSpaceWidth - videoWidth) / 2;- let verticalIndent = 0;// Top aligned+ const verticalIndent = 0;// Top aligned- return { horizontalIndent, verticalIndent };+ return { horizontalIndent,+ verticalIndent };}/**@@ -149,15 +155,24 @@ function getDesktopVideoPosition(videoWidth, videoHeight, videoSpaceWidth) {*/export class VideoContainer extends LargeContainer {// FIXME: With Temasys we have to re-select everytime- get $video () {+ /**+ *+ */+ get $video() {return $('#largeVideo');}+ /**+ *+ */get $videoBackground() {return $('#largeVideoBackground');}- get id () {+ /**+ *+ */+ get id() {return this.userId;}@@ -168,7 +183,7 @@ export class VideoContainer extends LargeContainer {* @param emitter {EventEmitter} the event emitter that will be used by* this instance.*/- constructor (resizeContainer, emitter) {+ constructor(resizeContainer, emitter) {super();this.stream = null;this.userId = null;@@ -213,15 +228,17 @@ export class VideoContainer extends LargeContainer {this.avatarHeight = $('#dominantSpeakerAvatar').height();- var onPlayingCallback = function (event) {+ const onPlayingCallback = function(event) {if (typeof resizeContainer === 'function') {resizeContainer(event);}this.wasVideoRendered = true;}.bind(this);+// This does not work with Temasys plugin - has to be a property to be// copied between new <object> elements- //this.$video.on('play', onPlay);+ // this.$video.on('play', onPlay);+this.$video[0].onplaying = onPlayingCallback;/**@@ -254,7 +271,7 @@ export class VideoContainer extends LargeContainer {* @param {boolean} enable <tt>true</tt> if the filter is to be enabled or* <tt>false</tt> otherwise.*/- enableLocalConnectionProblemFilter (enable) {+ enableLocalConnectionProblemFilter(enable) {this.$video.toggleClass('videoProblemFilter', enable);this.$videoBackground.toggleClass('videoProblemFilter', enable);}@@ -271,8 +288,10 @@ export class VideoContainer extends LargeContainer {* Get size of video element.* @returns {{width, height}}*/- getStreamSize () {- let video = this.$video[0];+ getStreamSize() {+ const video = this.$video[0];++return {width: video.videoWidth,height: video.videoHeight@@ -286,7 +305,7 @@ export class VideoContainer extends LargeContainer {* @returns {{availableWidth, availableHeight}}*/getVideoSize(containerWidth, containerHeight) {- let { width, height } = this.getStreamSize();+ const { width, height } = this.getStreamSize();if (this.stream && this.isScreenSharing()) {return computeDesktopVideoSize(width,@@ -302,6 +321,7 @@ export class VideoContainer extends LargeContainer {interfaceConfig.VIDEO_LAYOUT_FIT);}+ /* eslint-disable max-params *//*** Calculate optimal video position (offset for top left corner)* for specified video size and container size.@@ -311,18 +331,20 @@ export class VideoContainer extends LargeContainer {* @param {number} containerHeight container height* @returns {{horizontalIndent, verticalIndent}}*/- getVideoPosition (width, height, containerWidth, containerHeight) {+ getVideoPosition(width, height, containerWidth, containerHeight) {+ /* eslint-enable max-params */if (this.stream && this.isScreenSharing()) {- return getDesktopVideoPosition( width,+ return getDesktopVideoPosition(width,height,containerWidth,containerHeight);- } else {- return getCameraVideoPosition( width,+ }++ return getCameraVideoPosition(width,height,containerWidth,containerHeight);- }+}/**@@ -346,18 +368,23 @@ export class VideoContainer extends LargeContainer {*/_positionParticipantStatus($element) {if (this.avatarDisplayed) {- let $avatarImage = $('#dominantSpeakerAvatar');+ const $avatarImage = $('#dominantSpeakerAvatar');+$element.css('top',$avatarImage.offset().top + $avatarImage.height() + 10);} else {- let height = $element.height();- let parentHeight = $element.parent().height();- $element.css('top', (parentHeight/2) - (height/2));+ const height = $element.height();+ const parentHeight = $element.parent().height();++ $element.css('top', (parentHeight / 2) - (height / 2));}}- resize (containerWidth, containerHeight, animate = false) {+ /**+ *+ */+ resize(containerWidth, containerHeight, animate = false) {// XXX Prevent TypeError: undefined is not an object when the Web// browser does not support WebRTC (yet).if (this.$video.length === 0) {@@ -366,32 +393,35 @@ export class VideoContainer extends LargeContainer {this._hideVideoBackground();- let [ width, height ]+ const [ width, height ]= this.getVideoSize(containerWidth, containerHeight);if ((containerWidth > width) || (containerHeight > height)) {this._showVideoBackground();const css= containerWidth > width- ? { width: '100%', height: 'auto' }- : { width: 'auto', height: '100%' };+ ? { width: '100%',+ height: 'auto' }+ : { width: 'auto',+ height: '100%' };+this.$videoBackground.css(css);}- let { horizontalIndent, verticalIndent }+ const { horizontalIndent, verticalIndent }= this.getVideoPosition(width, height,containerWidth, containerHeight);// update avatar position- let top = containerHeight / 2 - this.avatarHeight / 4 * 3;+ const top = (containerHeight / 2) - (this.avatarHeight / 4 * 3);this.$avatar.css('top', top);this.positionRemoteStatusMessages();this.$wrapper.animate({- width: width,- height: height,+ width,+ height,top: verticalIndent,bottom: verticalIndent,@@ -422,22 +452,24 @@ export class VideoContainer extends LargeContainer {* @param {JitsiTrack?} stream new stream* @param {string} videoType video type*/- setStream (userID, stream, videoType) {+ setStream(userID, stream, videoType) {this.userId = userID;if (this.stream === stream) {// Handles the use case for the remote participants when the// videoType is received with delay after turning on/off the// desktop sharing.- if(this.videoType !== videoType) {+ if (this.videoType !== videoType) {this.videoType = videoType;this.resizeContainer();}+return;- } else {- // The stream has changed, so the image will be lost on detach- this.wasVideoRendered = false;}+ // The stream has changed, so the image will be lost on detach+ this.wasVideoRendered = false;++// detach old streamif (this.stream) {this.stream.detach(this.$video[0]);@@ -475,8 +507,9 @@ export class VideoContainer extends LargeContainer {*/setLocalFlipX(val) {this.localFlipX = val;- if(!this.$video || !this.stream || !this.stream.isLocal())+ if (!this.$video || !this.stream || !this.stream.isLocal()) {return;+ }this.$video.css({transform: this.localFlipX ? 'scaleX(-1)' : 'none'});@@ -491,7 +524,7 @@ export class VideoContainer extends LargeContainer {* Check if current video stream is screen sharing.* @returns {boolean}*/- isScreenSharing () {+ isScreenSharing() {return this.videoType === 'desktop';}@@ -499,7 +532,7 @@ export class VideoContainer extends LargeContainer {* Show or hide user avatar.* @param {boolean} show*/- showAvatar (show) {+ showAvatar(show) {// TO FIX: Video background need to be black, so that we don't have a// flickering effect when scrolling between videos and have the screen// move to grey before going back to video. Avatars though can have the@@ -521,26 +554,28 @@ export class VideoContainer extends LargeContainer {* @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide* the indication.*/- showRemoteConnectionProblemIndicator (show) {+ showRemoteConnectionProblemIndicator(show) {this.$video.toggleClass('remoteVideoProblemFilter', show);this.$videoBackground.toggleClass('remoteVideoProblemFilter', show);this.$avatar.toggleClass('remoteVideoProblemFilter', show);}- // We are doing fadeOut/fadeIn animations on parent div which wraps- // largeVideo, because when Temasys plugin is in use it replaces- // <video> elements with plugin <object> tag. In Safari jQuery is- // unable to store values on this plugin object which breaks all- // animation effects performed on it directly.- show () {+ /**+ * We are doing fadeOut/fadeIn animations on parent div which wraps+ * largeVideo, because when Temasys plugin is in use it replaces+ * <video> elements with plugin <object> tag. In Safari jQuery is+ * unable to store values on this plugin object which breaks all+ * animation effects performed on it directly.+ */+ show() {// its already visibleif (this.isVisible) {return Promise.resolve();}- return new Promise((resolve) => {+ return new Promise(resolve => {this.$wrapperParent.css('visibility', 'visible').fadeTo(FADE_DURATION_MS,1,@@ -552,16 +587,20 @@ export class VideoContainer extends LargeContainer {});}- hide () {+ /**+ *+ */+ hide() {// as the container is hidden/replaced by another container// hide its avatarthis.showAvatar(false);+// its already hiddenif (!this.isVisible) {return Promise.resolve();}- return new Promise((resolve) => {+ return new Promise(resolve => {this.$wrapperParent.fadeTo(FADE_DURATION_MS, 0, () => {this.$wrapperParent.css('visibility', 'hidden');this.isVisible = false;@@ -573,7 +612,7 @@ export class VideoContainer extends LargeContainer {/*** @return {boolean} switch on dominant speaker event if on stage.*/- stayOnStage () {+ stayOnStage() {return false;}@@ -586,9 +625,9 @@ export class VideoContainer extends LargeContainer {* on the large video.* @returns {void}*/- setLargeVideoBackground (isAvatar) {+ setLargeVideoBackground(isAvatar) {$('#largeVideoContainer').css('background',- (this.videoType === VIDEO_CONTAINER_TYPE && !isAvatar)+ this.videoType === VIDEO_CONTAINER_TYPE && !isAvatar? '#000' : interfaceConfig.DEFAULT_BACKGROUND);}@@ -631,6 +670,7 @@ export class VideoContainer extends LargeContainer {// do not care. Some browsers (at this time, only Edge is known) don't// return a promise from .play(), so check before trying to catch.const res = this.$videoBackground[0].play();+if (typeof res !== 'undefined') {res.catch(reason => logger.error(reason));}diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.jsindex b6c9d67f83..e14fce1294 100644--- a/modules/UI/videolayout/VideoLayout.js+++ b/modules/UI/videolayout/VideoLayout.js@@ -1,5 +1,5 @@/* global APP, $, interfaceConfig */-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);import {JitsiParticipantConnectionStatus@@ -9,67 +9,36 @@ import {pinParticipant} from '../../../react/features/base/participants';-import Filmstrip from "./Filmstrip";-import UIEvents from "../../../service/UI/UIEvents";-import UIUtil from "../util/UIUtil";+import Filmstrip from './Filmstrip';+import UIEvents from '../../../service/UI/UIEvents';+import UIUtil from '../util/UIUtil';-import RemoteVideo from "./RemoteVideo";-import LargeVideoManager from "./LargeVideoManager";-import {VIDEO_CONTAINER_TYPE} from "./VideoContainer";-import LocalVideo from "./LocalVideo";+import RemoteVideo from './RemoteVideo';+import LargeVideoManager from './LargeVideoManager';+import { VIDEO_CONTAINER_TYPE } from './VideoContainer';+import LocalVideo from './LocalVideo';-var remoteVideos = {};-var localVideoThumbnail = null;+const remoteVideos = {};+let localVideoThumbnail = null;-var currentDominantSpeaker = null;+let currentDominantSpeaker = null;-var eventEmitter = null;+let eventEmitter = null;++let largeVideo;/*** flipX state of the localVideo*/let localFlipX = null;-/**- * On contact list item clicked.- */-function onContactClicked (id) {- if (APP.conference.isLocalId(id)) {- $("#localVideoContainer").click();- return;- }-- let remoteVideo = remoteVideos[id];- if (remoteVideo && remoteVideo.hasVideo()) {- // It is not always the case that a videoThumb exists (if there is- // no actual video).- if (remoteVideo.hasVideoStarted()) {- // We have a video src, great! Let's update the large video- // now.- VideoLayout.handleVideoThumbClicked(id);- } else {-- // If we don't have a video src for jid, there's absolutely- // no point in calling handleVideoThumbClicked; Quite- // simply, it won't work because it needs an src to attach- // to the large video.- //- // Instead, we trigger the pinned endpoint changed event to- // let the bridge adjust its lastN set for myjid and store- // the pinned user in the lastNPickupId variable to be- // picked up later by the lastN changed event handler.- this.pinParticipant(remoteVideo.id);- }- }-}-/*** Handler for local flip X changed event.* @param {Object} val*/-function onLocalFlipXChanged (val) {+function onLocalFlipXChanged(val) {localFlipX = val;- if(largeVideo) {+ if (largeVideo) {largeVideo.onLocalFlipXChange(val);}}@@ -81,31 +50,31 @@ function onLocalFlipXChanged (val) {* @return the corresponding resource id to the given peer container* DOM element*/-function getPeerContainerResourceId (containerElement) {+function getPeerContainerResourceId(containerElement) {if (localVideoThumbnail.container === containerElement) {return localVideoThumbnail.id;}- let i = containerElement.id.indexOf('participant_');+ const i = containerElement.id.indexOf('participant_');if (i >= 0) {return containerElement.id.substring(i + 12);}}-let largeVideo;--var VideoLayout = {- init (emitter) {+const VideoLayout = {+ init(emitter) {eventEmitter = emitter;// Unregister listeners in case of reinitializationthis.unregisterListeners();localVideoThumbnail = new LocalVideo(VideoLayout, emitter);+// sets default video type of local video// FIXME container type is totally different thing from the video typelocalVideoThumbnail.setVideoType(VIDEO_CONTAINER_TYPE);+// if we do not resize the thumbs here, if there is no video device// the local video thumb maybe one pixelthis.resizeThumbnails(false, true);@@ -151,11 +120,11 @@ var VideoLayout = {}},- initLargeVideo () {+ initLargeVideo() {this.resetLargeVideo();largeVideo = new LargeVideoManager(eventEmitter);- if(localFlipX) {+ if (localFlipX) {largeVideo.onLocalFlipXChange(localFlipX);}largeVideo.updateContainerSize();@@ -168,16 +137,20 @@ var VideoLayout = {* @param lvl the new audio level to update to*/setAudioLevel(id, lvl) {- let smallVideo = this.getSmallVideo(id);- if (smallVideo)+ const smallVideo = this.getSmallVideo(id);++ if (smallVideo) {smallVideo.updateAudioLevelIndicator(lvl);+ }- if (largeVideo && id === largeVideo.id)+ if (largeVideo && id === largeVideo.id) {largeVideo.updateLargeVideoAudioLevel(lvl);+ }},- changeLocalVideo (stream) {- let localId = APP.conference.getMyUserId();+ changeLocalVideo(stream) {+ const localId = APP.conference.getMyUserId();+this.onVideoTypeChanged(localId, stream.videoType);localVideoThumbnail.changeVideo(stream);@@ -194,7 +167,7 @@ var VideoLayout = {* actually joined. Otherwise events can come with information like email* and setting them assume the id is already set.*/- mucJoined () {+ mucJoined() {if (largeVideo && !largeVideo.id) {this.updateLargeVideo(APP.conference.getMyUserId(), true);}@@ -210,13 +183,15 @@ var VideoLayout = {* @param resourceJid the jid of user* @param devices available devices*/- setDeviceAvailabilityIcons (id, devices) {+ setDeviceAvailabilityIcons(id, devices) {if (APP.conference.isLocalId(id)) {localVideoThumbnail.setDeviceAvailabilityIcons(devices);+return;}- let video = remoteVideos[id];+ const video = remoteVideos[id];+if (!video) {return;}@@ -230,17 +205,18 @@ var VideoLayout = {* @param id the identifier of the participant* @param enable {true} to enable device availability icons*/- enableDeviceAvailabilityIcons (id, enable) {+ enableDeviceAvailabilityIcons(id, enable) {let video;+if (APP.conference.isLocalId(id)) {video = localVideoThumbnail;- }- else {+ } else {video = remoteVideos[id];}- if (video)+ if (video) {video.enableDeviceAvailabilityIcons(enable);+ }},/**@@ -257,7 +233,7 @@ var VideoLayout = {* Uses focusedID if any or dominantSpeakerID if any,* otherwise elects new video, in this order.*/- updateAfterThumbRemoved (id) {+ updateAfterThumbRemoved(id) {// Always trigger an update if large video is empty.if (!largeVideo|| (this.getLargeVideoID() && !this.isCurrentlyOnLarge(id))) {@@ -267,75 +243,87 @@ var VideoLayout = {const pinnedId = this.getPinnedId();let newId;- if (pinnedId)+ if (pinnedId) {newId = pinnedId;- else if (currentDominantSpeaker)+ } else if (currentDominantSpeaker) {newId = currentDominantSpeaker;- else // Otherwise select last visible video+ } else { // Otherwise select last visible videonewId = this.electLastVisibleVideo();+ }this.updateLargeVideo(newId);},- electLastVisibleVideo () {+ electLastVisibleVideo() {// pick the last visible video in the row// if nobody else is left, this picks the local video- let remoteThumbs = Filmstrip.getThumbs(true).remoteThumbs;+ const remoteThumbs = Filmstrip.getThumbs(true).remoteThumbs;let thumbs = remoteThumbs.filter('[id!="mixedstream"]');- let lastVisible = thumbs.filter(':visible:last');+ const lastVisible = thumbs.filter(':visible:last');+if (lastVisible.length) {- let id = getPeerContainerResourceId(lastVisible[0]);+ const id = getPeerContainerResourceId(lastVisible[0]);+if (remoteVideos[id]) {- logger.info("electLastVisibleVideo: " + id);+ logger.info(`electLastVisibleVideo: ${id}`);+return id;}+// The RemoteVideo was removed (but the DOM elements may still// exist).}- logger.info("Last visible video no longer exists");+ logger.info('Last visible video no longer exists');thumbs = Filmstrip.getThumbs().remoteThumbs;if (thumbs.length) {- let id = getPeerContainerResourceId(thumbs[0]);+ const id = getPeerContainerResourceId(thumbs[0]);+if (remoteVideos[id]) {- logger.info("electLastVisibleVideo: " + id);+ logger.info(`electLastVisibleVideo: ${id}`);+return id;}+// The RemoteVideo was removed (but the DOM elements may// still exist).}// Go with local video- logger.info("Fallback to local video...");+ logger.info('Fallback to local video...');++ const id = APP.conference.getMyUserId();- let id = APP.conference.getMyUserId();- logger.info("electLastVisibleVideo: " + id);+ logger.info(`electLastVisibleVideo: ${id}`);return id;},- onRemoteStreamAdded (stream) {- let id = stream.getParticipantId();- let remoteVideo = remoteVideos[id];+ onRemoteStreamAdded(stream) {+ const id = stream.getParticipantId();+ const remoteVideo = remoteVideos[id];- if (!remoteVideo)+ if (!remoteVideo) {return;+ }remoteVideo.addRemoteStreamElement(stream);// Make sure track's muted state is reflected- if (stream.getType() === "audio") {+ if (stream.getType() === 'audio') {this.onAudioMute(stream.getParticipantId(), stream.isMuted());} else {this.onVideoMute(stream.getParticipantId(), stream.isMuted());}},- onRemoteStreamRemoved (stream) {- let id = stream.getParticipantId();- let remoteVideo = remoteVideos[id];+ onRemoteStreamRemoved(stream) {+ const id = stream.getParticipantId();+ const remoteVideo = remoteVideos[id];+// Remote stream may be removed after participant left the conference.+if (remoteVideo) {remoteVideo.removeRemoteStreamElement(stream);}@@ -370,16 +358,18 @@ var VideoLayout = {* @param id the id for the remote video* @returns {String} the video type video or screen.*/- getRemoteVideoType (id) {- let smallVideo = VideoLayout.getSmallVideo(id);+ getRemoteVideoType(id) {+ const smallVideo = VideoLayout.getSmallVideo(id);++return smallVideo ? smallVideo.getVideoType() : null;},- isPinned (id) {+ isPinned(id) {return id === this.getPinnedId();},- getPinnedId () {+ getPinnedId() {const { id } = getPinnedParticipant(APP.store.getState()) || {};return id || null;@@ -402,25 +392,25 @@ var VideoLayout = {** @param id the identifier of the video thumbnail*/- handleVideoThumbClicked (id) {- var smallVideo = VideoLayout.getSmallVideo(id);+ handleVideoThumbClicked(id) {+ const smallVideo = VideoLayout.getSmallVideo(id);const pinnedId = this.getPinnedId();- if(pinnedId) {- var oldSmallVideo = VideoLayout.getSmallVideo(pinnedId);+ if (pinnedId) {+ const oldSmallVideo = VideoLayout.getSmallVideo(pinnedId);+if (oldSmallVideo && !interfaceConfig.filmStripOnly) {oldSmallVideo.focus(false);}}// Unpin if currently pinned.- if (pinnedId === id)- {+ if (pinnedId === id) {this.pinParticipant(null);// Enable the currently set dominant speaker.if (currentDominantSpeaker) {- if(smallVideo && smallVideo.hasVideo()) {+ if (smallVideo && smallVideo.hasVideo()) {this.updateLargeVideo(currentDominantSpeaker);}} else {@@ -452,13 +442,15 @@ var VideoLayout = {* @param {SmallVideo} smallVideo optional small video instance to add as a* remote video, if undefined <tt>RemoteVideo</tt> will be created*/- addParticipantContainer (user, smallVideo) {- let id = user.getId();+ addParticipantContainer(user, smallVideo) {+ const id = user.getId();let remoteVideo;- if(smallVideo)++ if (smallVideo) {remoteVideo = smallVideo;- else+ } else {remoteVideo = new RemoteVideo(user, VideoLayout, eventEmitter);+ }this._setRemoteControlProperties(user, remoteVideo);this.addRemoteVideoContainer(id, remoteVideo);@@ -486,7 +478,7 @@ var VideoLayout = {* @param {SmallVideo} smallVideo the small video instance to add as a* remote video*/- addRemoteVideoContainer (id, remoteVideo) {+ addRemoteVideoContainer(id, remoteVideo) {remoteVideos[id] = remoteVideo;if (!remoteVideo.getVideoType()) {@@ -504,7 +496,7 @@ var VideoLayout = {// FIXME: what does this do???remoteVideoActive(videoElement, resourceJid) {- logger.info(resourceJid + " video is now active", videoElement);+ logger.info(`${resourceJid} video is now active`, videoElement);VideoLayout.resizeThumbnails(false, false, () => {@@ -527,15 +519,16 @@ var VideoLayout = {_maybePlaceParticipantOnLargeVideo(resourceJid) {const pinnedId = this.getPinnedId();- if ((!pinnedId &&- !currentDominantSpeaker &&- this.isLargeContainerTypeVisible(VIDEO_CONTAINER_TYPE)) ||- pinnedId === resourceJid ||- (!pinnedId && resourceJid &&- currentDominantSpeaker === resourceJid) ||+ if ((!pinnedId+ && !currentDominantSpeaker+ && this.isLargeContainerTypeVisible(VIDEO_CONTAINER_TYPE))+ || pinnedId === resourceJid+ || (!pinnedId && resourceJid+ && currentDominantSpeaker === resourceJid)+/* Playback started while we're on the stage - may need to updatevideo source with the new stream */- this.isCurrentlyOnLarge(resourceJid)) {+ || this.isCurrentlyOnLarge(resourceJid)) {this.updateLargeVideo(resourceJid, true);}@@ -545,19 +538,22 @@ var VideoLayout = {* Shows a visual indicator for the moderator of the conference.* On local or remote participants.*/- showModeratorIndicator () {- let isModerator = APP.conference.isModerator;+ showModeratorIndicator() {+ const isModerator = APP.conference.isModerator;+if (isModerator) {localVideoThumbnail.addModeratorIndicator();} else {localVideoThumbnail.removeModeratorIndicator();}- APP.conference.listMembers().forEach(function (member) {- let id = member.getId();- let remoteVideo = remoteVideos[id];- if (!remoteVideo)+ APP.conference.listMembers().forEach(member => {+ const id = member.getId();+ const remoteVideo = remoteVideos[id];++ if (!remoteVideo) {return;+ }if (member.isModerator()) {remoteVideo.addModeratorIndicator();@@ -565,7 +561,7 @@ var VideoLayout = {if (isModerator) {// We are moderator, but user is not - add menu- if(!remoteVideo.hasRemoteVideoMenu) {+ if (!remoteVideo.hasRemoteVideoMenu) {remoteVideo.addRemoteVideoMenu();}}@@ -576,7 +572,7 @@ var VideoLayout = {* Shows or hides the audio muted indicator over the local thumbnail video.* @param {boolean} isMuted*/- showLocalAudioIndicator (isMuted) {+ showLocalAudioIndicator(isMuted) {localVideoThumbnail.showAudioIndicator(isMuted);},@@ -587,7 +583,7 @@ var VideoLayout = {* currently in the interrupted state or <tt>false</tt> if the connection* is fine.*/- showLocalConnectionInterrupted (isInterrupted) {+ showLocalConnectionInterrupted(isInterrupted) {// Currently local video thumbnail displays only "active" or// "interrupted" despite the fact that ConnectionIndicator supports more// states.@@ -611,24 +607,28 @@ var VideoLayout = {Filmstrip.resizeThumbnails(localVideo, remoteVideo,animate, forceUpdate)- .then(function () {- if (onComplete && typeof onComplete === "function")+ .then(() => {+ if (onComplete && typeof onComplete === 'function') {onComplete();+ }});- return { localVideo, remoteVideo };+ return { localVideo,+ remoteVideo };},/*** On audio muted event.*/- onAudioMute (id, isMuted) {+ onAudioMute(id, isMuted) {if (APP.conference.isLocalId(id)) {localVideoThumbnail.showAudioIndicator(isMuted);} else {- let remoteVideo = remoteVideos[id];- if (!remoteVideo)+ const remoteVideo = remoteVideos[id];++ if (!remoteVideo) {return;+ }remoteVideo.showAudioIndicator(isMuted);remoteVideo.updateRemoteVideoMenu(isMuted);@@ -638,13 +638,15 @@ var VideoLayout = {/*** On video muted event.*/- onVideoMute (id, value) {+ onVideoMute(id, value) {if (APP.conference.isLocalId(id)) {localVideoThumbnail.setVideoMutedView(value);} else {- let remoteVideo = remoteVideos[id];- if (remoteVideo)+ const remoteVideo = remoteVideos[id];++ if (remoteVideo) {remoteVideo.setVideoMutedView(value);+ }}if (this.isCurrentlyOnLarge(id)) {@@ -656,14 +658,16 @@ var VideoLayout = {/*** Display name changed.*/- onDisplayNameChanged (id, displayName, status) {- if (id === 'localVideoContainer' ||- APP.conference.isLocalId(id)) {+ onDisplayNameChanged(id, displayName, status) {+ if (id === 'localVideoContainer'+ || APP.conference.isLocalId(id)) {localVideoThumbnail.setDisplayName(displayName);} else {- let remoteVideo = remoteVideos[id];- if (remoteVideo)+ const remoteVideo = remoteVideos[id];++ if (remoteVideo) {remoteVideo.setDisplayName(displayName, status);+ }}},@@ -671,9 +675,10 @@ var VideoLayout = {* Sets the "raised hand" status for a participant identified by 'id'.*/setRaisedHandStatus(id, raisedHandStatus) {- var video+ const video= APP.conference.isLocalId(id)? localVideoThumbnail : remoteVideos[id];+if (video) {video.showRaisedHandIndicator(raisedHandStatus);if (raisedHandStatus) {@@ -685,25 +690,28 @@ var VideoLayout = {/*** On dominant speaker changed event.*/- onDominantSpeakerChanged (id) {+ onDominantSpeakerChanged(id) {if (id === currentDominantSpeaker) {return;}- let oldSpeakerRemoteVideo = remoteVideos[currentDominantSpeaker];+ const oldSpeakerRemoteVideo = remoteVideos[currentDominantSpeaker];+// We ignore local user events, but just unmark remote user as dominant// while we are talking+if (APP.conference.isLocalId(id)) {- if(oldSpeakerRemoteVideo)- {+ if (oldSpeakerRemoteVideo) {oldSpeakerRemoteVideo.showDominantSpeakerIndicator(false);currentDominantSpeaker = null;}localVideoThumbnail.showDominantSpeakerIndicator(true);+return;}- let remoteVideo = remoteVideos[id];+ const remoteVideo = remoteVideos[id];+if (!remoteVideo) {return;}@@ -736,7 +744,7 @@ var VideoLayout = {* @param {string} id the ID of the remote participant(MUC nickname)*/// eslint-disable-next-line no-unused-vars- onParticipantConnectionStatusChanged (id) {+ onParticipantConnectionStatusChanged(id) {// Show/hide warning on the large videoif (this.isCurrentlyOnLarge(id)) {if (largeVideo) {@@ -745,15 +753,17 @@ var VideoLayout = {this.updateLargeVideo(id, true /* force update */);}}+// Show/hide warning on the thumbnail- let remoteVideo = remoteVideos[id];+ const remoteVideo = remoteVideos[id];+if (remoteVideo) {// Updating only connection status indicator is not enough, because// when we the connection is restored while the avatar was displayed// (due to 'muted while disconnected' condition) we may want to show// the video stream again and in order to do that the display mode// must be updated.- //remoteVideo.updateConnectionStatusIndicator(isActive);+ // remoteVideo.updateConnectionStatusIndicator(isActive);remoteVideo.updateView();}},@@ -766,7 +776,7 @@ var VideoLayout = {* @param endpointsEnteringLastN the list currently entering last N* endpoints*/- onLastNEndpointsChanged (endpointsLeavingLastN, endpointsEnteringLastN) {+ onLastNEndpointsChanged(endpointsLeavingLastN, endpointsEnteringLastN) {if (endpointsLeavingLastN) {endpointsLeavingLastN.forEach(this._updateRemoteVideo, this);}@@ -783,6 +793,7 @@ var VideoLayout = {*/_updateRemoteVideo(id) {const remoteVideo = remoteVideos[id];+if (remoteVideo) {remoteVideo.updateView();if (remoteVideo.isCurrentlyOnLargeVideo()) {@@ -795,60 +806,67 @@ var VideoLayout = {* Hides the connection indicator* @param id*/- hideConnectionIndicator (id) {- let remoteVideo = remoteVideos[id];- if (remoteVideo)+ hideConnectionIndicator(id) {+ const remoteVideo = remoteVideos[id];++ if (remoteVideo) {remoteVideo.removeConnectionIndicator();+ }},/*** Hides all the indicators*/- hideStats () {- for (var video in remoteVideos) {- let remoteVideo = remoteVideos[video];- if (remoteVideo)+ hideStats() {+ for (const video in remoteVideos) { // eslint-disable-line guard-for-in+ const remoteVideo = remoteVideos[video];++ if (remoteVideo) {remoteVideo.removeConnectionIndicator();+ }}localVideoThumbnail.removeConnectionIndicator();},- removeParticipantContainer (id) {+ removeParticipantContainer(id) {// Unlock large videoif (this.getPinnedId() === id) {- logger.info("Focused video owner has left the conference");+ logger.info('Focused video owner has left the conference');this.pinParticipant(null);}if (currentDominantSpeaker === id) {- logger.info("Dominant speaker has left the conference");+ logger.info('Dominant speaker has left the conference');currentDominantSpeaker = null;}- var remoteVideo = remoteVideos[id];+ const remoteVideo = remoteVideos[id];+if (remoteVideo) {// Remove remote video- logger.info("Removing remote video: " + id);+ logger.info(`Removing remote video: ${id}`);delete remoteVideos[id];remoteVideo.remove();} else {- logger.warn("No remote video for " + id);+ logger.warn(`No remote video for ${id}`);}VideoLayout.resizeThumbnails();},- onVideoTypeChanged (id, newVideoType) {+ onVideoTypeChanged(id, newVideoType) {if (VideoLayout.getRemoteVideoType(id) === newVideoType) {return;}- logger.info("Peer video type changed: ", id, newVideoType);+ logger.info('Peer video type changed: ', id, newVideoType);++ let smallVideo;- var smallVideo;if (APP.conference.isLocalId(id)) {if (!localVideoThumbnail) {- logger.warn("Local video not ready yet");+ logger.warn('Local video not ready yet');+return;}smallVideo = localVideoThumbnail;@@ -881,8 +899,8 @@ var VideoLayout = {}// Calculate available width and height.- let availableHeight = window.innerHeight;- let availableWidth = UIUtil.getAvailableVideoWidth();+ const availableHeight = window.innerHeight;+ const availableWidth = UIUtil.getAvailableVideoWidth();if (availableWidth < 0 || availableHeight < 0) {return;@@ -903,21 +921,23 @@ var VideoLayout = {});},- getSmallVideo (id) {+ getSmallVideo(id) {if (APP.conference.isLocalId(id)) {return localVideoThumbnail;- } else {- return remoteVideos[id];}++ return remoteVideos[id];+},- changeUserAvatar (id, avatarUrl) {- var smallVideo = VideoLayout.getSmallVideo(id);+ changeUserAvatar(id, avatarUrl) {+ const smallVideo = VideoLayout.getSmallVideo(id);+if (smallVideo) {smallVideo.avatarChanged(avatarUrl);} else {logger.warn(- "Missed avatar update - no small video yet for " + id+ `Missed avatar update - no small video yet for ${id}`);}if (this.isCurrentlyOnLarge(id)) {@@ -928,7 +948,7 @@ var VideoLayout = {/*** Indicates that the video has been interrupted.*/- onVideoInterrupted () {+ onVideoInterrupted() {if (largeVideo) {largeVideo.onVideoInterrupted();}@@ -937,13 +957,13 @@ var VideoLayout = {/*** Indicates that the video has been restored.*/- onVideoRestored () {+ onVideoRestored() {if (largeVideo) {largeVideo.onVideoRestored();}},- isLargeVideoVisible () {+ isLargeVideoVisible() {return this.isLargeContainerTypeVisible(VIDEO_CONTAINER_TYPE);},@@ -951,11 +971,11 @@ var VideoLayout = {* @return {LargeContainer} the currently displayed container on large* video.*/- getCurrentlyOnLargeContainer () {+ getCurrentlyOnLargeContainer() {return largeVideo.getCurrentContainer();},- isCurrentlyOnLarge (id) {+ isCurrentlyOnLarge(id) {return largeVideo && largeVideo.id === id;},@@ -977,7 +997,7 @@ var VideoLayout = {});},- updateLargeVideo (id, forceUpdate) {+ updateLargeVideo(id, forceUpdate) {if (!largeVideo) {return;}@@ -998,91 +1018,103 @@ var VideoLayout = {// FIXME it might be possible to get rid of 'forceUpdate' argumentif (currentStreamId !== newStreamId) {logger.debug('Enforcing large video update for stream change');- forceUpdate = true;+ forceUpdate = true; // eslint-disable-line no-param-reassign}}if (!isOnLarge || forceUpdate) {- let videoType = this.getRemoteVideoType(id);+ const videoType = this.getRemoteVideoType(id);+// FIXME video type is not the same thing as container type+if (id !== currentId && videoType === VIDEO_CONTAINER_TYPE) {eventEmitter.emit(UIEvents.SELECTED_ENDPOINT, id);}let oldSmallVideo;+if (currentId) {oldSmallVideo = this.getSmallVideo(currentId);}smallVideo.waitForResolutionChange();- if (oldSmallVideo)+ if (oldSmallVideo) {oldSmallVideo.waitForResolutionChange();+ }largeVideo.updateLargeVideo(id,smallVideo.videoStream,videoType- ).then(function() {+ ).then(() => {// update current small video and the old onesmallVideo.updateView();oldSmallVideo && oldSmallVideo.updateView();- }, function () {+ }, () => {// use clicked other video during update, nothing to do.});} else if (currentId) {- let currentSmallVideo = this.getSmallVideo(currentId);+ const currentSmallVideo = this.getSmallVideo(currentId);+currentSmallVideo.updateView();}},- addLargeVideoContainer (type, container) {+ addLargeVideoContainer(type, container) {largeVideo && largeVideo.addContainer(type, container);},- removeLargeVideoContainer (type) {+ removeLargeVideoContainer(type) {largeVideo && largeVideo.removeContainer(type);},/*** @returns Promise*/- showLargeVideoContainer (type, show) {+ showLargeVideoContainer(type, show) {if (!largeVideo) {return Promise.reject();}- let isVisible = this.isLargeContainerTypeVisible(type);+ const isVisible = this.isLargeContainerTypeVisible(type);+if (isVisible === show) {return Promise.resolve();}- let currentId = largeVideo.id;- if(currentId) {- var oldSmallVideo = this.getSmallVideo(currentId);+ const currentId = largeVideo.id;+ let oldSmallVideo;++ if (currentId) {+ oldSmallVideo = this.getSmallVideo(currentId);}let containerTypeToShow = type;+// if we are hiding a container and there is focusedVideo// (pinned remote video) use its video type,// if not then use default type - large video+if (!show) {const pinnedId = this.getPinnedId();- if(pinnedId)+ if (pinnedId) {containerTypeToShow = this.getRemoteVideoType(pinnedId);- else+ } else {containerTypeToShow = VIDEO_CONTAINER_TYPE;+ }}return largeVideo.showContainer(containerTypeToShow).then(() => {- if(oldSmallVideo)+ if (oldSmallVideo) {oldSmallVideo && oldSmallVideo.updateView();+ }});},- isLargeContainerTypeVisible (type) {+ isLargeContainerTypeVisible(type) {return largeVideo && largeVideo.state === type;},@@ -1090,7 +1122,7 @@ var VideoLayout = {* Returns the id of the current video shown on large.* Currently used by tests (torture).*/- getLargeVideoID () {+ getLargeVideoID() {return largeVideo.id;},@@ -1098,7 +1130,7 @@ var VideoLayout = {* Returns the the current video shown on large.* Currently used by tests (torture).*/- getLargeVideo () {+ getLargeVideo() {return largeVideo;},@@ -1106,17 +1138,19 @@ var VideoLayout = {* Sets the flipX state of the local video.* @param {boolean} true for flipped otherwise false;*/- setLocalFlipX (val) {+ setLocalFlipX(val) {this.localFlipX = val;},- getEventEmitter() {return eventEmitter;},+ getEventEmitter() {+ return eventEmitter;+ },/*** Handles user's features changes.*/- onUserFeaturesChanged (user) {- let video = this.getSmallVideo(user.getId());+ onUserFeaturesChanged(user) {+ const video = this.getSmallVideo(user.getId());if (!video) {return;@@ -1132,7 +1166,7 @@ var VideoLayout = {* @param {RemoteVideo} remoteVideo the remoteVideo on which the properties* will be set.*/- _setRemoteControlProperties (user, remoteVideo) {+ _setRemoteControlProperties(user, remoteVideo) {APP.remoteControl.checkUserRemoteControlSupport(user).then(result =>remoteVideo.setRemoteControlSupport(result));},@@ -1153,6 +1187,7 @@ var VideoLayout = {getRemoteVideosCount() {return Object.keys(remoteVideos).length;},+/*** Sets the remote control active status for a remote participant.*@@ -1176,4 +1211,40 @@ var VideoLayout = {}};+/**+ * On contact list item clicked.+ */+function onContactClicked(id) {+ if (APP.conference.isLocalId(id)) {+ $('#localVideoContainer').click();++ return;+ }++ const remoteVideo = remoteVideos[id];++ if (remoteVideo && remoteVideo.hasVideo()) {+ // It is not always the case that a videoThumb exists (if there is+ // no actual video).+ if (remoteVideo.hasVideoStarted()) {+ // We have a video src, great! Let's update the large video+ // now.+ VideoLayout.handleVideoThumbClicked(id);+ } else {++ // If we don't have a video src for jid, there's absolutely+ // no point in calling handleVideoThumbClicked; Quite+ // simply, it won't work because it needs an src to attach+ // to the large video.+ //+ // Instead, we trigger the pinned endpoint changed event to+ // let the bridge adjust its lastN set for myjid and store+ // the pinned user in the lastNPickupId variable to be+ // picked up later by the lastN changed event handler.+ // eslint-disable-next-line no-invalid-this+ this.pinParticipant(remoteVideo.id);+ }+ }+}+export default VideoLayout;diff --git a/modules/URL/ConferenceUrl.js b/modules/URL/ConferenceUrl.jsindex 45c4b947de..c34de391c0 100644--- a/modules/URL/ConferenceUrl.js+++ b/modules/URL/ConferenceUrl.js@@ -1,4 +1,4 @@-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);/*** The modules stores information about the URL used to start the conference and@@ -24,9 +24,9 @@ export default class ConferenceUrl {* from the sample URL.*/constructor(location) {- logger.info("Stored original conference URL: " + location.href);+ logger.info(`Stored original conference URL: ${location.href}`);logger.info(- "Conference URL for invites: " + location.protocol + "//"- + location.host + location.pathname);+ `Conference URL for invites: ${location.protocol}//${+ location.host}${location.pathname}`);}}diff --git a/modules/devices/mediaDeviceHelper.js b/modules/devices/mediaDeviceHelper.jsindex d5225d1b45..9de55db83e 100644--- a/modules/devices/mediaDeviceHelper.js+++ b/modules/devices/mediaDeviceHelper.js@@ -1,8 +1,8 @@/* global APP, JitsiMeetJS */let currentAudioInputDevices,- currentVideoInputDevices,- currentAudioOutputDevices;+ currentAudioOutputDevices,+ currentVideoInputDevices;/*** Determines if currently selected audio output device should be changed after@@ -16,14 +16,14 @@ function getNewAudioOutputDevice(newDevices) {return;}- let selectedAudioOutputDeviceId = APP.settings.getAudioOutputDeviceId();- let availableAudioOutputDevices = newDevices.filter(+ const selectedAudioOutputDeviceId = APP.settings.getAudioOutputDeviceId();+ const availableAudioOutputDevices = newDevices.filter(d => d.kind === 'audiooutput');// Switch to 'default' audio output device if we don't have the selected one// available anymore.- if (selectedAudioOutputDeviceId !== 'default' &&- !availableAudioOutputDevices.find(d =>+ if (selectedAudioOutputDeviceId !== 'default'+ && !availableAudioOutputDevices.find(d =>d.deviceId === selectedAudioOutputDeviceId)) {return 'default';}@@ -38,10 +38,10 @@ function getNewAudioOutputDevice(newDevices) {* if audio input device should not be changed.*/function getNewAudioInputDevice(newDevices, localAudio) {- let availableAudioInputDevices = newDevices.filter(+ const availableAudioInputDevices = newDevices.filter(d => d.kind === 'audioinput');- let selectedAudioInputDeviceId = APP.settings.getMicDeviceId();- let selectedAudioInputDevice = availableAudioInputDevices.find(+ const selectedAudioInputDeviceId = APP.settings.getMicDeviceId();+ const selectedAudioInputDevice = availableAudioInputDevices.find(d => d.deviceId === selectedAudioInputDeviceId);// Here we handle case when no device was initially plugged, but@@ -51,18 +51,17 @@ function getNewAudioInputDevice(newDevices, localAudio) {// If we have new audio device and permission to use it was granted// (label is not an empty string), then we will try to use the first// available device.- if (availableAudioInputDevices.length &&- availableAudioInputDevices[0].label !== '') {+ if (availableAudioInputDevices.length+ && availableAudioInputDevices[0].label !== '') {return availableAudioInputDevices[0].deviceId;}- } else {+ } else if (selectedAudioInputDevice+ && selectedAudioInputDeviceId !== localAudio.getDeviceId()) {+// And here we handle case when we already have some device working,// but we plug-in a "preferred" (previously selected in settings, stored// in local storage) device.- if (selectedAudioInputDevice &&- selectedAudioInputDeviceId !== localAudio.getDeviceId()) {- return selectedAudioInputDeviceId;- }+ return selectedAudioInputDeviceId;}}@@ -75,10 +74,10 @@ function getNewAudioInputDevice(newDevices, localAudio) {* if video input device should not be changed.*/function getNewVideoInputDevice(newDevices, localVideo) {- let availableVideoInputDevices = newDevices.filter(+ const availableVideoInputDevices = newDevices.filter(d => d.kind === 'videoinput');- let selectedVideoInputDeviceId = APP.settings.getCameraDeviceId();- let selectedVideoInputDevice = availableVideoInputDevices.find(+ const selectedVideoInputDeviceId = APP.settings.getCameraDeviceId();+ const selectedVideoInputDevice = availableVideoInputDevices.find(d => d.deviceId === selectedVideoInputDeviceId);// Here we handle case when no video input device was initially plugged,@@ -88,18 +87,16 @@ function getNewVideoInputDevice(newDevices, localVideo) {// If we have new video device and permission to use it was granted// (label is not an empty string), then we will try to use the first// available device.- if (availableVideoInputDevices.length &&- availableVideoInputDevices[0].label !== '') {+ if (availableVideoInputDevices.length+ && availableVideoInputDevices[0].label !== '') {return availableVideoInputDevices[0].deviceId;}- } else {+ } else if (selectedVideoInputDevice+ && selectedVideoInputDeviceId !== localVideo.getDeviceId()) {// And here we handle case when we already have some device working,// but we plug-in a "preferred" (previously selected in settings, stored// in local storage) device.- if (selectedVideoInputDevice &&- selectedVideoInputDeviceId !== localVideo.getDeviceId()) {- return selectedVideoInputDeviceId;- }+ return selectedVideoInputDeviceId;}}@@ -113,19 +110,21 @@ export default {getDevicesFromListByKind(devices, kind) {return devices.filter(d => d.kind === kind);},+/*** Stores lists of current 'audioinput', 'videoinput' and 'audiooutput'* devices.* @param {MediaDeviceInfo[]} devices*/setCurrentMediaDevices(devices) {- currentAudioInputDevices =- this.getDevicesFromListByKind(devices, 'audioinput');- currentVideoInputDevices =- this.getDevicesFromListByKind(devices, 'videoinput');- currentAudioOutputDevices =- this.getDevicesFromListByKind(devices, 'audiooutput');+ currentAudioInputDevices+ = this.getDevicesFromListByKind(devices, 'audioinput');+ currentVideoInputDevices+ = this.getDevicesFromListByKind(devices, 'videoinput');+ currentAudioOutputDevices+ = this.getDevicesFromListByKind(devices, 'audiooutput');},+/*** Returns lists of current 'audioinput', 'videoinput' and 'audiooutput'* devices.@@ -142,6 +141,7 @@ export default {audiooutput: currentAudioOutputDevices};},+/*** Determines if currently selected media devices should be changed after* list of available devices has been changed.@@ -155,18 +155,19 @@ export default {* audiooutput: (string|undefined)* }}*/- getNewMediaDevicesAfterDeviceListChanged(+ getNewMediaDevicesAfterDeviceListChanged( // eslint-disable-line max-paramsnewDevices,isSharingScreen,localVideo,localAudio) {return {audioinput: getNewAudioInputDevice(newDevices, localAudio),- videoinput: !isSharingScreen &&- getNewVideoInputDevice(newDevices, localVideo),+ videoinput: !isSharingScreen+ && getNewVideoInputDevice(newDevices, localVideo),audiooutput: getNewAudioOutputDevice(newDevices)};},+/*** Tries to create new local tracks for new devices obtained after device* list changed. Shows error dialog in case of failures.@@ -181,21 +182,22 @@ export default {micDeviceId) {let audioTrackError;let videoTrackError;- let audioRequested = !!micDeviceId;- let videoRequested = !!cameraDeviceId;+ const audioRequested = Boolean(micDeviceId);+ const videoRequested = Boolean(cameraDeviceId);if (audioRequested && videoRequested) {// First we try to create both audio and video tracks together.return (createLocalTracks({- devices: ['audio', 'video'],- cameraDeviceId: cameraDeviceId,- micDeviceId: micDeviceId+ devices: [ 'audio', 'video' ],+ cameraDeviceId,+ micDeviceId})+// If we fail to do this, try to create them separately..catch(() => Promise.all([- createAudioTrack(false).then(([stream]) => stream),- createVideoTrack(false).then(([stream]) => stream)+ createAudioTrack(false).then(([ stream ]) => stream),+ createVideoTrack(false).then(([ stream ]) => stream)])).then(tracks => {if (audioTrackError) {@@ -212,34 +214,42 @@ export default {return createVideoTrack();} else if (audioRequested && !videoRequested) {return createAudioTrack();- } else {- return Promise.resolve([]);}+ return Promise.resolve([]);++ /**+ *+ */function createAudioTrack(showError) {return (createLocalTracks({- devices: ['audio'],+ devices: [ 'audio' ],cameraDeviceId: null,- micDeviceId: micDeviceId+ micDeviceId}).catch(err => {audioTrackError = err;showError && APP.UI.showMicErrorNotification(err);+return [];}));}+ /**+ *+ */function createVideoTrack(showError) {return (createLocalTracks({- devices: ['video'],- cameraDeviceId: cameraDeviceId,+ devices: [ 'video' ],+ cameraDeviceId,micDeviceId: null}).catch(err => {videoTrackError = err;showError && APP.UI.showCameraErrorNotification(err);+return [];}));}diff --git a/modules/keyboardshortcut/keyboardshortcut.js b/modules/keyboardshortcut/keyboardshortcut.jsindex 6912ec07b8..4ff4fa959b 100644--- a/modules/keyboardshortcut/keyboardshortcut.js+++ b/modules/keyboardshortcut/keyboardshortcut.js@@ -11,47 +11,6 @@ const logger = require('jitsi-meet-logger').getLogger(__filename);*/let keyboardShortcutDialog = null;-/**- * Initialise global shortcuts.- * Global shortcuts are shortcuts for features that don't have a button or- * link associated with the action. In other words they represent actions- * triggered _only_ with a shortcut.- */-function initGlobalShortcuts() {- KeyboardShortcut.registerShortcut("ESCAPE", null, function() {- showKeyboardShortcutsPanel(false);- });-- KeyboardShortcut.registerShortcut("?", null, function() {- sendEvent("shortcut.shortcut.help");- showKeyboardShortcutsPanel(true);- }, "keyboardShortcuts.toggleShortcuts");-- // register SPACE shortcut in two steps to insure visibility of help message- KeyboardShortcut.registerShortcut(" ", null, function() {- sendEvent("shortcut.talk.clicked");- logger.log('Talk shortcut pressed');- APP.conference.muteAudio(true);- });- KeyboardShortcut._addShortcutToHelp("SPACE","keyboardShortcuts.pushToTalk");-- if(!interfaceConfig.filmStripOnly) {- KeyboardShortcut.registerShortcut("T", null, () => {- sendEvent("shortcut.speakerStats.clicked");- APP.store.dispatch(toggleDialog(SpeakerStats, {- conference: APP.conference- }));- }, "keyboardShortcuts.showSpeakerStats");- }-- /**- * FIXME: Currently focus keys are directly implemented below in onkeyup.- * They should be moved to the SmallVideo instead.- */- KeyboardShortcut._addShortcutToHelp("0", "keyboardShortcuts.focusLocal");- KeyboardShortcut._addShortcutToHelp("1-9", "keyboardShortcuts.focusRemote");-}-/*** Shows or hides the keyboard shortcuts dialog.* @param {boolean} show whether to show or hide the dialog@@ -60,8 +19,8 @@ function showKeyboardShortcutsPanel(show) {if (show&& !APP.UI.messageHandler.isDialogOpened()&& keyboardShortcutDialog === null) {- let msg = $('#keyboard-shortcuts').html();- let buttons = { Close: true };+ const msg = $('#keyboard-shortcuts').html();+ const buttons = { Close: true };keyboardShortcutDialog = APP.UI.messageHandler.openDialog('keyboardShortcuts.keyboardShortcuts', msg, true, buttons);@@ -75,7 +34,7 @@ function showKeyboardShortcutsPanel(show) {* Map of shortcuts. When a shortcut is registered it enters the mapping.* @type {{}}*/-let _shortcuts = {};+const _shortcuts = {};/*** True if the keyboard shortcuts are enabled and false if not.@@ -87,43 +46,42 @@ let enabled = true;* Maps keycode to character, id of popover for given function and function.*/const KeyboardShortcut = {- init: function () {- initGlobalShortcuts();+ init() {+ this._initGlobalShortcuts();- var self = this;- window.onkeyup = function(e) {- if(!enabled) {+ window.onkeyup = e => {+ if (!enabled) {return;}- var key = self._getKeyboardKey(e).toUpperCase();- var num = parseInt(key, 10);- if(!($(":focus").is("input[type=text]") ||- $(":focus").is("input[type=password]") ||- $(":focus").is("textarea"))) {+ const key = this._getKeyboardKey(e).toUpperCase();+ const num = parseInt(key, 10);++ if (!($(':focus').is('input[type=text]')+ || $(':focus').is('input[type=password]')+ || $(':focus').is('textarea'))) {if (_shortcuts.hasOwnProperty(key)) {_shortcuts[key].function(e);- }- else if (!isNaN(num) && num >= 0 && num <= 9) {+ } else if (!isNaN(num) && num >= 0 && num <= 9) {APP.UI.clickOnVideo(num);}- //esc while the smileys are visible hides them- } else if (key === "ESCAPE" &&- $('#smileysContainer').is(':visible')) {++ // esc while the smileys are visible hides them+ } else if (key === 'ESCAPE'+ && $('#smileysContainer').is(':visible')) {APP.UI.toggleSmileys();}};- window.onkeydown = function(e) {- if(!enabled) {+ window.onkeydown = e => {+ if (!enabled) {return;}- if(!($(":focus").is("input[type=text]") ||- $(":focus").is("input[type=password]") ||- $(":focus").is("textarea"))) {- var key = self._getKeyboardKey(e).toUpperCase();- if(key === " ") {- if(APP.conference.isLocalAudioMuted()) {- sendEvent("shortcut.talk.released");+ if (!($(':focus').is('input[type=text]')+ || $(':focus').is('input[type=password]')+ || $(':focus').is('textarea'))) {+ if (this._getKeyboardKey(e).toUpperCase() === ' ') {+ if (APP.conference.isLocalAudioMuted()) {+ sendEvent('shortcut.talk.released');logger.log('Talk shortcut released');APP.conference.muteAudio(false);}@@ -136,7 +94,7 @@ const KeyboardShortcut = {* Enables/Disables the keyboard shortcuts.* @param {boolean} value - the new value.*/- enable: function (value) {+ enable(value) {enabled = value;},@@ -151,19 +109,20 @@ const KeyboardShortcut = {* @param helpDescription the description of the shortcut that would appear* in the help menu*/- registerShortcut(+ registerShortcut(// eslint-disable-line max-paramsshortcutChar,shortcutAttr,exec,helpDescription) {_shortcuts[shortcutChar] = {character: shortcutChar,- shortcutAttr: shortcutAttr,+ shortcutAttr,function: exec};- if (helpDescription)+ if (helpDescription) {this._addShortcutToHelp(shortcutChar, helpDescription);+ }},/**@@ -172,7 +131,7 @@ const KeyboardShortcut = {* @param shortcutChar unregisters the given shortcut, which means it will* no longer be usable*/- unregisterShortcut: function(shortcutChar) {+ unregisterShortcut(shortcutChar) {_shortcuts.remove(shortcutChar);this._removeShortcutFromHelp(shortcutChar);@@ -186,44 +145,47 @@ const KeyboardShortcut = {* or an empty string if the shortcutAttr is null, an empty string or not* found in the shortcut mapping*/- getShortcutTooltip: function (shortcutAttr) {- if (typeof shortcutAttr === "string" && shortcutAttr.length > 0) {- for (var key in _shortcuts) {+ getShortcutTooltip(shortcutAttr) {+ if (typeof shortcutAttr === 'string' && shortcutAttr.length > 0) {+ for (const key in _shortcuts) {if (_shortcuts.hasOwnProperty(key)&& _shortcuts[key].shortcutAttr&& _shortcuts[key].shortcutAttr === shortcutAttr) {- return " (" + _shortcuts[key].character + ")";+ return ` (${_shortcuts[key].character})`;}}}- return "";+ return '';},+/*** @param e a KeyboardEvent* @returns {string} e.key or something close if not supported*/- _getKeyboardKey: function (e) {- if (typeof e.key === "string") {+ _getKeyboardKey(e) {+ if (typeof e.key === 'string') {return e.key;}- if (e.type === "keypress"+ if (e.type === 'keypress'&& ((e.which >= 32 && e.which <= 126)- || (e.which >= 160 && e.which <= 255) )) {+ || (e.which >= 160 && e.which <= 255))) {return String.fromCharCode(e.which);}+// try to fallback (0-9A-Za-z and QWERTY keyboard)switch (e.which) {case 27:- return "Escape";+ return 'Escape';case 191:- return e.shiftKey ? "?" : "/";+ return e.shiftKey ? '?' : '/';}- if (e.shiftKey || e.type === "keypress") {+ if (e.shiftKey || e.type === 'keypress') {return String.fromCharCode(e.which);- } else {- return String.fromCharCode(e.which).toLowerCase();}++ return String.fromCharCode(e.which).toLowerCase();+},/**@@ -233,36 +195,41 @@ const KeyboardShortcut = {* @param shortcutDescriptionKey the description of the shortcut* @private*/- _addShortcutToHelp: function (shortcutChar, shortcutDescriptionKey) {+ _addShortcutToHelp(shortcutChar, shortcutDescriptionKey) {++ const listElement = document.createElement('li');+ const itemClass = 'shortcuts-list__item';- let listElement = document.createElement("li");- let itemClass = 'shortcuts-list__item';listElement.className = itemClass;listElement.id = shortcutChar;- let spanElement = document.createElement("span");- spanElement.className = "item-action";+ const spanElement = document.createElement('span');++ spanElement.className = 'item-action';++ const kbdElement = document.createElement('kbd');+ const classes = 'aui-label regular-key';- let kbdElement = document.createElement("kbd");- let classes = 'aui-label regular-key';kbdElement.className = classes;kbdElement.innerHTML = shortcutChar;spanElement.appendChild(kbdElement);- let descriptionElement = document.createElement("span");- let descriptionClass = "shortcuts-list__description";+ const descriptionElement = document.createElement('span');+ const descriptionClass = 'shortcuts-list__description';+descriptionElement.className = descriptionClass;- descriptionElement.setAttribute("data-i18n", shortcutDescriptionKey);+ descriptionElement.setAttribute('data-i18n', shortcutDescriptionKey);APP.translation.translateElement($(descriptionElement));listElement.appendChild(spanElement);listElement.appendChild(descriptionElement);- let parentListElement- = document.getElementById("keyboard-shortcuts-list");+ const parentListElement+ = document.getElementById('keyboard-shortcuts-list');- if (parentListElement)+ if (parentListElement) {parentListElement.appendChild(listElement);+ }},/**@@ -270,14 +237,57 @@ const KeyboardShortcut = {* help dialog* @private*/- _removeShortcutFromHelp: function (shortcutChar) {- var parentListElement- = document.getElementById("keyboard-shortcuts-list");+ _removeShortcutFromHelp(shortcutChar) {+ const parentListElement+ = document.getElementById('keyboard-shortcuts-list');- var shortcutElement = document.getElementById(shortcutChar);+ const shortcutElement = document.getElementById(shortcutChar);- if (shortcutElement)+ if (shortcutElement) {parentListElement.removeChild(shortcutElement);+ }+ },++ /**+ * Initialise global shortcuts.+ * Global shortcuts are shortcuts for features that don't have a button or+ * link associated with the action. In other words they represent actions+ * triggered _only_ with a shortcut.+ */+ _initGlobalShortcuts() {+ this.registerShortcut('ESCAPE', null, () => {+ showKeyboardShortcutsPanel(false);+ });++ this.registerShortcut('?', null, () => {+ sendEvent('shortcut.shortcut.help');+ showKeyboardShortcutsPanel(true);+ }, 'keyboardShortcuts.toggleShortcuts');++ // register SPACE shortcut in two steps to insure visibility of help+ // message+ this.registerShortcut(' ', null, () => {+ sendEvent('shortcut.talk.clicked');+ logger.log('Talk shortcut pressed');+ APP.conference.muteAudio(true);+ });+ this._addShortcutToHelp('SPACE', 'keyboardShortcuts.pushToTalk');++ if (!interfaceConfig.filmStripOnly) {+ this.registerShortcut('T', null, () => {+ sendEvent('shortcut.speakerStats.clicked');+ APP.store.dispatch(toggleDialog(SpeakerStats, {+ conference: APP.conference+ }));+ }, 'keyboardShortcuts.showSpeakerStats');+ }++ /**+ * FIXME: Currently focus keys are directly implemented below in+ * onkeyup. They should be moved to the SmallVideo instead.+ */+ this._addShortcutToHelp('0', 'keyboardShortcuts.focusLocal');+ this._addShortcutToHelp('1-9', 'keyboardShortcuts.focusRemote');}};diff --git a/modules/keycode/keycode.js b/modules/keycode/keycode.jsindex 38c6e0348e..756f4487bd 100644--- a/modules/keycode/keycode.js+++ b/modules/keycode/keycode.js@@ -5,74 +5,76 @@* @enum {string}*/export const KEYS = {- BACKSPACE: "backspace" ,- DELETE : "delete",- RETURN : "enter",- TAB : "tab",- ESCAPE : "escape",- UP : "up",- DOWN : "down",- RIGHT : "right",- LEFT : "left",- HOME : "home",- END : "end",- PAGEUP : "pageup",- PAGEDOWN : "pagedown",+ BACKSPACE: 'backspace',+ DELETE: 'delete',+ RETURN: 'enter',+ TAB: 'tab',+ ESCAPE: 'escape',+ UP: 'up',+ DOWN: 'down',+ RIGHT: 'right',+ LEFT: 'left',+ HOME: 'home',+ END: 'end',+ PAGEUP: 'pageup',+ PAGEDOWN: 'pagedown',- F1 : "f1",- F2 : "f2",- F3 : "f3",- F4 : "f4",- F5 : "f5",- F6 : "f6",- F7 : "f7",- F8 : "f8",- F9 : "f9",- F10 : "f10",- F11 : "f11",- F12 : "f12",- META : "command",- CMD_L: "command",- CMD_R: "command",- ALT : "alt",- CONTROL : "control",- SHIFT : "shift",- CAPS_LOCK: "caps_lock", //not supported by robotjs- SPACE : "space",- PRINTSCREEN : "printscreen",- INSERT : "insert",+ F1: 'f1',+ F2: 'f2',+ F3: 'f3',+ F4: 'f4',+ F5: 'f5',+ F6: 'f6',+ F7: 'f7',+ F8: 'f8',+ F9: 'f9',+ F10: 'f10',+ F11: 'f11',+ F12: 'f12',+ META: 'command',+ CMD_L: 'command',+ CMD_R: 'command',+ ALT: 'alt',+ CONTROL: 'control',+ SHIFT: 'shift',+ CAPS_LOCK: 'caps_lock', // not supported by robotjs+ SPACE: 'space',+ PRINTSCREEN: 'printscreen',+ INSERT: 'insert',- NUMPAD_0 : "numpad_0",- NUMPAD_1 : "numpad_1",- NUMPAD_2 : "numpad_2",- NUMPAD_3 : "numpad_3",- NUMPAD_4 : "numpad_4",- NUMPAD_5 : "numpad_5",- NUMPAD_6 : "numpad_6",- NUMPAD_7 : "numpad_7",- NUMPAD_8 : "numpad_8",- NUMPAD_9 : "numpad_9",+ NUMPAD_0: 'numpad_0',+ NUMPAD_1: 'numpad_1',+ NUMPAD_2: 'numpad_2',+ NUMPAD_3: 'numpad_3',+ NUMPAD_4: 'numpad_4',+ NUMPAD_5: 'numpad_5',+ NUMPAD_6: 'numpad_6',+ NUMPAD_7: 'numpad_7',+ NUMPAD_8: 'numpad_8',+ NUMPAD_9: 'numpad_9',- COMMA: ",",+ COMMA: ',',- PERIOD: ".",- SEMICOLON: ";",- QUOTE: "'",- BRACKET_LEFT: "[",- BRACKET_RIGHT: "]",- BACKQUOTE: "`",- BACKSLASH: "\\",- MINUS: "-",- EQUAL: "=",- SLASH: "/"+ PERIOD: '.',+ SEMICOLON: ';',+ QUOTE: '\'',+ BRACKET_LEFT: '[',+ BRACKET_RIGHT: ']',+ BACKQUOTE: '`',+ BACKSLASH: '\\',+ MINUS: '-',+ EQUAL: '=',+ SLASH: '/'};+/* eslint-disable max-len *//*** Mapping between the key codes and keys deined in KEYS.* The mappings are based on* https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#Specifications*/-let keyCodeToKey = {+/* eslint-enable max-len */+const keyCodeToKey = {8: KEYS.BACKSPACE,9: KEYS.TAB,13: KEYS.RETURN,@@ -141,15 +143,16 @@ let keyCodeToKey = {/*** Generate codes for digit keys (0-9)*/-for(let i = 0; i < 10; i++) {+for (let i = 0; i < 10; i++) {keyCodeToKey[i + 48] = `${i}`;}/*** Generate codes for letter keys (a-z)*/-for(let i = 0; i < 26; i++) {- let keyCode = i + 65;+for (let i = 0; i < 26; i++) {+ const keyCode = i + 65;+keyCodeToKey[keyCode] = String.fromCharCode(keyCode).toLowerCase();}diff --git a/modules/recorder/Recorder.js b/modules/recorder/Recorder.jsindex 3c531df399..d930dbf55e 100644--- a/modules/recorder/Recorder.js+++ b/modules/recorder/Recorder.js@@ -3,16 +3,20 @@/*** The (name of the) command which transports the recorder info.*/-const _USER_INFO_COMMAND = "userinfo";+const _USER_INFO_COMMAND = 'userinfo';/*** The Recorder class is meant to take care of recorder related presence* commands.*/class Recorder {+ /**+ * Creates new recorder instance.+ */constructor() {- if (config.iAmRecorder)+ if (config.iAmRecorder) {this._sendRecorderInfo();+ }}/**@@ -20,7 +24,7 @@ class Recorder {* @private*/_sendRecorderInfo() {- var commands = APP.conference.commands;+ const commands = APP.conference.commands;// XXX The "Follow Me" command represents a snapshot of all states// which are to be followed so don't forget to removeCommand beforediff --git a/modules/settings/Settings.js b/modules/settings/Settings.jsindex 5f422c4899..c3ff853374 100644--- a/modules/settings/Settings.js+++ b/modules/settings/Settings.js@@ -1,5 +1,5 @@/* global JitsiMeetJS */-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);import UIUtil from '../UI/util/UIUtil';import jitsiLocalStorage from '../util/JitsiLocalStorage';@@ -7,34 +7,35 @@ import { randomHexString } from '../../react/features/base/util';let avatarUrl = '';-let email = UIUtil.unescapeHtml(jitsiLocalStorage.getItem("email") || '');-let avatarId = UIUtil.unescapeHtml(jitsiLocalStorage.getItem("avatarId") || '');+let email = UIUtil.unescapeHtml(jitsiLocalStorage.getItem('email') || '');+let avatarId = UIUtil.unescapeHtml(jitsiLocalStorage.getItem('avatarId') || '');+if (!avatarId) {// if there is no avatar id, we generate a unique one and use it foreveravatarId = randomHexString(32);- jitsiLocalStorage.setItem("avatarId", avatarId);+ jitsiLocalStorage.setItem('avatarId', avatarId);}-let localFlipX = JSON.parse(jitsiLocalStorage.getItem("localFlipX") || true);+let localFlipX = JSON.parse(jitsiLocalStorage.getItem('localFlipX') || true);let displayName = UIUtil.unescapeHtml(- jitsiLocalStorage.getItem("displayname") || '');-let cameraDeviceId = jitsiLocalStorage.getItem("cameraDeviceId") || '';-let micDeviceId = jitsiLocalStorage.getItem("micDeviceId") || '';+ jitsiLocalStorage.getItem('displayname') || '');+let cameraDeviceId = jitsiLocalStorage.getItem('cameraDeviceId') || '';+let micDeviceId = jitsiLocalStorage.getItem('micDeviceId') || '';let welcomePageDisabled = JSON.parse(- jitsiLocalStorage.getItem("welcomePageDisabled") || false);+ jitsiLocalStorage.getItem('welcomePageDisabled') || false);// Currently audio output device change is supported only in Chrome and// default output always has 'default' device ID-let audioOutputDeviceId = jitsiLocalStorage.getItem("audioOutputDeviceId")+const audioOutputDeviceId = jitsiLocalStorage.getItem('audioOutputDeviceId')|| 'default';-if (audioOutputDeviceId !==- JitsiMeetJS.mediaDevices.getAudioOutputDevice()) {+if (audioOutputDeviceId+ !== JitsiMeetJS.mediaDevices.getAudioOutputDevice()) {JitsiMeetJS.mediaDevices.setAudioOutputDevice(audioOutputDeviceId)- .catch((ex) => {- logger.warn('Failed to set audio output device from local ' +- 'storage. Default audio output device will be used' +- 'instead.', ex);+ .catch(ex => {+ logger.warn('Failed to set audio output device from local '+ + 'storage. Default audio output device will be used'+ + 'instead.', ex);});}@@ -46,19 +47,20 @@ export default {* @param {string} newDisplayName unescaped display name for the local user* @param {boolean} disableLocalStore disables local store the display name*/- setDisplayName (newDisplayName, disableLocalStore) {+ setDisplayName(newDisplayName, disableLocalStore) {displayName = newDisplayName;- if (!disableLocalStore)- jitsiLocalStorage.setItem("displayname",+ if (!disableLocalStore) {+ jitsiLocalStorage.setItem('displayname',UIUtil.escapeHtml(displayName));+ }},/*** Returns the escaped display name currently used by the user* @returns {string} currently valid user display name.*/- getDisplayName: function () {+ getDisplayName() {return displayName;},@@ -67,18 +69,19 @@ export default {* @param {string} newEmail new email for the local user* @param {boolean} disableLocalStore disables local store the email*/- setEmail: function (newEmail, disableLocalStore) {+ setEmail(newEmail, disableLocalStore) {email = newEmail;- if (!disableLocalStore)- jitsiLocalStorage.setItem("email", UIUtil.escapeHtml(newEmail));+ if (!disableLocalStore) {+ jitsiLocalStorage.setItem('email', UIUtil.escapeHtml(newEmail));+ }},/*** Returns email address of the local user.* @returns {string} email*/- getEmail: function () {+ getEmail() {return email;},@@ -86,7 +89,7 @@ export default {* Returns avatar id of the local user.* @returns {string} avatar id*/- getAvatarId: function () {+ getAvatarId() {return avatarId;},@@ -94,7 +97,7 @@ export default {* Sets new avatarUrl for local user and saves it to the local storage.* @param {string} newAvatarUrl new avatarUrl for the local user*/- setAvatarUrl: function (newAvatarUrl) {+ setAvatarUrl(newAvatarUrl) {avatarUrl = newAvatarUrl;},@@ -102,7 +105,7 @@ export default {* Returns avatarUrl address of the local user.* @returns {string} avatarUrl*/- getAvatarUrl: function () {+ getAvatarUrl() {return avatarUrl;},@@ -110,16 +113,16 @@ export default {* Sets new flipX state of local video and saves it to the local storage.* @param {string} val flipX state of local video*/- setLocalFlipX: function (val) {+ setLocalFlipX(val) {localFlipX = val;- jitsiLocalStorage.setItem("localFlipX", val);+ jitsiLocalStorage.setItem('localFlipX', val);},/*** Returns flipX state of local video.* @returns {string} flipX*/- getLocalFlipX: function () {+ getLocalFlipX() {return localFlipX;},@@ -128,19 +131,21 @@ export default {* Empty string stands for default device.* @returns {String}*/- getCameraDeviceId: function () {+ getCameraDeviceId() {return cameraDeviceId;},+/*** Set device id of the camera which is currently in use.* Empty string stands for default device.* @param {string} newId new camera device id* @param {boolean} whether we need to store the value*/- setCameraDeviceId: function (newId, store) {+ setCameraDeviceId(newId, store) {cameraDeviceId = newId;- if (store)- jitsiLocalStorage.setItem("cameraDeviceId", newId);+ if (store) {+ jitsiLocalStorage.setItem('cameraDeviceId', newId);+ }},/**@@ -148,19 +153,21 @@ export default {* Empty string stands for default device.* @returns {String}*/- getMicDeviceId: function () {+ getMicDeviceId() {return micDeviceId;},+/*** Set device id of the microphone which is currently in use.* Empty string stands for default device.* @param {string} newId new microphone device id* @param {boolean} whether we need to store the value*/- setMicDeviceId: function (newId, store) {+ setMicDeviceId(newId, store) {micDeviceId = newId;- if (store)- jitsiLocalStorage.setItem("micDeviceId", newId);+ if (store) {+ jitsiLocalStorage.setItem('micDeviceId', newId);+ }},/**@@ -168,26 +175,27 @@ export default {* Empty string stands for default device.* @returns {String}*/- getAudioOutputDeviceId: function () {+ getAudioOutputDeviceId() {return JitsiMeetJS.mediaDevices.getAudioOutputDevice();},+/*** Set device id of the audio output device which is currently in use.* Empty string stands for default device.* @param {string} newId='default' - new audio output device id* @returns {Promise}*/- setAudioOutputDeviceId: function (newId = 'default') {+ setAudioOutputDeviceId(newId = 'default') {return JitsiMeetJS.mediaDevices.setAudioOutputDevice(newId).then(() =>- jitsiLocalStorage.setItem("audioOutputDeviceId", newId));+ jitsiLocalStorage.setItem('audioOutputDeviceId', newId));},/*** Check if welcome page is enabled or not.* @returns {boolean}*/- isWelcomePageEnabled () {+ isWelcomePageEnabled() {return !welcomePageDisabled;},@@ -195,8 +203,8 @@ export default {* Enable or disable welcome page.* @param {boolean} enabled if welcome page should be enabled or not*/- setWelcomePageEnabled (enabled) {+ setWelcomePageEnabled(enabled) {welcomePageDisabled = !enabled;- jitsiLocalStorage.setItem("welcomePageDisabled", welcomePageDisabled);+ jitsiLocalStorage.setItem('welcomePageDisabled', welcomePageDisabled);}};diff --git a/modules/translation/translation.js b/modules/translation/translation.jsindex 820796ca80..459d592fcb 100644--- a/modules/translation/translation.js+++ b/modules/translation/translation.js@@ -16,11 +16,20 @@ function _onI18nInitialized() {$('[data-i18n]').localize();}+/**+ *+ */class Translation {+ /**+ *+ */addLanguageChangedListener(listener: Function) {i18next.on('languageChanged', listener);}+ /**+ *+ */generateTranslationHTML(key: string, options: Object) {const optAttr= options ? ` data-i18n-options='${JSON.stringify(options)}'` : '';@@ -31,23 +40,36 @@ class Translation {return `<span data-i18n="${key}"${optAttr}>${text}</span>`;}+ /**+ *+ */getCurrentLanguage() {return i18next.lng();}+ /**+ *+ */init() {jqueryI18next.init(i18next, $, { useOptionsAttr: true });- if (i18next.isInitialized)+ if (i18next.isInitialized) {_onI18nInitialized();- else+ } else {i18next.on('initialized', _onI18nInitialized);+ }}+ /**+ *+ */setLanguage(language: string = DEFAULT_LANGUAGE) {i18next.setLng(language, {}, _onI18nInitialized);}+ /**+ *+ */translateElement(selector: Object, options: Object) {// XXX i18next expects undefined if options are missing.selector.localize(options ? options : undefined);diff --git a/modules/transport/PostMessageTransportBackend.js b/modules/transport/PostMessageTransportBackend.jsindex bd158ca4b6..ba918721bf 100644--- a/modules/transport/PostMessageTransportBackend.js+++ b/modules/transport/PostMessageTransportBackend.js@@ -65,6 +65,7 @@ export default class PostMessageTransportBackend {* transport.*/constructor({ enableLegacyFormat, postisOptions } = {}) {+ // eslint-disable-next-line new-capthis.postis = Postis({...DEFAULT_POSTIS_OPTIONS,...postisOptionsdiff --git a/modules/util/JitsiLocalStorage.js b/modules/util/JitsiLocalStorage.jsindex 43e8dd12a5..d09782d37b 100644--- a/modules/util/JitsiLocalStorage.js+++ b/modules/util/JitsiLocalStorage.js@@ -6,6 +6,7 @@ const logger = Logger.getLogger(__filename);* Dummy implementation of Storage interface with empty methods.*/class DummyLocalStorage {+ /* eslint-disable no-empty-function *//*** Empty function*/@@ -20,6 +21,7 @@ class DummyLocalStorage {* Empty function*/removeItem() { }+ /* eslint-enable no-empty-function */}/**diff --git a/modules/util/JitsiMeetLogStorage.js b/modules/util/JitsiMeetLogStorage.jsindex d04c64d48d..f56a6f2a1b 100644--- a/modules/util/JitsiMeetLogStorage.js+++ b/modules/util/JitsiMeetLogStorage.js@@ -37,15 +37,17 @@ export default class JitsiMeetLogStorage {return;}- let logJSON = '{"log' + this.counter + '":"\n';+ let logJSON = `{"log${this.counter}":"\n`;+for (let i = 0, len = logEntries.length; i < len; i++) {- let logEntry = logEntries[i];+ const logEntry = logEntries[i];+if (typeof logEntry === 'object') {// Aggregated message- logJSON += '(' + logEntry.count + ') ' + logEntry.text + '\n';+ logJSON += `(${logEntry.count}) ${logEntry.text}\n`;} else {// Regular message- logJSON += logEntry + '\n';+ logJSON += `${logEntry}\n`;}}logJSON += '"}';@@ -60,7 +62,7 @@ export default class JitsiMeetLogStorage {} catch (error) {// NOTE console is intentional hereconsole.error(- "Failed to store the logs: ", logJSON, error);+ 'Failed to store the logs: ', logJSON, error);}}}diff --git a/modules/util/helpers.js b/modules/util/helpers.jsindex 5414ae45e3..5e93386cd3 100644--- a/modules/util/helpers.js+++ b/modules/util/helpers.js@@ -1,4 +1,4 @@-const logger = require("jitsi-meet-logger").getLogger(__filename);+const logger = require('jitsi-meet-logger').getLogger(__filename);/*** Create deferred object.@@ -40,7 +40,7 @@ export function replace(url) {* @param e {Error} the error* @param msg {string} [optional] the message printed in addition to the error*/-export function reportError(e, msg = "") {+export function reportError(e, msg = '') {logger.error(msg, e);window.onerror && window.onerror(msg, null, null, null, e);}diff --git a/react/.eslintrc.js b/react/.eslintrc.jsindex 3efcc52b85..8f015f908b 100644--- a/react/.eslintrc.js+++ b/react/.eslintrc.js@@ -6,48 +6,12 @@ module.exports = {}},'plugins': [-- // ESLint's rule no-duplicate-imports does not understand Flow's import- // type. Fortunately, eslint-plugin-import understands Flow's import- // type.- 'import','jsdoc','react','react-native'],'rules': {// Possible Errors group- 'no-cond-assign': 2,- 'no-console': 0,- 'no-constant-condition': 2,- 'no-control-regex': 2,- 'no-debugger': 2,- 'no-dupe-args': 2,- 'no-dupe-keys': 2,- 'no-duplicate-case': 2,- 'no-empty': 2,- 'no-empty-character-class': 2,- 'no-ex-assign': 2,- 'no-extra-boolean-cast': 2,- 'no-extra-parens': [- 'error',- 'all',- { 'nestedBinaryExpressions': false }- ],- 'no-extra-semi': 2,- 'no-func-assign': 2,- 'no-inner-declarations': 2,- 'no-invalid-regexp': 2,- 'no-irregular-whitespace': 2,- 'no-negated-in-lhs': 2,- 'no-obj-calls': 2,- 'no-prototype-builtins': 0,- 'no-regex-spaces': 2,- 'no-sparse-arrays': 2,- 'no-unexpected-multiline': 2,- 'no-unreachable': 2,- 'no-unsafe-finally': 2,- 'use-isnan': 2,// Currently, we are using both valid-jsdoc and 'jsdoc' plugin. In the// future we might stick to one as soon as it has all the features.@@ -74,234 +38,11 @@ module.exports = {'requireReturnType': true}],- 'valid-typeof': 2,// Best Practices group- 'accessor-pairs': 0,- 'array-callback-return': 2,- 'block-scoped-var': 0,- 'complexity': 0,- 'consistent-return': 0,- 'curly': 2,- 'default-case': 0,- 'dot-location': [ 'error', 'property' ],- 'dot-notation': 2,- 'eqeqeq': 2,- 'guard-for-in': 2,- 'no-alert': 2,- 'no-caller': 2,- 'no-case-declarations': 2,- 'no-div-regex': 0,- 'no-else-return': 2,- 'no-empty-function': 2,- 'no-empty-pattern': 2,- 'no-eq-null': 2,- 'no-eval': 2,- 'no-extend-native': 2,- 'no-extra-bind': 2,- 'no-extra-label': 2,- 'no-fallthrough': 2,- 'no-floating-decimal': 2,- 'no-implicit-coercion': 2,- 'no-implicit-globals': 2,- 'no-implied-eval': 2,- 'no-invalid-this': 2,- 'no-iterator': 2,- 'no-labels': 2,- 'no-lone-blocks': 2,- 'no-loop-func': 2,- 'no-magic-numbers': 0,- 'no-multi-spaces': 2,- 'no-multi-str': 2,- 'no-native-reassign': 2,- 'no-new': 2,- 'no-new-func': 2,- 'no-new-wrappers': 2,- 'no-octal': 2,- 'no-octal-escape': 2,- 'no-param-reassign': 2,- 'no-proto': 2,- 'no-redeclare': 2,- 'no-return-assign': 2,- 'no-script-url': 2,- 'no-self-assign': 2,- 'no-self-compare': 2,- 'no-sequences': 2,- 'no-throw-literal': 2,- 'no-unmodified-loop-condition': 2,- 'no-unused-expressions': [- 'error',- {- 'allowShortCircuit': true,- 'allowTernary': true- }- ],- 'no-unused-labels': 2,- 'no-useless-call': 2,- 'no-useless-concat': 2,- 'no-useless-escape': 2,- 'no-void': 2,- 'no-warning-comments': 0,- 'no-with': 2,- 'radix': 2,- 'vars-on-top': 2,- 'wrap-iife': [ 'error', 'inside' ],- 'yoda': 2,-- // Strict Mode group- 'strict': 2,-- // Variables group- 'init-declarations': 0,- 'no-catch-shadow': 2,- 'no-delete-var': 2,- 'no-label-var': 2,- 'no-restricted-globals': 0,- 'no-shadow': 2,- 'no-shadow-restricted-names': 2,- 'no-undef': 2,- 'no-undef-init': 2,- 'no-undefined': 0,- 'no-unused-vars': 2,- 'no-use-before-define': [ 'error', { 'functions': false } ],-- // Stylistic issues group- 'array-bracket-spacing': [- 'error',- 'always',- { 'objectsInArrays': true }- ],- 'block-spacing': [ 'error', 'always' ],- 'brace-style': 2,- 'camelcase': 2,- 'comma-dangle': 2,- 'comma-spacing': 2,- 'comma-style': 2,- 'computed-property-spacing': 2,- 'consistent-this': [ 'error', 'self' ],- 'eol-last': 2,- 'func-names': 0,- 'func-style': 0,- 'id-blacklist': 0,- 'id-length': 0,- 'id-match': 0,'jsx-quotes': [ 'error', 'prefer-single' ],- 'key-spacing': 2,- 'keyword-spacing': 2,- 'linebreak-style': [ 'error', 'unix' ],- 'lines-around-comment': [- 'error',- {- 'allowBlockStart': true,- 'allowObjectStart': true,- 'beforeBlockComment': true,- 'beforeLineComment': true- }- ],- 'max-depth': 2,- 'max-len': [ 'error', 80 ],- 'max-lines': 0,- 'max-nested-callbacks': 2,- 'max-params': 2,- 'max-statements': 0,- 'max-statements-per-line': 2,- 'multiline-ternary': 0,- 'new-cap': 2,- 'new-parens': 2,- 'newline-after-var': 2,- 'newline-before-return': 2,- 'newline-per-chained-call': 2,- 'no-array-constructor': 2,- 'no-bitwise': 2,- 'no-continue': 2,- 'no-inline-comments': 0,- 'no-lonely-if': 2,- 'no-mixed-operators': 2,- 'no-mixed-spaces-and-tabs': 2,- 'no-multiple-empty-lines': 2,- 'no-negated-condition': 2,- 'no-nested-ternary': 0,- 'no-new-object': 2,- 'no-plusplus': 0,- 'no-restricted-syntax': 0,- 'no-spaced-func': 2,- 'no-tabs': 2,- 'no-ternary': 0,- 'no-trailing-spaces': 2,- 'no-underscore-dangle': 0,- 'no-unneeded-ternary': 2,- 'no-whitespace-before-property': 2,- 'object-curly-newline': 0,- 'object-curly-spacing': [ 'error', 'always' ],- 'object-property-newline': 2,- 'one-var': 0,- 'one-var-declaration-per-line': 0,- 'operator-assignment': 0,- 'operator-linebreak': [ 'error', 'before' ],- 'padded-blocks': 0,- 'quote-props': 0,- 'quotes': [ 'error', 'single' ],- 'require-jsdoc': [- 'error',- {- 'require': {- 'ClassDeclaration': true,- 'FunctionDeclaration': true,- 'MethodDefinition': true- }- }- ],- 'semi': [ 'error', 'always' ],- 'semi-spacing': 2,- 'sort-vars': 2,- 'space-before-blocks': 2,- 'space-before-function-paren': [ 'error', 'never' ],- 'space-in-parens': [ 'error', 'never' ],- 'space-infix-ops': 2,- 'space-unary-ops': 2,- 'spaced-comment': 2,- 'unicode-bom': 0,- 'wrap-regex': 0,// ES6 group rules- 'arrow-body-style': [- 'error',- 'as-needed',- { requireReturnForObjectLiteral: true }- ],- 'arrow-parens': [ 'error', 'as-needed' ],- 'arrow-spacing': 2,- 'constructor-super': 2,- 'generator-star-spacing': 2,- 'no-class-assign': 2,- 'no-confusing-arrow': 2,- 'no-const-assign': 2,- 'no-dupe-class-members': 2,- 'no-new-symbol': 2,- 'no-restricted-imports': 0,- 'no-this-before-super': 2,- 'no-useless-computed-key': 2,- 'no-useless-constructor': 2,- 'no-useless-rename': 2,- 'no-var': 2,- 'object-shorthand': [- 'error',- 'always',- { 'avoidQuotes': true }- ],- 'prefer-arrow-callback': [ 'error', { 'allowNamedFunctions': true } ],- 'prefer-const': 2,- 'prefer-reflect': 0,- 'prefer-rest-params': 2,- 'prefer-spread': 2,- 'prefer-template': 2,- 'require-yield': 2,- 'rest-spread-spacing': 2,- 'sort-imports': 0,- 'template-curly-spacing': 2,- 'yield-star-spacing': 2,-- 'import/no-duplicates': 2,// JsDoc plugin rules group. The following rules are in addition to// valid-jsdoc rule.diff --git a/service/UI/UIEvents.js b/service/UI/UIEvents.jsindex c392729593..16d267c6ea 100644--- a/service/UI/UIEvents.js+++ b/service/UI/UIEvents.js@@ -1,50 +1,58 @@export default {- NICKNAME_CHANGED: "UI.nickname_changed",- SELECTED_ENDPOINT: "UI.selected_endpoint",- PINNED_ENDPOINT: "UI.pinned_endpoint",+ NICKNAME_CHANGED: 'UI.nickname_changed',+ SELECTED_ENDPOINT: 'UI.selected_endpoint',+ PINNED_ENDPOINT: 'UI.pinned_endpoint',+/*** Notifies that local user created text message.*/- MESSAGE_CREATED: "UI.message_created",+ MESSAGE_CREATED: 'UI.message_created',+/*** Notifies that local user changed language.*/- LANG_CHANGED: "UI.lang_changed",+ LANG_CHANGED: 'UI.lang_changed',+/*** Notifies that local user changed email.*/- EMAIL_CHANGED: "UI.email_changed",+ EMAIL_CHANGED: 'UI.email_changed',+/*** Notifies that "start muted" settings changed.*/- START_MUTED_CHANGED: "UI.start_muted_changed",- AUDIO_MUTED: "UI.audio_muted",- VIDEO_MUTED: "UI.video_muted",- VIDEO_UNMUTING_WHILE_AUDIO_ONLY: "UI.video_unmuting_while_audio_only",- ETHERPAD_CLICKED: "UI.etherpad_clicked",- SHARED_VIDEO_CLICKED: "UI.start_shared_video",+ START_MUTED_CHANGED: 'UI.start_muted_changed',+ AUDIO_MUTED: 'UI.audio_muted',+ VIDEO_MUTED: 'UI.video_muted',+ VIDEO_UNMUTING_WHILE_AUDIO_ONLY: 'UI.video_unmuting_while_audio_only',+ ETHERPAD_CLICKED: 'UI.etherpad_clicked',+ SHARED_VIDEO_CLICKED: 'UI.start_shared_video',+/*** Updates shared video with params: url, state, time(optional)* Where url is the video link, state is stop/start/pause and time is the* current video playing time.*/- UPDATE_SHARED_VIDEO: "UI.update_shared_video",- USER_KICKED: "UI.user_kicked",- REMOTE_AUDIO_MUTED: "UI.remote_audio_muted",- TOGGLE_FULLSCREEN: "UI.toogle_fullscreen",- FULLSCREEN_TOGGLED: "UI.fullscreen_toggled",- AUTH_CLICKED: "UI.auth_clicked",+ UPDATE_SHARED_VIDEO: 'UI.update_shared_video',+ USER_KICKED: 'UI.user_kicked',+ REMOTE_AUDIO_MUTED: 'UI.remote_audio_muted',+ TOGGLE_FULLSCREEN: 'UI.toogle_fullscreen',+ FULLSCREEN_TOGGLED: 'UI.fullscreen_toggled',+ AUTH_CLICKED: 'UI.auth_clicked',+/*** Notifies that the audio only mode was toggled.*/- TOGGLE_AUDIO_ONLY: "UI.toggle_audioonly",- TOGGLE_CHAT: "UI.toggle_chat",- TOGGLE_SETTINGS: "UI.toggle_settings",- TOGGLE_CONTACT_LIST: "UI.toggle_contact_list",+ TOGGLE_AUDIO_ONLY: 'UI.toggle_audioonly',+ TOGGLE_CHAT: 'UI.toggle_chat',+ TOGGLE_SETTINGS: 'UI.toggle_settings',+ TOGGLE_CONTACT_LIST: 'UI.toggle_contact_list',+/*** Notifies that the profile toolbar button has been clicked.*/- TOGGLE_PROFILE: "UI.toggle_profile",+ TOGGLE_PROFILE: 'UI.toggle_profile',+/*** Notifies that a command to toggle the filmstrip has been issued. The* event may optionally specify a {Boolean} (primitive) value to assign to@@ -56,7 +64,8 @@ export default {** @see {TOGGLED_FILMSTRIP}*/- TOGGLE_FILMSTRIP: "UI.toggle_filmstrip",+ TOGGLE_FILMSTRIP: 'UI.toggle_filmstrip',+/*** Notifies that the filmstrip was (actually) toggled. The event supplies a* {Boolean} (primitive) value indicating the visibility of the filmstrip@@ -64,59 +73,59 @@ export default {** @see {TOGGLE_FILMSTRIP}*/- TOGGLED_FILMSTRIP: "UI.toggled_filmstrip",+ TOGGLED_FILMSTRIP: 'UI.toggled_filmstrip',- TOGGLE_SCREENSHARING: "UI.toggle_screensharing",- TOGGLED_SHARED_DOCUMENT: "UI.toggled_shared_document",- CONTACT_CLICKED: "UI.contact_clicked",- HANGUP: "UI.hangup",- LOGOUT: "UI.logout",- RECORDING_TOGGLED: "UI.recording_toggled",- SUBJECT_CHANGED: "UI.subject_changed",- VIDEO_DEVICE_CHANGED: "UI.video_device_changed",- AUDIO_DEVICE_CHANGED: "UI.audio_device_changed",- AUDIO_OUTPUT_DEVICE_CHANGED: "UI.audio_output_device_changed",+ TOGGLE_SCREENSHARING: 'UI.toggle_screensharing',+ TOGGLED_SHARED_DOCUMENT: 'UI.toggled_shared_document',+ CONTACT_CLICKED: 'UI.contact_clicked',+ HANGUP: 'UI.hangup',+ LOGOUT: 'UI.logout',+ RECORDING_TOGGLED: 'UI.recording_toggled',+ SUBJECT_CHANGED: 'UI.subject_changed',+ VIDEO_DEVICE_CHANGED: 'UI.video_device_changed',+ AUDIO_DEVICE_CHANGED: 'UI.audio_device_changed',+ AUDIO_OUTPUT_DEVICE_CHANGED: 'UI.audio_output_device_changed',/*** Notifies interested listeners that the follow-me feature is enabled or* disabled.*/- FOLLOW_ME_ENABLED: "UI.follow_me_enabled",+ FOLLOW_ME_ENABLED: 'UI.follow_me_enabled',/*** Notifies that flipX property of the local video is changed.*/- LOCAL_FLIPX_CHANGED: "UI.local_flipx_changed",+ LOCAL_FLIPX_CHANGED: 'UI.local_flipx_changed',// An event which indicates that the resolution of a remote video has// changed.- RESOLUTION_CHANGED: "UI.resolution_changed",+ RESOLUTION_CHANGED: 'UI.resolution_changed',/*** Notifies that the button "Cancel" is pressed on the dialog for* external extension installation.*/- EXTERNAL_INSTALLATION_CANCELED: "UI.external_installation_canceled",+ EXTERNAL_INSTALLATION_CANCELED: 'UI.external_installation_canceled',/*** Notifies that the side toolbar container has been toggled. The actual* event must contain the identifier of the container that has been toggled* and information about toggle on or off.*/- SIDE_TOOLBAR_CONTAINER_TOGGLED: "UI.side_container_toggled",+ SIDE_TOOLBAR_CONTAINER_TOGGLED: 'UI.side_container_toggled',/*** Notifies that the raise hand has been changed.*/- LOCAL_RAISE_HAND_CHANGED: "UI.local_raise_hand_changed",+ LOCAL_RAISE_HAND_CHANGED: 'UI.local_raise_hand_changed',/*** Notifies that the avatar is displayed or not on the largeVideo.*/- LARGE_VIDEO_AVATAR_VISIBLE: "UI.large_video_avatar_visible",+ LARGE_VIDEO_AVATAR_VISIBLE: 'UI.large_video_avatar_visible',/*** Notifies that the displayed particpant id on the largeVideo is changed.*/- LARGE_VIDEO_ID_CHANGED: "UI.large_video_id_changed"+ LARGE_VIDEO_ID_CHANGED: 'UI.large_video_id_changed'};diff --git a/service/remotecontrol/Constants.js b/service/remotecontrol/Constants.jsindex d80be7f6ac..7d18ca8d82 100644--- a/service/remotecontrol/Constants.js+++ b/service/remotecontrol/Constants.js@@ -2,7 +2,7 @@* The value for the "var" attribute of feature tag in disco-info packets.*/export const DISCO_REMOTE_CONTROL_FEATURE- = "http://jitsi.org/meet/remotecontrol";+ = 'http://jitsi.org/meet/remotecontrol';/*** Types of remote-control events.@@ -10,17 +10,17 @@ export const DISCO_REMOTE_CONTROL_FEATURE* @enum {string}*/export const EVENTS = {- mousemove: "mousemove",- mousedown: "mousedown",- mouseup: "mouseup",- mousedblclick: "mousedblclick",- mousescroll: "mousescroll",- keydown: "keydown",- keyup: "keyup",- permissions: "permissions",- start: "start",- stop: "stop",- supported: "supported"+ mousemove: 'mousemove',+ mousedown: 'mousedown',+ mouseup: 'mouseup',+ mousedblclick: 'mousedblclick',+ mousescroll: 'mousescroll',+ keydown: 'keydown',+ keyup: 'keyup',+ permissions: 'permissions',+ start: 'start',+ stop: 'stop',+ supported: 'supported'};/**@@ -29,7 +29,7 @@ export const EVENTS = {* @enum {string}*/export const REQUESTS = {- start: "start"+ start: 'start'};/**@@ -38,16 +38,16 @@ export const REQUESTS = {* @enum {string}*/export const PERMISSIONS_ACTIONS = {- request: "request",- grant: "grant",- deny: "deny",- error: "error"+ request: 'request',+ grant: 'grant',+ deny: 'deny',+ error: 'error'};/*** The type of remote control messages.*/-export const REMOTE_CONTROL_MESSAGE_NAME = "remote-control";+export const REMOTE_CONTROL_MESSAGE_NAME = 'remote-control';/*** The remote control event.diff --git a/static/close.js b/static/close.jsindex 6e9a48c4fe..10e732625d 100644--- a/static/close.js+++ b/static/close.js@@ -1,11 +1,13 @@/* global interfaceConfig */-//list of tips-var hints = [- "You can pin participants by clicking on their thumbnails.",// jshint ignore:line- "You can tell others you have something to say by using the \"Raise Hand\" feature",// jshint ignore:line- "You can learn about key shortcuts by pressing Shift+?",// jshint ignore:line- "You can learn more about the state of everyone's connection by hovering on the bars in their thumbnail",// jshint ignore:line- "You can hide all thumbnails by using the button in the bottom right corner"// jshint ignore:line+// list of tips+const hints = [+ 'You can pin participants by clicking on their thumbnails.',+ 'You can tell others you have something to say by using the "Raise Hand" '+ + 'feature',+ 'You can learn about key shortcuts by pressing Shift+?',+ 'You can learn more about the state of everyone\'s connection by hovering '+ + 'on the bars in their thumbnail',+ 'You can hide all thumbnails by using the button in the bottom right corner'];/**@@ -13,9 +15,9 @@ var hints = [** @return {string} the hint message.*/-function getHint(){- var l = hints.length - 1;- var n = Math.round(Math.random() * l);+function getHint() {+ const l = hints.length - 1;+ const n = Math.round(Math.random() * l);return hints[n];}@@ -27,28 +29,30 @@ function getHint(){* @param id {string} element identificator* @param msg {string} text message*/-// eslint-disable-next-line no-unused-vars-function insertTextMsg(id, msg){- var el = document.getElementById(id);+function insertTextMsg(id, msg) {+ const el = document.getElementById(id);- if (el)+ if (el) {el.innerHTML = msg;+ }}/*** Sets the hint and thanks messages. Will be executed on load event.*/function onLoad() {- //Works only for close2.html because close.html doesn't have this element.+ // Works only for close2.html because close.html doesn't have this element.insertTextMsg('thanksMessage',- 'Thank you for using ' + interfaceConfig.APP_NAME);+ `Thank you for using ${interfaceConfig.APP_NAME}`);// If there is a setting show a special message only for the guestsif (interfaceConfig.CLOSE_PAGE_GUEST_HINT) {- if ( window.sessionStorage.getItem('guest') === 'true' ) {- var element = document.getElementById('hintQuestion');+ if (window.sessionStorage.getItem('guest') === 'true') {+ const element = document.getElementById('hintQuestion');+element.classList.add('hide');insertTextMsg('hintMessage', interfaceConfig.CLOSE_PAGE_GUEST_HINT);+return;}}diff --git a/webpack.config.js b/webpack.config.jsindex dd9b0acba9..72f89c8aaf 100644--- a/webpack.config.js+++ b/webpack.config.js@@ -3,7 +3,7 @@const process = require('process');const webpack = require('webpack');-const aui_css = `${__dirname}/node_modules/@atlassian/aui/dist/aui/css/`;+const auiCSS = `${__dirname}/node_modules/@atlassian/aui/dist/aui/css/`;/*** The URL of the Jitsi Meet deployment to be proxy to in the context of@@ -15,6 +15,8 @@ const devServerProxyTargetconst minimize= process.argv.indexOf('-p') !== -1|| process.argv.indexOf('--optimize-minimize') !== -1;++// eslint-disable-next-line camelcaseconst node_modules = `${__dirname}/node_modules/`;const plugins = [new webpack.LoaderOptionsPlugin({@@ -62,8 +64,7 @@ const config = {rules: [ {// Transpile ES2015 (aka ES6) to ES5. Accept the JSX syntax by React// as well.-- exclude: node_modules,+ exclude: node_modules, // eslint-disable-line camelcaseloader: 'babel-loader',options: {// XXX The require.resolve bellow solves failures to locate the@@ -113,10 +114,10 @@ const config = {// Emit the static assets of AUI such as images that are referenced// by CSS into the output path.- include: aui_css,+ include: auiCSS,loader: 'file-loader',options: {- context: aui_css,+ context: auiCSS,name: '[path][name].[ext]'},test: /\.(gif|png|svg)$/@@ -210,9 +211,10 @@ function devServerProxyBypass({ path }) {const configs = module.exports;/* eslint-disable indent */+ let formattedPath = path;if ((Array.isArray(configs) ? configs : Array(configs)).some(c => {- if (path.startsWith(c.output.publicPath)) {+ if (formattedPath.startsWith(c.output.publicPath)) {if (!minimize) {// Since webpack-dev-server is serving non-minimized// artifacts, serve them even if the minimized ones are@@ -220,18 +222,23 @@ function devServerProxyBypass({ path }) {Object.keys(c.entry).some(e => {const name = `${e}.min.js`;- if (path.indexOf(name) !== -1) {- path = path.replace(name, `${e}.js`);+ if (formattedPath.indexOf(name) !== -1) {+ formattedPath+ = formattedPath.replace(name, `${e}.js`);return true;}++ return false;});}return true;}++ return false;})) {- return path;+ return formattedPath;}/* eslint-enable indent */