Added WoltLab/WCF/List as a shim for Set
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / WoltLab / WCF / 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
7 * @copyright 2001-2015 WoltLab GmbH
8 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
9 * @module WoltLab/WCF/Bootstrap
10 */
11define(
0127caf7 12 [
bd969ed4 13 'favico', 'enquire', 'WoltLab/WCF/Date/Time/Relative',
0127caf7 14 'UI/SimpleDropdown', 'WoltLab/WCF/UI/Mobile', 'WoltLab/WCF/UI/TabMenu', 'WoltLab/WCF/UI/FlexibleMenu',
bd969ed4 15 'UI/Dialog', 'WoltLab/WCF/UI/Tooltip', 'WoltLab/WCF/Language', 'WoltLab/WCF/Environment'
0127caf7
AE
16 ],
17 function(
bd969ed4
AE
18 favico, enquire, DateTimeRelative,
19 UISimpleDropdown, UIMobile, UITabMenu, UIFlexibleMenu,
20 UIDialog, UITooltip, Language, Environment
0127caf7 21 )
a3a09eff 22{
c318ad3b
AE
23 "use strict";
24
17e6272b
TD
25 window.Favico = favico;
26 window.enquire = enquire;
3f043599
TD
27 window.WCF.Language.get = Language.get;
28 window.WCF.Language.add = Language.add;
29 window.WCF.Language.addObject = Language.addObject;
17e6272b 30
a3a09eff
TD
31 /**
32 * @constructor
33 */
5d5ef727 34 function Bootstrap() {}
a3a09eff
TD
35 Bootstrap.prototype = {
36 /**
37 * Initializes the core UI modifications and unblocks jQuery's ready event.
38 */
39 setup: function() {
bd969ed4
AE
40 Environment.setup();
41
42 DateTimeRelative.setup();
43
44 UISimpleDropdown.setup();
09f7100b
AE
45 UIMobile.setup();
46 UITabMenu.setup();
71c93c40 47 UIFlexibleMenu.setup();
09f7100b
AE
48 UIDialog.setup();
49 UITooltip.setup();
a3a09eff 50
d63c6f77
AE
51 // convert method=get into method=post
52 var forms = document.querySelectorAll('form[method=get]');
53 for (var i = 0, length = forms.length; i < length; i++) {
54 forms[i].setAttribute('method', 'post');
55 }
56
bd969ed4 57 if (Environment.browser() === 'microsoft') {
d63c6f77
AE
58 window.onbeforeunload = function() {
59 /* Prevent "Back navigation caching" (http://msdn.microsoft.com/en-us/library/ie/dn265017%28v=vs.85%29.aspx) */
60 };
61 }
62
bd969ed4
AE
63 // DEBUG ONLY
64 var interval = 0;
65 interval = window.setInterval(function() {
66 if (typeof window.jQuery === 'function') {
67 window.clearInterval(interval);
68
69 window.jQuery.holdReady(false);
70 }
71 }, 20);
a3a09eff 72 }
c318ad3b 73 };
a3a09eff
TD
74
75 return new Bootstrap();
76});