diff options
| author | Jules <jules@asdf.us> | 2016-10-25 21:02:46 -0400 |
|---|---|---|
| committer | Jules <jules@asdf.us> | 2016-10-25 21:02:46 -0400 |
| commit | 54e052d6f29756ba2ee94c31b85fd49e30e335a0 (patch) | |
| tree | aacc0ccd8ee014b36f59bfb4e90d1cd2068a5c35 /js/app.js | |
| parent | 0003c072cb83f48386c5e264d86b0aa3a9eaa20d (diff) | |
buttons for other courses
Diffstat (limited to 'js/app.js')
| -rwxr-xr-x[-rw-r--r--] | js/app.js | 33 |
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("")); } |
