Some cleanup
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / WoltLab / WCF / Bootstrap.js
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(
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',
15 'UI/Dialog', 'WoltLab/WCF/UI/Tooltip'
16 ],
17 function(
18 $, favico, enquire, relativeTime,
19 simpleDropdown, UIMobile, UITabMenu, UIFlexibleMenu,
20 UIDialog, UITooltip
21 )
22 {
23 "use strict";
24
25 window.Favico = favico;
26 window.enquire = enquire;
27
28 /**
29 * @constructor
30 */
31 function Bootstrap() {}
32 Bootstrap.prototype = {
33 /**
34 * Initializes the core UI modifications and unblocks jQuery's ready event.
35 */
36 setup: function() {
37 relativeTime.setup();
38 simpleDropdown.setup();
39 UIMobile.setup();
40 UITabMenu.setup();
41 UIFlexibleMenu.setup();
42 UIDialog.setup();
43 UITooltip.setup();
44
45 // convert method=get into method=post
46 var forms = document.querySelectorAll('form[method=get]');
47 for (var i = 0, length = forms.length; i < length; i++) {
48 forms[i].setAttribute('method', 'post');
49 }
50
51 if ($.browser.msie) {
52 window.onbeforeunload = function() {
53 /* Prevent "Back navigation caching" (http://msdn.microsoft.com/en-us/library/ie/dn265017%28v=vs.85%29.aspx) */
54 };
55 }
56
57 $.holdReady(false);
58 }
59 };
60
61 return new Bootstrap();
62 });