summaryrefslogtreecommitdiff
path: root/js/app.js
blob: 6b60d3b5c2b8eaaa1f8eb1da0368accf2e19c277 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
var config = {};
config.images = [];

function app(){};
app.init = function(){
	app.load();
}
app.load = function(){
	app.loader = new Loader ();
	app.loader.register("loading");
	
	app.flatfiles = [
	  new Flatfile ("vegan", "products.default.txt")
	, new Flatfile ("dairy", "products.dairy.txt")
	, new Flatfile ("esoteric", "products.esoteric.txt")
	, new Flatfile ("meat", "products.meat.txt")
	, new Flatfile ("seafood", "products.seafood.txt")
	, new Flatfile ("weird", "products.esoteric.txt")
	, new Flatfile ("techniques", "techniques.txt")
	, new Flatfile ("preparations", "preparations.txt")
	];
	
	app.loader.ready("loading");
}

app.ready = function(){
	console.log("READY");
	app.bind();
	app.generate();
}

app.bind = function(){
	$("#generate").click(app.generate);
}

app.generate = function(){
	window.products = [].concat(vegan,meat,dairy,seafood);
	var texts = [];
	for (var i = 0; i < courses.length; i++) {
		var courseName = courses[i][0];
		var text = "<h2>" + courseName + "</h2>";
		for (var j = 1; j < courses[i].length; j++) {
			text += "<p>" + dish(courses[i][j]) + "</p>";
		}
		texts.push(text);
	}
	console.log(texts)
	$("#result").html(texts.join(""));
}