From a3a09eff3e19eca761e0e2114e467d4bb6711cff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Sun, 3 May 2015 23:31:59 +0200 Subject: [PATCH] Add WoltLab/WCF/Bootstrap --- .../templates/headIncludeJavaScript.tpl | 4 +-- .../install/files/js/WoltLab/WCF/Bootstrap.js | 34 +++++++++++++++++++ wcfsetup/install/files/js/WoltLab/WCF/Core.js | 16 +-------- 3 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Bootstrap.js 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. * -- 2.20.1