main.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. config = {
  2. baseUrl: '.',
  3. paths: {
  4. "jed": "components/jed/jed",
  5. "jquery": "components/jquery/dist/jquery",
  6. "jquery.browser": "components/jquery.browser/dist/jquery.browser",
  7. "jquery.easing": "components/jquery-easing-original/jquery.easing.1.3", // XXX: Only required for https://conversejs.org website
  8. "utils": "src/utils",
  9. "bootstrap": "components/bootstrap/dist/js/bootstrap", // XXX: Only required for https://conversejs.org website
  10. "locales": "locale/locales",
  11. "underscore": "components/underscore/underscore",
  12. "backbone": "components/backbone/backbone",
  13. "backbone.browserStorage": "components/backbone.browserStorage/backbone.browserStorage",
  14. "backbone.overview": "components/backbone.overview/backbone.overview",
  15. "typeahead": 'components/typeahead.js/dist/typeahead.jquery',
  16. "text": 'components/requirejs-text/text',
  17. "tpl": 'components/requirejs-tpl-jcbrand/tpl',
  18. "converse-templates": "src/templates",
  19. "strophe": "components/strophe/strophe",
  20. "strophe.muc": "components/strophe.muc/index",
  21. "strophe.roster": "components/strophe.roster/index",
  22. "strophe.vcard": "components/strophe.vcard/index",
  23. "strophe.disco": "components/strophe.disco/index",
  24. "salsa20": "components/otr/build/dep/salsa20",
  25. "bigint": "src/bigint",
  26. "crypto.core": "components/otr/vendor/cryptojs/core",
  27. "crypto.enc-base64": "components/otr/vendor/cryptojs/enc-base64",
  28. "crypto.md5": "components/crypto-js-evanvosberg/src/md5",
  29. "crypto.evpkdf": "components/crypto-js-evanvosberg/src/evpkdf",
  30. "crypto.cipher-core": "components/otr/vendor/cryptojs/cipher-core",
  31. "crypto.aes": "components/otr/vendor/cryptojs/aes",
  32. "crypto.sha1": "components/otr/vendor/cryptojs/sha1",
  33. "crypto.sha256": "components/otr/vendor/cryptojs/sha256",
  34. "crypto.hmac": "components/otr/vendor/cryptojs/hmac",
  35. "crypto.pad-nopadding": "components/otr/vendor/cryptojs/pad-nopadding",
  36. "crypto.mode-ctr": "components/otr/vendor/cryptojs/mode-ctr",
  37. "crypto": "src/crypto",
  38. "eventemitter": "components/otr/build/dep/eventemitter",
  39. "moment": "components/momentjs/moment",
  40. "otr": "src/otr",
  41. "converse-dependencies": "src/deps-website"
  42. },
  43. tpl: {
  44. // Use Mustache style syntax for variable interpolation
  45. templateSettings: {
  46. evaluate : /\{\[([\s\S]+?)\]\}/g,
  47. interpolate : /\{\{([\s\S]+?)\}\}/g
  48. }
  49. },
  50. // define module dependencies for modules not using define
  51. shim: {
  52. 'backbone': {
  53. //These script dependencies should be loaded before loading
  54. //backbone.js
  55. deps: [
  56. 'underscore',
  57. 'jquery'
  58. ],
  59. //Once loaded, use the global 'Backbone' as the
  60. //module value.
  61. exports: 'Backbone'
  62. },
  63. 'underscore': { exports: '_' },
  64. 'bootstrap': { deps: ['jquery'] },
  65. 'crypto.aes': { deps: ['crypto.cipher-core'] },
  66. 'crypto.cipher-core': { deps: ['crypto.enc-base64', 'crypto.evpkdf'] },
  67. 'crypto.enc-base64': { deps: ['crypto.core'] },
  68. 'crypto.evpkdf': { deps: ['crypto.md5'] },
  69. 'crypto.hmac': { deps: ['crypto.core'] },
  70. 'crypto.md5': { deps: ['crypto.core'] },
  71. 'crypto.mode-ctr': { deps: ['crypto.cipher-core'] },
  72. 'crypto.pad-nopadding': { deps: ['crypto.cipher-core'] },
  73. 'crypto.sha1': { deps: ['crypto.core'] },
  74. 'crypto.sha256': { deps: ['crypto.core'] },
  75. 'bigint': { deps: ['crypto'] },
  76. 'typeahead': { deps: ['jquery'] },
  77. 'jquery.browser': { deps: ['jquery'] },
  78. 'jquery.easing': { deps: ['jquery'] },
  79. 'utils': { deps: ['jquery'] },
  80. 'strophe': { deps: ['jquery'] },
  81. 'strophe.disco': { deps: ['strophe'] },
  82. 'strophe.muc': { deps: ['strophe', 'jquery'] },
  83. 'strophe.roster': { deps: ['strophe'] },
  84. 'strophe.vcard': { deps: ['strophe'] }
  85. }
  86. };
  87. var initializeEasing = function () {
  88. /* XXX: This function initializes jquery.easing for the https://conversejs.org
  89. * website. This code is only useful in the context of the converse.js
  90. * website and converse.js itself is not dependent on it.
  91. */
  92. $(window).scroll(function() {
  93. if ($(".navbar").offset().top > 50) {
  94. $(".navbar-fixed-top").addClass("top-nav-collapse");
  95. } else {
  96. $(".navbar-fixed-top").removeClass("top-nav-collapse");
  97. }
  98. });
  99. //jQuery for page scrolling feature - requires jQuery Easing plugin
  100. $('.page-scroll a').bind('click', function(event) {
  101. var $anchor = $(this);
  102. $('html, body').stop().animate({
  103. scrollTop: $($anchor.attr('href')).offset().top
  104. }, 700, 'easeInOutExpo');
  105. event.preventDefault();
  106. });
  107. };
  108. if (typeof(require) !== 'undefined') {
  109. require.config(config);
  110. require(["jquery", "converse"], function($, converse) {
  111. window.converse = converse;
  112. initializeEasing(); // Only for https://conversejs.org website
  113. });
  114. }