Commit | Line | Data |
---|---|---|
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 | */ | |
11 | define( | |
0127caf7 AE |
12 | [ |
13 | 'jquery', 'favico', 'enquire', 'WoltLab/WCF/Date/Time/Relative', | |
14 | 'UI/SimpleDropdown', 'WoltLab/WCF/UI/Mobile', 'WoltLab/WCF/UI/TabMenu', 'WoltLab/WCF/UI/FlexibleMenu', | |
6c0c61b5 | 15 | 'UI/Dialog', 'WoltLab/WCF/UI/Tooltip', 'WoltLab/WCF/Language' |
0127caf7 AE |
16 | ], |
17 | function( | |
18 | $, favico, enquire, relativeTime, | |
19 | simpleDropdown, UIMobile, UITabMenu, UIFlexibleMenu, | |
6c0c61b5 | 20 | UIDialog, UITooltip, Language |
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() { | |
40 | relativeTime.setup(); | |
41 | simpleDropdown.setup(); | |
09f7100b AE |
42 | UIMobile.setup(); |
43 | UITabMenu.setup(); | |
71c93c40 | 44 | UIFlexibleMenu.setup(); |
09f7100b AE |
45 | UIDialog.setup(); |
46 | UITooltip.setup(); | |
a3a09eff | 47 | |
d63c6f77 AE |
48 | // convert method=get into method=post |
49 | var forms = document.querySelectorAll('form[method=get]'); | |
50 | for (var i = 0, length = forms.length; i < length; i++) { | |
51 | forms[i].setAttribute('method', 'post'); | |
52 | } | |
53 | ||
54 | if ($.browser.msie) { | |
55 | window.onbeforeunload = function() { | |
56 | /* Prevent "Back navigation caching" (http://msdn.microsoft.com/en-us/library/ie/dn265017%28v=vs.85%29.aspx) */ | |
57 | }; | |
58 | } | |
59 | ||
a3a09eff TD |
60 | $.holdReady(false); |
61 | } | |
c318ad3b | 62 | }; |
a3a09eff TD |
63 | |
64 | return new Bootstrap(); | |
65 | }); |