diff options
Diffstat (limited to 'src/scenario/bootstrap.js')
| -rw-r--r-- | src/scenario/bootstrap.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/scenario/bootstrap.js b/src/scenario/bootstrap.js new file mode 100644 index 00000000..694d0e97 --- /dev/null +++ b/src/scenario/bootstrap.js @@ -0,0 +1,44 @@ +(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.angular = { + scenario: { + dsl: window + } + }; + + window.onload = function(){ + _.defer(function(){ + $scenarioRunner.run(jQuery(window.document.body)); + }); + (onLoadDelegate||function(){})(); + }; + addCSS("../../css/angular-scenario.css"); + addScript("../../lib/underscore/underscore.js"); + addScript("../../lib/jquery/jquery-1.4.2.js"); + addScript("Runner.js"); + addScript("../Angular.js"); + addScript("../JSON.js"); + addScript("DSL.js"); + document.write('<script type="text/javascript">' + + '$scenarioRunner = new angular.scenario.Runner(window, jQuery);' + + '</script>'); +})(window.onload); + |
