~ubuntu-branches/ubuntu/precise/horizon/precise-updates

« back to all changes in this revision

Viewing changes to openstack-dashboard/dashboard/static/dashboard/js/horizon.js

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-02-17 10:12:25 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120217101225-5wulil2mv7f2nvnb
Tags: 2012.1~e4~20120217.1354-0ubuntu1
* debian/patches/openstack-config-settings.patch: Refreshed.
* debian/copyright: Updated copyright.
* debian/rules: Diable tests since it doesnt work without a
  virtualenv.
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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.
4
 
 *
5
 
 * Scripts that are dependent on functionality defined in the Horizon object
6
 
 * must be included after this script in templates/base.html.
7
 
 */
8
 
var Horizon = function() {
9
 
  var horizon = {};
10
 
  var initFunctions = [];
11
 
 
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.
16
 
   */
17
 
  horizon.addInitFunction = function(fn) {
18
 
    initFunctions.push(fn);
19
 
  };
20
 
 
21
 
  /* Call all initialization functions and clear the queue. */
22
 
  horizon.init = function() {
23
 
    $.each(initFunctions, function(ind, fn) {
24
 
      fn();
25
 
    });
26
 
 
27
 
    // Prevent multiple executions, just in case.
28
 
    initFunctions = [];
29
 
  };
30
 
 
31
 
  return horizon;
32
 
};
33
 
 
34
 
// Create the one and only horizon object.
35
 
var horizon = Horizon();
36
 
 
37
 
// Call init on DOM ready.
38
 
$(document).ready(horizon.init);