aboutsummaryrefslogtreecommitdiffstats
path: root/src/scenario/bootstrap.js
blob: 81272bdd25aabb29705b0fd24c848c1c55cb1df0 (plain)
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
(function(onLoadDelegate){
  var prefix = (function(){
    var filename = /(.*\/)bootstrap.js(#(.*))?/;
    var scripts = document.getElementsByTagName("script");
    for(var j = 0; j < scripts.length; j++) {
      var src = scripts[j].src;
      if (src && src.match(filename)) {
        var parts = src.match(filename);
        return parts[1];
      }
    }
  })();
  function addScript(path) {
    document.write('<script type="text/javascript" src="' + prefix + path + '"></script>');
  }

  function addCSS(path) {
    document.write('<link rel="stylesheet" type="text/css" href="' + prefix + path + '"/>');
  }

  window.onload = function(){
    _.defer(function(){
      $scenarioRunner.run(jQuery(document.body));
    });
    (onLoadDelegate||function(){})();
  };
  addCSS("../../css/angular-scenario.css");
  addScript("../../lib/underscore/underscore.js");
  addScript("../../lib/jquery/jquery-1.4.2.js");
  addScript("../angular-bootstrap.js");
  addScript("Runner.js");
  document.write('<script type="text/javascript">$scenarioRunner = new angular.scenario.Runner(window);</script>');
})(window.onload);