From fd404b846549083948e5c481347533f719b5d301 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Mon, 10 Aug 2015 12:59:12 -0500 Subject: [PATCH] Supports setting interfaceConfig options via URL params. Renames config.filmStripOnly to interfaceConfig.filmStripOnly. --- external_api.js | 2 +- interface_config.js | 6 +++++- modules/UI/UI.js | 6 +++--- modules/UI/toolbars/ToolbarToggler.js | 4 ++-- modules/UI/videolayout/RemoteVideo.js | 2 +- modules/UI/videolayout/VideoLayout.js | 6 +++--- modules/URLProcessor/URLProcessor.js | 29 ++++++++++++++++++--------- 7 files changed, 34 insertions(+), 21 deletions(-) diff --git a/external_api.js b/external_api.js index a13568d9cf..5d23daeb7f 100644 --- a/external_api.js +++ b/external_api.js @@ -53,7 +53,7 @@ var JitsiMeetExternalAPI = (function() this.url += room_name; this.url += "#external=true"; if(filmStripOnly) - this.url += "&config.filmStripOnly=true"; + this.url += "&interfaceConfig.filmStripOnly=true"; JitsiMeetExternalAPI.id++; diff --git a/interface_config.js b/interface_config.js index e664812eea..0317683e8d 100644 --- a/interface_config.js +++ b/interface_config.js @@ -15,5 +15,9 @@ var interfaceConfig = { GENERATE_ROOMNAMES_ON_WELCOME_PAGE: true, APP_NAME: "Jitsi Meet", INVITATION_POWERED_BY: true, - ACTIVE_SPEAKER_AVATAR_SIZE: 100 + ACTIVE_SPEAKER_AVATAR_SIZE: 100, + /** + * Whether to only show the filmstrip (and hide the toolbar). + */ + filmStripOnly: false }; diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 00e759c53c..272e909759 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -331,7 +331,7 @@ function registerListeners() { AudioLevels.init(); }); - if (!config.filmStripOnly) { + if (!interfaceConfig.filmStripOnly) { APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, updateChatConversation); APP.xmpp.addListener(XMPPEvents.CHAT_ERROR_RECEIVED, chatAddError); // Listens for video interruption events. @@ -399,7 +399,7 @@ UI.start = function (init) { bindEvents(); setupPrezi(); - if(!config.filmStripOnly) { + if (!interfaceConfig.filmStripOnly) { $("#videospace").mousemove(function () { return ToolbarToggler.showToolbar(); }); @@ -442,7 +442,7 @@ UI.start = function (init) { init(); - if(!config.filmStripOnly) { + if (!interfaceConfig.filmStripOnly) { toastr.options = { "closeButton": true, "debug": false, diff --git a/modules/UI/toolbars/ToolbarToggler.js b/modules/UI/toolbars/ToolbarToggler.js index 75d5b6c347..7f90da1cf8 100644 --- a/modules/UI/toolbars/ToolbarToggler.js +++ b/modules/UI/toolbars/ToolbarToggler.js @@ -53,7 +53,7 @@ var ToolbarToggler = { * Shows the main toolbar. */ showToolbar: function () { - if(config.filmStripOnly) + if (interfaceConfig.filmStripOnly) return; var header = $("#header"), bottomToolbar = $("#bottomToolbar"); @@ -90,7 +90,7 @@ var ToolbarToggler = { * @param isDock indicates what operation to perform */ dockToolbar: function (isDock) { - if(config.filmStripOnly) + if (interfaceConfig.filmStripOnly) return; if (isDock) { diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index e5e7f41f6d..0eee1f426d 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -43,7 +43,7 @@ RemoteVideo.prototype.addRemoteVideoContainer = function() { * @param parentElement the parent element where this menu will be added */ -if(!config.filmStripOnly) { +if (!interfaceConfig.filmStripOnly) { RemoteVideo.prototype.addRemoteVideoMenu = function () { var spanElement = document.createElement('span'); spanElement.className = 'remotevideomenu'; diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index f2fb726bfe..fbd8276756 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -36,7 +36,7 @@ var VideoLayout = (function (my) { my.init = function (emitter) { eventEmitter = emitter; localVideoThumbnail = new LocalVideo(VideoLayout); - if(config.filmStripOnly) + if (interfaceConfig.filmStripOnly) { showLargeVideo = false; LargeVideo.disable(); @@ -202,7 +202,7 @@ var VideoLayout = (function (my) { resourceJid) { if(focusedVideoResourceJid) { var oldSmallVideo = VideoLayout.getSmallVideo(focusedVideoResourceJid); - if(oldSmallVideo && !config.filmStripOnly) + if (oldSmallVideo && !interfaceConfig.filmStripOnly) oldSmallVideo.focus(false); } @@ -229,7 +229,7 @@ var VideoLayout = (function (my) { // Update focused/pinned interface. if (resourceJid) { - if(smallVideo && !config.filmStripOnly) + if (smallVideo && !interfaceConfig.filmStripOnly) smallVideo.focus(true); if (!noPinnedEndpointChangedEvent) { diff --git a/modules/URLProcessor/URLProcessor.js b/modules/URLProcessor/URLProcessor.js index 38819ba4c2..0aee2ee539 100644 --- a/modules/URLProcessor/URLProcessor.js +++ b/modules/URLProcessor/URLProcessor.js @@ -1,4 +1,4 @@ -/* global $, $iq, config */ +/* global $, $iq, config, interfaceConfig */ var params = {}; function getConfigParamsFromUrl() { if(!location.hash) @@ -17,22 +17,31 @@ params = getConfigParamsFromUrl(); var URLProcessor = { setConfigParametersFromUrl: function () { - for(var k in params) - { - if(typeof k !== "string" || k.indexOf("config.") === -1) + for(var key in params) { + if(typeof key !== "string") continue; - var v = params[k]; - var confKey = k.substr(7); - if(config[confKey] && typeof config[confKey] !== typeof v) + var confObj = null, confKey; + if (key.indexOf("config.") === 0) { + confObj = config; + confKey = key.substr("config.".length); + } else if (key.indexOf("interfaceConfig.") === 0) { + confObj = interfaceConfig; + confKey = key.substr("interfaceConfig.".length); + } + + if (!confObj) + continue; + + var value = params[key]; + if (confObj[confKey] && typeof confObj[confKey] !== typeof value) { - console.warn("The type of " + k + + console.warn("The type of " + key + " is wrong. That parameter won't be updated in config.js."); continue; } - config[confKey] = v; - + confObj[confKey] = value; } }