-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.js
More file actions
58 lines (50 loc) · 1.78 KB
/
main.js
File metadata and controls
58 lines (50 loc) · 1.78 KB
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
(function(factory) {
// Module systems magic dance.
if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
// CommonJS or Node: hard-coded dependency on "app"
factory(require("app"));
} else if (typeof define === "function" && define["amd"]) {
// AMD anonymous module with hard-coded dependency on "app"
if (app) {
factory(app);
} else {
define(["node_modules/app"], factory);
}
} else {
// <script> tag: use the global `app` object
factory(app);
}
}(function(app) {
document.getElementById('selectAll').addEventListener("click",selectAll);
document.getElementById('json').addEventListener("click",jsonGen);
document.getElementById('tsql').addEventListener("click",tsqlGen);
function jsonGen(){
app.reporter = app.jsonReporter;
generate();
}
function tsqlGen(){
app.reporter = app.sqlServerReporter;
generate();
}
function reset(){
document.getElementById('output').innerHTML = "";
document.getElementById('stats').innerHTML = "";
}
function generate() {
reset();
app.reporter.initialize();
var zzaGenerator = new app.ZzaGenerator();
zzaGenerator.makeCustomerOrders(); // Optional integer param limits number of customers
app.toOutput("");
var statsOut = app.statsOut;
statsOut("\n=== STATS ===");
statsOut(JSON.stringify(app.reporter.stats, null, 2));
}
function selectAll(){
var range = document.createRange();
range.selectNodeContents(document.getElementById('container'));
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}
}));