summaryrefslogtreecommitdiff
path: root/js/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/app.js')
-rwxr-xr-x[-rw-r--r--]js/app.js33
1 files changed, 29 insertions, 4 deletions
diff --git a/js/app.js b/js/app.js
index 847b9a7..fa2711e 100644..100755
--- a/js/app.js
+++ b/js/app.js
@@ -1,5 +1,6 @@
var config = {};
config.images = [];
+window.mode = 'omnivore'
function app(){};
app.init = function(){
@@ -15,9 +16,15 @@ app.load = function(){
, 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")
+ , new Flatfile ("cereal", "cereal.txt")
+ , new Flatfile ("diseases", "diseases.txt")
+ , new Flatfile ("drugs", "drugs.txt")
+ , new Flatfile ("elements", "elements.txt")
+ , new Flatfile ("insects", "insects.txt")
+ , new Flatfile ("sf", "sf.txt")
+ , new Flatfile ("religions", "religions.txt")
];
app.loader.ready("loading");
@@ -31,20 +38,38 @@ app.ready = function(){
app.bind = function(){
$("#generate").click(app.generate);
+ $(".switch").click(app.switch_mode);
+}
+
+app.switch_mode = function(){
+ window.mode = $(this).html()
+ $('.active').removeClass('active')
+ $(this).addClass('active')
+ app.generate()
}
app.generate = function(){
- window.products = [].concat(vegan,meat,dairy,seafood);
+ if (mode == 'omnivore') {
+ window.products = [].concat(vegan,meat,dairy,seafood);
+ } else if (mode == 'vegan') {
+ window.products = [].concat(vegan);
+ } else if (mode == 'weirdo') {
+ window.products = [].concat(vegan,meat,dairy,seafood,esoteric);
+ } else {
+ window.products = [].concat(window[mode])
+ }
+console.log(window.products)
var texts = [];
for (var i = 0; i < courses.length; i++) {
var courseName = courses[i][0];
var text = "<h2>" + courseName + "</h2>";
+ var course = []
for (var j = 1; j < courses[i].length; j++) {
- text += "<p>" + course(courses[i][j]) + "</p>";
+ course.push( dish(courses[i][j]) )
}
+ text += "<p>" + course.join(", ") + "</p>"
texts.push(text);
}
- console.log(texts)
$("#result").html(texts.join(""));
}