Add WoltLab/WCF/Bootstrap
authorTim Düsterhus <duesterhus@woltlab.com>
Sun, 3 May 2015 21:31:59 +0000 (23:31 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Sun, 3 May 2015 21:37:39 +0000 (23:37 +0200)
com.woltlab.wcf/templates/headIncludeJavaScript.tpl
wcfsetup/install/files/js/WoltLab/WCF/Bootstrap.js [new file with mode: 0644]
wcfsetup/install/files/js/WoltLab/WCF/Core.js

index d10950f90c8e57f3cef80c4e8ff5d1b836c8cb3f..d48f00cac4a5e5318548dd79e733cd0042b6150b 100644 (file)
        define('enquire', [], function() { return window.enquire; });
        
        $.holdReady(true);
-       require(['Core'], function(core) {
-               core.setup();
+       require(['WoltLab/WCF/Bootstrap'], function(bootstrap) {
+               bootstrap.setup();
        });
        /*
        require(['WoltLab/WCF/Date/Time/Relative', 'UI/SimpleDropdown'], function(relative, dropdown) {
diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Bootstrap.js b/wcfsetup/install/files/js/WoltLab/WCF/Bootstrap.js
new file mode 100644 (file)
index 0000000..3163f09
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+ * Bootstraps WCF's JavaScript.
+ * It defines globals needed for backwards compatibility
+ * and runs modules that are needed on page load.
+ * 
+ * @author     Tim Duesterhus
+ * @copyright  2001-2015 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module     WoltLab/WCF/Bootstrap
+ */
+define(
+       [       'WoltLab/WCF/Date/Time/Relative', 'UI/SimpleDropdown', 'WoltLab/WCF/UI/Mobile', 'WoltLab/WCF/UI/TabMenu'], 
+       function(relativeTime,                     simpleDropdown,      uiMobile,                TabMenu)
+{
+       /**
+        * @constructor
+        */
+       function Bootstrap() { }
+       Bootstrap.prototype = {
+               /**
+                * Initializes the core UI modifications and unblocks jQuery's ready event.
+                */
+               setup: function() {
+                       relativeTime.setup();
+                       simpleDropdown.setup();
+                       uiMobile.setup();
+                       TabMenu.setup();
+                       
+                       $.holdReady(false);
+               }
+       }
+       
+       return new Bootstrap();
+});
index 78e9ffab4b825e06ff667af0a826c2cd9e64b635..2fb807aa8306ceada0451bd4f5757f03347cf7da 100644 (file)
@@ -6,7 +6,7 @@
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @module     WoltLab/WCF/Core
  */
-define(['jQuery'], function($) {
+define([], function() {
        "use strict";
        
        /**
@@ -14,20 +14,6 @@ define(['jQuery'], function($) {
         */
        function Core() {};
        Core.prototype = {
-               /**
-                * Initializes the core UI modifications and unblocks jQuery's ready event.
-                */
-               setup: function() {
-                       require(['WoltLab/WCF/Date/Time/Relative', 'UI/SimpleDropdown', 'WoltLab/WCF/UI/Mobile', 'WoltLab/WCF/UI/TabMenu'], function(relativeTime, simpleDropdown, uiMobile, TabMenu) {
-                               relativeTime.setup();
-                               simpleDropdown.setup();
-                               uiMobile.setup();
-                               TabMenu.init();
-                               
-                               $.holdReady(false);
-                       });
-               },
-               
                /**
                 * Merges objects with the first argument.
                 *