-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
105 lines (84 loc) · 2.67 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
*
* Vendor Imports
*
*/
window.Zebra_DatePicker = require('zebra_datepicker');
window.select2 = require('select2');
window.swal = require('sweetalert2');
/**
*
* Helper Imports
*
*/
window.viewportDimensions = require('./components/viewportDimensions');
window.TokenMismatch = require('./components/TokenMismatch.js');
window.ShowValidationErrors = require('./components/ShowValidationErrors.js');
window.ClearValidationErrors = require('./components/ClearValidationErrors.js');
window.Flash = require('./components/Flash.js');
/**
*
* Module Imports
*
*/
import SelectStyles from "./components/SelectStyles";
import ScrollToId from "./components/ScrollToId";
import Confirm from "./components/Confirm";
import AjaxForm from "./components/AjaxForm";
import SubmitButtonOnClick from "./components/SubmitButtonOnClick";
import Modal from "./components/Modal";
import DatePicker from "./components/DatePicker";
import AutoSubmit from './components/AutoSubmit';
import OnPageSearch from './components/OnPageSearch';
import Graph from './components/Graph';
import ToolTip from './components/ToolTip';
import CopyToClipboard from './components/CopyToClipboard';
import DragAndDrop from './components/DragAndDrop';
import DropzoneHandler from './components/DropzoneHandler';
(function($) {
var App = {
// All pages
common: {
init: function() {
new Flash.onLoad();
new SelectStyles();
new ScrollToId().onClick();
new Confirm();
new AjaxForm();
new SubmitButtonOnClick();
new Modal();
new DatePicker();
new AutoSubmit();
new OnPageSearch();
new Graph();
new ToolTip();
new CopyToClipboard();
new DragAndDrop();
new DropzoneHandler();
}
},
about_us: {
init: function() {
// Example page
}
},
};
// The routing fires all common scripts, followed by the page specific scripts.
// Add additional events for more control over timing e.g. a finalize event
var UTIL = {
fire: function(func, funcname, args) {
var namespace = App;
funcname = (funcname === undefined) ? 'init' : funcname;
if (func !== '' && namespace[func] && typeof namespace[func][funcname] === 'function') {
namespace[func][funcname](args);
}
},
loadEvents: function() {
UTIL.fire('common');
$.each(document.body.className.replace(/-/g, '_').split(/\s+/),function(i,classnm) {
UTIL.fire(classnm);
});
}
};
$(document).ready(UTIL.loadEvents());
})(jQuery); // Fully reference jQuery after this point.