浏览代码

Rework the way builds are created.

Builds are now themselves UMD modules, so they could be `require`'d like any
other AMD module or they can still be used as old ES5 modules with globals.

Additionally the build is now closured, so that the almond API doesn't pollute
the global context with `define` or `require`. This does however mean that
`require` can no longer be used outside of the build (unless requirej.s is
included directly.
JC Brand 8 年之前
父节点
当前提交
ac867c9524
共有 5 个文件被更改,包括 37 次插入61 次删除
  1. 1 6
      dev.html
  2. 33 38
      index.html
  3. 1 8
      src/converse-mobile.js
  4. 1 8
      src/converse.js
  5. 1 1
      tests.html

+ 1 - 6
dev.html

@@ -14,8 +14,7 @@
     <link type="text/css" rel="stylesheet" media="screen" href="css/theme.css" />
     <link type="text/css" rel="stylesheet" media="screen" href="css/converse.css" />
     <script src="node_modules/requirejs/require.js"></script>
-    <script src="config.js"></script>
-    <script src="src/converse.js"></script>
+    <script src="src/config.js"></script>
 </head>
 
 <body id="page-top" data-spy="scroll" data-target=".navbar-custom">
@@ -66,11 +65,7 @@
             ],
             auto_reconnect: true,
             bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes
-            keepalive: true,
-            message_carbons: true,
             message_archiving: 'always',
-            play_sounds: true,
-            roster_groups: true,
             show_controlbox_by_default: true,
             strict_plugin_dependencies: false,
             chatstate_notification_blacklist: ['mulles@movim.eu'],

+ 33 - 38
index.html

@@ -208,46 +208,41 @@
 </body>
 
 <script>
-    require(['converse'], function (converse) {
-        (function () {
-            /* XXX: This function initializes jquery.easing for the https://conversejs.org
-            * website. This code is only useful in the context of the converse.js
-            * website and converse.js itself is NOT dependent on it.
-            */
-            var $ = converse.env.jQuery;
-            $.extend( $.easing, {
-                easeInOutExpo: function (x, t, b, c, d) {
-                    if (t==0) return b;
-                    if (t==d) return b+c;
-                    if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
-                    return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
-                },
-            });
+    (function () {
+        /* XXX: This function initializes jquery.easing for the https://conversejs.org
+        * website. This code is only useful in the context of the converse.js
+        * website and converse.js itself is NOT dependent on it.
+        */
+        var $ = converse.env.jQuery;
+        $.extend( $.easing, {
+            easeInOutExpo: function (x, t, b, c, d) {
+                if (t==0) return b;
+                if (t==d) return b+c;
+                if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
+                return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
+            },
+        });
 
-            $(window).scroll(function() {
-                if ($(".navbar").offset().top > 50) {
-                    $(".navbar-fixed-top").addClass("top-nav-collapse");
-                } else {
-                    $(".navbar-fixed-top").removeClass("top-nav-collapse");
-                }
-            });
-            //jQuery for page scrolling feature - requires jQuery Easing plugin
-            $('.page-scroll a').bind('click', function(event) {
-                var $anchor = $(this);
-                $('html, body').stop().animate({
-                    scrollTop: $($anchor.attr('href')).offset().top
-                }, 700, 'easeInOutExpo');
-                event.preventDefault();
-            });
-        })();
-        converse.initialize({
-            // Please use this connection manager only for testing purposes
-            bosh_service_url: 'https://conversejs.org/http-bind/',
-            message_carbons: true,
-            play_sounds: true,
-            roster_groups: true,
-            show_controlbox_by_default: true,
+        $(window).scroll(function() {
+            if ($(".navbar").offset().top > 50) {
+                $(".navbar-fixed-top").addClass("top-nav-collapse");
+            } else {
+                $(".navbar-fixed-top").removeClass("top-nav-collapse");
+            }
+        });
+        //jQuery for page scrolling feature - requires jQuery Easing plugin
+        $('.page-scroll a').bind('click', function(event) {
+            var $anchor = $(this);
+            $('html, body').stop().animate({
+                scrollTop: $($anchor.attr('href')).offset().top
+            }, 700, 'easeInOutExpo');
+            event.preventDefault();
         });
+    })();
+    converse.initialize({
+        // Please use this connection manager only for testing purposes
+        bosh_service_url: 'https://conversejs.org/http-bind/',
+        show_controlbox_by_default: true,
     });
 </script>
 </html>

+ 1 - 8
src/converse-mobile.js

@@ -24,13 +24,6 @@ if (typeof define !== 'undefined') {
         "converse-headline",    // Support for headline messages
         /* END: Removable components */
     ], function (converse) {
-        var evt;
-        if (window.CustomEvent) {
-            evt = new CustomEvent('converse-loaded', {detail: {'converse': converse}});
-        } else {
-            evt = document.createEvent('CustomEvent');
-            evt.initCustomEvent('converse-loaded', true, true, {'converse': converse});
-        }
-        window.dispatchEvent(evt);
+        return converse;
     });
 }

+ 1 - 8
src/converse.js

@@ -26,13 +26,6 @@ if (typeof define !== 'undefined') {
         "converse-headline",    // Support for headline messages
         /* END: Removable components */
     ], function (converse) {
-        var evt;
-        if (window.CustomEvent) {
-            evt = new CustomEvent('converse-loaded', {detail: {'converse': converse}});
-        } else {
-            evt = document.createEvent('CustomEvent');
-            evt.initCustomEvent('converse-loaded', true, true, {'converse': converse});
-        }
-        window.dispatchEvent(evt);
+        return converse;
     });
 }

+ 1 - 1
tests.html

@@ -8,7 +8,7 @@
     <link rel="stylesheet" type="text/css" media="screen" href="css/jasmine.css">
     <link type="text/css" rel="stylesheet" media="screen" href="css/theme.css" />
     <link type="text/css" rel="stylesheet" media="screen" href="css/converse.css" />
-    <script src="config.js"></script>
+    <script src="src/config.js"></script>
     <script data-main="tests/main" src="node_modules/requirejs/require.js"></script>
     <style>
         .tests-brand-heading {