main.js 5.2 KB

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