Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

app.js 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* jshint -W117 */
  2. /* application specific logic */
  3. require("jquery");
  4. require("jquery-ui");
  5. require("strophe");
  6. require("strophe-disco");
  7. require("strophe-caps");
  8. require("tooltip");
  9. require("popover");
  10. window.toastr = require("toastr");
  11. require("jQuery-Impromptu");
  12. require("autosize");
  13. var APP =
  14. {
  15. init: function () {
  16. this.UI = require("./modules/UI/UI");
  17. this.API = require("./modules/API/API");
  18. this.connectionquality =
  19. require("./modules/connectionquality/connectionquality");
  20. this.statistics = require("./modules/statistics/statistics");
  21. this.RTC = require("./modules/RTC/RTC");
  22. this.desktopsharing =
  23. require("./modules/desktopsharing/desktopsharing");
  24. this.xmpp = require("./modules/xmpp/xmpp");
  25. this.keyboardshortcut =
  26. require("./modules/keyboardshortcut/keyboardshortcut");
  27. this.translation = require("./modules/translation/translation");
  28. this.settings = require("./modules/settings/Settings");
  29. //this.DTMF = require("./modules/DTMF/DTMF");
  30. this.members = require("./modules/members/MemberList");
  31. this.configFetch = require("./modules/config/HttpConfigFetch");
  32. }
  33. };
  34. function init() {
  35. APP.desktopsharing.init();
  36. APP.RTC.start();
  37. APP.xmpp.start();
  38. APP.statistics.start();
  39. APP.connectionquality.init();
  40. APP.keyboardshortcut.init();
  41. APP.members.start();
  42. }
  43. /**
  44. * If we have HTTP endpoint for getting confgi.json configured we're going to
  45. * read it and override properties from config.js and interfaceConfig.js.
  46. * If there is no endpoint we'll just continue with initialization.
  47. * Keep in mind that if the endpoint has been configured and we fail to obtain
  48. * the config for any reason then the conference won't start and error message
  49. * will be displayed to the user.
  50. */
  51. function obtainConfigAndInit() {
  52. if (config.configLocation) {
  53. APP.configFetch.obtainConfig(
  54. config.configLocation, APP.UI.getRoomNode(),
  55. // Get config result callback
  56. function(success, error) {
  57. if (success) {
  58. init();
  59. } else {
  60. // Show obtain config error,
  61. // pass the error object for report
  62. APP.UI.messageHandler.openReportDialog(
  63. null, "dialog.connectError", error);
  64. }
  65. });
  66. } else {
  67. init();
  68. }
  69. }
  70. $(document).ready(function () {
  71. var URLProcessor = require("./modules/config/URLProcessor");
  72. URLProcessor.setConfigParametersFromUrl();
  73. APP.init();
  74. APP.translation.init();
  75. if(APP.API.isEnabled())
  76. APP.API.init();
  77. APP.UI.start(obtainConfigAndInit);
  78. });
  79. $(window).bind('beforeunload', function () {
  80. if(APP.API.isEnabled())
  81. APP.API.dispose();
  82. });
  83. module.exports = APP;