From: Tim Düsterhus Date: Sun, 3 May 2015 21:31:59 +0000 (+0200) Subject: Add WoltLab/WCF/Bootstrap X-Git-Tag: 3.0.0_Beta_1~2419 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a3a09eff3e19eca761e0e2114e467d4bb6711cff;p=GitHub%2FWoltLab%2FWCF.git Add WoltLab/WCF/Bootstrap --- diff --git a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl index d10950f90c..d48f00cac4 100644 --- a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl +++ b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl @@ -166,8 +166,8 @@ 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 index 0000000000..3163f09dc4 --- /dev/null +++ b/wcfsetup/install/files/js/WoltLab/WCF/Bootstrap.js @@ -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 + * @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(); +}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Core.js b/wcfsetup/install/files/js/WoltLab/WCF/Core.js index 78e9ffab4b..2fb807aa83 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Core.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Core.js @@ -6,7 +6,7 @@ * @license GNU Lesser General Public License * @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. *