main.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. config = {
  2. baseUrl: '.',
  3. paths: {
  4. "backbone": "components/backbone/backbone",
  5. "backbone.browserStorage": "components/backbone.browserStorage/backbone.browserStorage",
  6. "backbone.overview": "components/backbone.overview/backbone.overview",
  7. "bootstrap": "components/bootstrap/dist/js/bootstrap", // XXX: Only required for https://conversejs.org website
  8. "converse-dependencies": "src/deps-website",
  9. "converse-templates": "src/templates",
  10. "eventemitter": "components/otr/build/dep/eventemitter",
  11. "jquery": "components/jquery/dist/jquery",
  12. "jquery.browser": "components/jquery.browser/dist/jquery.browser",
  13. "jquery.easing": "components/jquery-easing-original/jquery.easing.1.3", // XXX: Only required for https://conversejs.org website
  14. "moment": "components/momentjs/moment",
  15. "strophe": "components/strophe/strophe",
  16. "strophe.disco": "components/strophe.disco/index",
  17. "strophe.muc": "components/strophe.muc/index",
  18. "strophe.roster": "components/strophe.roster/index",
  19. "strophe.vcard": "components/strophe.vcard/index",
  20. "text": 'components/requirejs-text/text',
  21. "tpl": 'components/requirejs-tpl-jcbrand/tpl',
  22. "typeahead": "components/typeahead.js/dist/typeahead.jquery",
  23. "underscore": "components/underscore/underscore",
  24. "utils": "src/utils",
  25. // Off-the-record-encryption
  26. "bigint": "src/bigint",
  27. "crypto": "src/crypto",
  28. "crypto.aes": "components/otr/vendor/cryptojs/aes",
  29. "crypto.cipher-core": "components/otr/vendor/cryptojs/cipher-core",
  30. "crypto.core": "components/otr/vendor/cryptojs/core",
  31. "crypto.enc-base64": "components/otr/vendor/cryptojs/enc-base64",
  32. "crypto.evpkdf": "components/crypto-js-evanvosberg/src/evpkdf",
  33. "crypto.hmac": "components/otr/vendor/cryptojs/hmac",
  34. "crypto.md5": "components/crypto-js-evanvosberg/src/md5",
  35. "crypto.mode-ctr": "components/otr/vendor/cryptojs/mode-ctr",
  36. "crypto.pad-nopadding": "components/otr/vendor/cryptojs/pad-nopadding",
  37. "crypto.sha1": "components/otr/vendor/cryptojs/sha1",
  38. "crypto.sha256": "components/otr/vendor/cryptojs/sha256",
  39. "salsa20": "components/otr/build/dep/salsa20",
  40. "otr": "src/otr",
  41. // Locales paths
  42. "locales": "locale/locales",
  43. "jed": "components/jed/jed",
  44. "af": "locale/af/LC_MESSAGES/af",
  45. "de": "locale/de/LC_MESSAGES/de",
  46. "en": "locale/en/LC_MESSAGES/en",
  47. "es": "locale/es/LC_MESSAGES/es",
  48. "fr": "locale/fr/LC_MESSAGES/fr",
  49. "he": "locale/he/LC_MESSAGES/he",
  50. "hu": "locale/hu/LC_MESSAGES/hu",
  51. "id": "locale/id/LC_MESSAGES/id",
  52. "it": "locale/it/LC_MESSAGES/it",
  53. "ja": "locale/ja/LC_MESSAGES/ja",
  54. "nl": "locale/nl/LC_MESSAGES/nl",
  55. "pt_BR": "locale/pt_BR/LC_MESSAGES/pt_BR",
  56. "ru": "locale/ru/LC_MESSAGES/ru",
  57. "zh": "locale/zh/LC_MESSAGES/zh",
  58. // Templates
  59. "action": "src/templates/action",
  60. "add_contact_dropdown": "src/templates/add_contact_dropdown",
  61. "add_contact_form": "src/templates/add_contact_form",
  62. "change_status_message": "src/templates/change_status_message",
  63. "chat_status": "src/templates/chat_status",
  64. "chatarea": "src/templates/chatarea",
  65. "chatbox": "src/templates/chatbox",
  66. "chatroom": "src/templates/chatroom",
  67. "chatroom_password_form": "src/templates/chatroom_password_form",
  68. "chatroom_sidebar": "src/templates/chatroom_sidebar",
  69. "chatrooms_tab": "src/templates/chatrooms_tab",
  70. "chats_panel": "src/templates/chats_panel",
  71. "choose_status": "src/templates/choose_status",
  72. "contacts_panel": "src/templates/contacts_panel",
  73. "contacts_tab": "src/templates/contacts_tab",
  74. "controlbox": "src/templates/controlbox",
  75. "controlbox_toggle": "src/templates/controlbox_toggle",
  76. "field": "src/templates/field",
  77. "form_checkbox": "src/templates/form_checkbox",
  78. "form_input": "src/templates/form_input",
  79. "form_select": "src/templates/form_select",
  80. "group_header": "src/templates/group_header",
  81. "info": "src/templates/info",
  82. "login_panel": "src/templates/login_panel",
  83. "login_tab": "src/templates/login_tab",
  84. "message": "src/templates/message",
  85. "new_day": "src/templates/new_day",
  86. "occupant": "src/templates/occupant",
  87. "pending_contact": "src/templates/pending_contact",
  88. "pending_contacts": "src/templates/pending_contacts",
  89. "requesting_contact": "src/templates/requesting_contact",
  90. "requesting_contacts": "src/templates/requesting_contacts",
  91. "room_description": "src/templates/room_description",
  92. "room_item": "src/templates/room_item",
  93. "room_panel": "src/templates/room_panel",
  94. "roster": "src/templates/roster",
  95. "roster_item": "src/templates/roster_item",
  96. "search_contact": "src/templates/search_contact",
  97. "select_option": "src/templates/select_option",
  98. "status_option": "src/templates/status_option",
  99. "toggle_chats": "src/templates/toggle_chats",
  100. "toolbar": "src/templates/toolbar",
  101. "trimmed_chat": "src/templates/trimmed_chat"
  102. },
  103. tpl: {
  104. // Configuration for requirejs-tpl
  105. // Use Mustache style syntax for variable interpolation
  106. templateSettings: {
  107. evaluate : /\{\[([\s\S]+?)\]\}/g,
  108. interpolate : /\{\{([\s\S]+?)\}\}/g
  109. }
  110. },
  111. // define module dependencies for modules not using define
  112. shim: {
  113. 'backbone': {
  114. //These script dependencies should be loaded before loading
  115. //backbone.js
  116. deps: [
  117. 'underscore',
  118. 'jquery'
  119. ],
  120. //Once loaded, use the global 'Backbone' as the
  121. //module value.
  122. exports: 'Backbone'
  123. },
  124. 'underscore': { exports: '_' },
  125. 'bootstrap': { deps: ['jquery'] },
  126. 'crypto.aes': { deps: ['crypto.cipher-core'] },
  127. 'crypto.cipher-core': { deps: ['crypto.enc-base64', 'crypto.evpkdf'] },
  128. 'crypto.enc-base64': { deps: ['crypto.core'] },
  129. 'crypto.evpkdf': { deps: ['crypto.md5'] },
  130. 'crypto.hmac': { deps: ['crypto.core'] },
  131. 'crypto.md5': { deps: ['crypto.core'] },
  132. 'crypto.mode-ctr': { deps: ['crypto.cipher-core'] },
  133. 'crypto.pad-nopadding': { deps: ['crypto.cipher-core'] },
  134. 'crypto.sha1': { deps: ['crypto.core'] },
  135. 'crypto.sha256': { deps: ['crypto.core'] },
  136. 'bigint': { deps: ['crypto'] },
  137. 'typeahead': { deps: ['jquery'] },
  138. 'jquery.browser': { deps: ['jquery'] },
  139. 'jquery.easing': { deps: ['jquery'] },
  140. 'utils': { deps: ['jquery'] },
  141. 'strophe': { deps: ['jquery'] },
  142. 'strophe.disco': { deps: ['strophe'] },
  143. 'strophe.muc': { deps: ['strophe', 'jquery'] },
  144. 'strophe.roster': { deps: ['strophe'] },
  145. 'strophe.vcard': { deps: ['strophe'] }
  146. }
  147. };
  148. var initializeEasing = function () {
  149. /* XXX: This function initializes jquery.easing for the https://conversejs.org
  150. * website. This code is only useful in the context of the converse.js
  151. * website and converse.js itself is not dependent on it.
  152. */
  153. $(window).scroll(function() {
  154. if ($(".navbar").offset().top > 50) {
  155. $(".navbar-fixed-top").addClass("top-nav-collapse");
  156. } else {
  157. $(".navbar-fixed-top").removeClass("top-nav-collapse");
  158. }
  159. });
  160. //jQuery for page scrolling feature - requires jQuery Easing plugin
  161. $('.page-scroll a').bind('click', function(event) {
  162. var $anchor = $(this);
  163. $('html, body').stop().animate({
  164. scrollTop: $($anchor.attr('href')).offset().top
  165. }, 700, 'easeInOutExpo');
  166. event.preventDefault();
  167. });
  168. };
  169. if (typeof(require) !== 'undefined') {
  170. require.config(config);
  171. require(["jquery", "converse"], function($, converse) {
  172. window.converse = converse;
  173. initializeEasing(); // Only for https://conversejs.org website
  174. });
  175. }