2013-12-16 11:22:23 +00:00
|
|
|
/* jshint -W117 */
|
|
|
|
/* application specific logic */
|
2014-05-12 09:56:33 +00:00
|
|
|
|
2015-09-10 17:15:56 +00:00
|
|
|
require("jquery");
|
|
|
|
require("jquery-ui");
|
|
|
|
require("strophe");
|
|
|
|
require("strophe-disco");
|
|
|
|
require("strophe-caps");
|
|
|
|
require("tooltip");
|
|
|
|
require("popover");
|
|
|
|
window.toastr = require("toastr");
|
|
|
|
require("jQuery-Impromptu");
|
|
|
|
require("autosize");
|
|
|
|
|
2015-01-28 14:35:22 +00:00
|
|
|
var APP =
|
|
|
|
{
|
|
|
|
init: function () {
|
|
|
|
this.UI = require("./modules/UI/UI");
|
|
|
|
this.API = require("./modules/API/API");
|
2015-09-11 02:42:15 +00:00
|
|
|
this.connectionquality =
|
|
|
|
require("./modules/connectionquality/connectionquality");
|
2015-01-28 14:35:22 +00:00
|
|
|
this.statistics = require("./modules/statistics/statistics");
|
|
|
|
this.RTC = require("./modules/RTC/RTC");
|
2015-09-11 02:42:15 +00:00
|
|
|
this.desktopsharing =
|
|
|
|
require("./modules/desktopsharing/desktopsharing");
|
2015-01-28 14:35:22 +00:00
|
|
|
this.xmpp = require("./modules/xmpp/xmpp");
|
2015-09-11 02:42:15 +00:00
|
|
|
this.keyboardshortcut =
|
|
|
|
require("./modules/keyboardshortcut/keyboardshortcut");
|
2015-02-06 15:46:50 +00:00
|
|
|
this.translation = require("./modules/translation/translation");
|
2015-03-09 15:50:13 +00:00
|
|
|
this.settings = require("./modules/settings/Settings");
|
2015-09-11 02:42:15 +00:00
|
|
|
//this.DTMF = require("./modules/DTMF/DTMF");
|
2015-04-12 12:18:24 +00:00
|
|
|
this.members = require("./modules/members/MemberList");
|
2015-08-21 12:33:05 +00:00
|
|
|
this.configFetch = require("./modules/config/HttpConfigFetch");
|
2015-01-28 14:35:22 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
function init() {
|
2014-11-06 13:54:47 +00:00
|
|
|
|
2015-07-10 09:57:20 +00:00
|
|
|
APP.desktopsharing.init();
|
2015-01-28 14:35:22 +00:00
|
|
|
APP.RTC.start();
|
2015-03-09 15:16:06 +00:00
|
|
|
APP.xmpp.start();
|
2015-01-28 14:35:22 +00:00
|
|
|
APP.statistics.start();
|
|
|
|
APP.connectionquality.init();
|
|
|
|
APP.keyboardshortcut.init();
|
2015-04-12 12:18:24 +00:00
|
|
|
APP.members.start();
|
2013-12-16 11:22:23 +00:00
|
|
|
}
|
|
|
|
|
2015-08-21 12:33:05 +00:00
|
|
|
/**
|
|
|
|
* If we have HTTP endpoint for getting confgi.json configured we're going to
|
|
|
|
* read it and override properties from config.js and interfaceConfig.js.
|
|
|
|
* If there is no endpoint we'll just continue with initialization.
|
|
|
|
* Keep in mind that if the endpoint has been configured and we fail to obtain
|
|
|
|
* the config for any reason then the conference won't start and error message
|
|
|
|
* will be displayed to the user.
|
|
|
|
*/
|
|
|
|
function obtainConfigAndInit() {
|
|
|
|
if (config.configLocation) {
|
|
|
|
APP.configFetch.obtainConfig(
|
|
|
|
config.configLocation, APP.UI.getRoomNode(),
|
|
|
|
// Get config result callback
|
|
|
|
function(success, error) {
|
|
|
|
if (success) {
|
2015-10-06 21:36:41 +00:00
|
|
|
console.log("(TIME) configuration fetched:\t",
|
|
|
|
window.performance.now());
|
2015-08-21 12:33:05 +00:00
|
|
|
init();
|
|
|
|
} else {
|
|
|
|
// Show obtain config error,
|
|
|
|
// pass the error object for report
|
|
|
|
APP.UI.messageHandler.openReportDialog(
|
|
|
|
null, "dialog.connectError", error);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-28 11:31:32 +00:00
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
$(document).ready(function () {
|
2015-10-06 21:36:41 +00:00
|
|
|
console.log("(TIME) document ready:\t", window.performance.now());
|
2015-01-07 14:54:03 +00:00
|
|
|
|
2015-08-21 12:33:05 +00:00
|
|
|
var URLProcessor = require("./modules/config/URLProcessor");
|
2015-07-22 18:34:44 +00:00
|
|
|
URLProcessor.setConfigParametersFromUrl();
|
2015-01-28 14:35:22 +00:00
|
|
|
APP.init();
|
2014-08-21 16:42:54 +00:00
|
|
|
|
2015-02-06 15:46:50 +00:00
|
|
|
APP.translation.init();
|
|
|
|
|
2015-01-28 14:35:22 +00:00
|
|
|
if(APP.API.isEnabled())
|
|
|
|
APP.API.init();
|
|
|
|
|
2015-08-21 12:33:05 +00:00
|
|
|
APP.UI.start(obtainConfigAndInit);
|
2015-01-22 16:26:05 +00:00
|
|
|
|
2013-12-16 11:22:23 +00:00
|
|
|
});
|
|
|
|
|
2013-12-30 08:31:08 +00:00
|
|
|
$(window).bind('beforeunload', function () {
|
2015-01-28 14:35:22 +00:00
|
|
|
if(APP.API.isEnabled())
|
|
|
|
APP.API.dispose();
|
2013-12-16 11:22:23 +00:00
|
|
|
});
|
|
|
|
|
2015-01-28 14:35:22 +00:00
|
|
|
module.exports = APP;
|
|
|
|
|