Add missing overwriting of DevtoolsPackageInstallationDispatcher::getPackage()
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / WoltLabSuite / Core / Bootstrap.js
CommitLineData
a3a09eff
TD
1/**
2 * Bootstraps WCF's JavaScript.
3 * It defines globals needed for backwards compatibility
4 * and runs modules that are needed on page load.
5 *
6 * @author Tim Duesterhus
50d96bd8 7 * @copyright 2001-2017 WoltLab GmbH
a3a09eff 8 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
58d7e8f8 9 * @module WoltLabSuite/Core/Bootstrap
a3a09eff
TD
10 */
11define(
0127caf7 12 [
58d7e8f8
MS
13 'favico', 'enquire', 'perfect-scrollbar', 'WoltLabSuite/Core/Date/Time/Relative',
14 'Ui/SimpleDropdown', 'WoltLabSuite/Core/Ui/Mobile', 'WoltLabSuite/Core/Ui/TabMenu', 'WoltLabSuite/Core/Ui/FlexibleMenu',
15 'Ui/Dialog', 'WoltLabSuite/Core/Ui/Tooltip', 'WoltLabSuite/Core/Language', 'WoltLabSuite/Core/Environment',
16 'WoltLabSuite/Core/Date/Picker', 'EventHandler', 'Core', 'WoltLabSuite/Core/Ui/Page/JumpToTop'
0127caf7
AE
17 ],
18 function(
f317bc66 19 favico, enquire, perfectScrollbar, DateTimeRelative,
9a421cc7
AE
20 UiSimpleDropdown, UiMobile, UiTabMenu, UiFlexibleMenu,
21 UiDialog, UiTooltip, Language, Environment,
d0f8cab0 22 DatePicker, EventHandler, Core, UiPageJumpToTop
0127caf7 23 )
a3a09eff 24{
c318ad3b
AE
25 "use strict";
26
b7f79b30 27 // perfectScrollbar does not need to be bound anywhere, it just has to be loaded for WCF.js
17e6272b
TD
28 window.Favico = favico;
29 window.enquire = enquire;
46badb6a
TD
30 // non strict equals by intent
31 if (window.WCF == null) window.WCF = { };
32 if (window.WCF.Language == null) window.WCF.Language = { };
3f043599
TD
33 window.WCF.Language.get = Language.get;
34 window.WCF.Language.add = Language.add;
35 window.WCF.Language.addObject = Language.addObject;
17e6272b 36
126b3f33
AE
37 // WCF.System.Event compatibility
38 window.__wcf_bc_eventHandler = EventHandler;
39
a3a09eff 40 /**
58d7e8f8 41 * @exports WoltLabSuite/Core/Bootstrap
a3a09eff 42 */
cbbb348c 43 return {
a3a09eff
TD
44 /**
45 * Initializes the core UI modifications and unblocks jQuery's ready event.
cbbb348c
AE
46 *
47 * @param {Object=} options initialization options
a3a09eff 48 */
cbbb348c
AE
49 setup: function(options) {
50 options = Core.extend({
51 enableMobileMenu: true
52 }, options);
53
bd969ed4
AE
54 Environment.setup();
55
56 DateTimeRelative.setup();
f317bc66 57 DatePicker.init();
bd969ed4 58
9a421cc7 59 UiSimpleDropdown.setup();
cbbb348c
AE
60 UiMobile.setup({
61 enableMobileMenu: options.enableMobileMenu
62 });
9a421cc7 63 UiTabMenu.setup();
b8eab696 64 //UiFlexibleMenu.setup();
9a421cc7
AE
65 UiDialog.setup();
66 UiTooltip.setup();
a3a09eff 67
d0f8cab0
AE
68 new UiPageJumpToTop();
69
d63c6f77 70 // convert method=get into method=post
d0023381 71 var forms = elBySelAll('form[method=get]');
d63c6f77
AE
72 for (var i = 0, length = forms.length; i < length; i++) {
73 forms[i].setAttribute('method', 'post');
74 }
75
bd969ed4 76 if (Environment.browser() === 'microsoft') {
d63c6f77
AE
77 window.onbeforeunload = function() {
78 /* Prevent "Back navigation caching" (http://msdn.microsoft.com/en-us/library/ie/dn265017%28v=vs.85%29.aspx) */
79 };
80 }
81
bd969ed4
AE
82 // DEBUG ONLY
83 var interval = 0;
84 interval = window.setInterval(function() {
85 if (typeof window.jQuery === 'function') {
86 window.clearInterval(interval);
87
88 window.jQuery.holdReady(false);
89 }
90 }, 20);
a3a09eff 91 }
c318ad3b 92 };
a3a09eff 93});