1
/* This is the base Horizon JavaScript object. There is only ever one of these
2
* loaded (referenced as horizon with a lower-case h) which happens immediately
3
* after the definition below.
5
* Scripts that are dependent on functionality defined in the Horizon object
6
* must be included after this script in templates/base.html.
8
var Horizon = function() {
10
var initFunctions = [];
12
/* Use the addInitFunction() function to add initialization code which must
13
* be called on DOM ready. This is useful for adding things like event
14
* handlers or any other initialization functions which should preceed user
15
* interaction but rely on DOM readiness.
17
horizon.addInitFunction = function(fn) {
18
initFunctions.push(fn);
21
/* Call all initialization functions and clear the queue. */
22
horizon.init = function() {
23
$.each(initFunctions, function(ind, fn) {
27
// Prevent multiple executions, just in case.
34
// Create the one and only horizon object.
35
var horizon = Horizon();
37
// Call init on DOM ready.
38
$(document).ready(horizon.init);