Supports setting interfaceConfig options via URL params. Renames config.filmStripOnly to interfaceConfig.filmStripOnly.

This commit is contained in:
Boris Grozev 2015-08-10 12:59:12 -05:00
parent cc29df6376
commit fd404b8465
7 changed files with 34 additions and 21 deletions

View File

@ -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++;

View File

@ -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
};

View File

@ -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,

View File

@ -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) {

View File

@ -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';

View File

@ -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) {

View File

@ -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;
}
}