diff options
| -rwxr-xr-x[-rw-r--r--] | README | 2 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/cereal.txt | 23 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/diseases.txt | 18 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/drugs.txt | 38 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/elements.txt | 73 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/insects.txt | 29 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/preparations.txt | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/products.dairy.txt | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/products.default.txt | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/products.esoteric.txt | 2 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/products.meat.txt | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/products.seafood.txt | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/religions.txt | 40 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/sf.txt | 22 | ||||
| -rwxr-xr-x[-rw-r--r--] | data/techniques.txt | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | index.html | 62 | ||||
| -rwxr-xr-x[-rw-r--r--] | js/app.js | 33 | ||||
| -rwxr-xr-x[-rw-r--r--] | js/course.js | 10 | ||||
| -rwxr-xr-x[-rw-r--r--] | js/flatfile.js | 2 | ||||
| -rwxr-xr-x[-rw-r--r--] | js/jquery-2.0.3.min.js | 0 | ||||
| -rwxr-xr-x[-rw-r--r--] | js/loader.js | 3 | ||||
| -rwxr-xr-x[-rw-r--r--] | js/util.js | 0 |
22 files changed, 337 insertions, 20 deletions
@@ -3,7 +3,7 @@ delicious corpse Exquisite corpse style pairing game. -http://asdf.us/dc/ +http://asdf.us/corpse/ Original version 2006 Javascript port 2013 diff --git a/data/cereal.txt b/data/cereal.txt index 0f7fbdb..0d53a4b 100644..100755 --- a/data/cereal.txt +++ b/data/cereal.txt @@ -1 +1,22 @@ -boo berry, cap'n crunch, cheerio, cinnamon toast crunch, cocoa krispy, cookie crisp, corn pop, count chocola, crispy critter, frankenberry, frosted flake, fruit loop, fruity pebble, honey nut cheerio, honeycomb, life, lucky charm, rice krispy, sugar crisp, sugar smack, trix, weetabix +boo berry +cap'n crunch +cheerio +cinnamon toast crunch +cocoa krispy +cookie crisp +corn pop +count chocola +crispy critter +frankenberry +frosted flake +fruit loop +fruity pebble +honey nut cheerio +honeycomb +life +lucky charm +rice krispy +sugar crisp +sugar smack +trix +weetabix diff --git a/data/diseases.txt b/data/diseases.txt index 0fa0180..314ebdf 100644..100755 --- a/data/diseases.txt +++ b/data/diseases.txt @@ -1 +1,17 @@ -eczema, herpes, aids, ebola, cancer, rickets, scurvy, diabetes, emphysema, syphilis, gonnorhea, gout, polio, influenza, hodgkin's, lupus, parkinson's +eczema +herpes +aids +ebola +cancer +rickets +scurvy +diabetes +emphysema +syphilis +gonnorhea +gout +polio +influenza +hodgkin's +lupus +parkinson's diff --git a/data/drugs.txt b/data/drugs.txt index 7ce7542..591c1c3 100644..100755 --- a/data/drugs.txt +++ b/data/drugs.txt @@ -1 +1,37 @@ -2-cb, 2-ci, 2-ct-7, 5-MeO-DMT, amyl nitrate, angel dust, ayahuasca, black lotus, cocaine, crack, dmt, dxm, ecstasy, ganja, ghb, hashish, heroin, ibogaine, ketamine, lsd, marijuana, mda, mdma, mescaline, meth, nitrous oxide, opium, oxycontin, pcp, peyote, salvia, shroom, speed, thujone, toad venom, tonka bean, wormwood +2-cb +2-ci +2-ct-7 +5-MeO-DMT +amyl nitrate +angel dust +ayahuasca +black lotus +cocaine +crack +dmt +dxm +ecstasy +ganja +ghb +hashish +heroin +ibogaine +ketamine +lsd +marijuana +mda +mdma +mescaline +meth +nitrous oxide +opium +oxycontin +pcp +peyote +salvia +shroom +speed +thujone +toad venom +tonka bean +wormwood diff --git a/data/elements.txt b/data/elements.txt index 5044ae8..402fc39 100644..100755 --- a/data/elements.txt +++ b/data/elements.txt @@ -1,2 +1,73 @@ -actinum, aluminium, antimony, argon, arsenic, astatine, barium, beryllium, bismuth, bohrium, boron, bromine, cadmium, calcium, carbon, cesium, chlorine, chromium, cobalt, copper, flourine, francium, gallium, germanium, gold, helium, hydrogen, iodine, iridium, iron, krypton, lanthanum, lead, lithium, magnesium, manganese, mercury, molybdenum, neon, nickel, niobium, nitrogen, osmium, oxygen, palladium, phosphorus, platinum, polonium, potassium, radium, radon, rhenium, rhodium, rutherfordium, scandium, selenium, silicon, silver, sodium, strontium, sulphur, tellurium, thallium, tin, titanium, tungsten, unununium, vanadium, xenon, yttrium, zinc, zirconium +actinum +aluminium +antimony +argon +arsenic +astatine +barium +beryllium +bismuth +bohrium +boron +bromine +cadmium +calcium +carbon +cesium +chlorine +chromium +cobalt +copper +flourine +francium +gallium +germanium +gold +helium +hydrogen +iodine +iridium +iron +krypton +lanthanum +lead +lithium +magnesium +manganese +mercury +molybdenum +neon +nickel +niobium +nitrogen +osmium +oxygen +palladium +phosphorus +platinum +polonium +potassium +radium +radon +rhenium +rhodium +rutherfordium +scandium +selenium +silicon +silver +sodium +strontium +sulphur +tellurium +thallium +tin +titanium +tungsten +unununium +vanadium +xenon +yttrium +zinc +zirconium diff --git a/data/insects.txt b/data/insects.txt index 33584e0..ca811c9 100644..100755 --- a/data/insects.txt +++ b/data/insects.txt @@ -1,2 +1,29 @@ -ant, aphid, bee, beetle, butterfly, cicada, cockroach, cricket, cricket, dung beetle, earthworm, fly, fruit fly, grub, hornet, ladybug, larva, mealworm, moth, praying mantis, scorpion, sea worm, silkworm, spider, tarantula, termite, tick, wasp +ant +aphid +bee +beetle +butterfly +cicada +cockroach +cricket +cricket +dung beetle +earthworm +fly +fruit fly +grub +hornet +ladybug +larva +mealworm +moth +praying mantis +scorpion +sea worm +silkworm +spider +tarantula +termite +tick +wasp diff --git a/data/preparations.txt b/data/preparations.txt index 596d78f..596d78f 100644..100755 --- a/data/preparations.txt +++ b/data/preparations.txt diff --git a/data/products.dairy.txt b/data/products.dairy.txt index 2c2a6e1..2c2a6e1 100644..100755 --- a/data/products.dairy.txt +++ b/data/products.dairy.txt diff --git a/data/products.default.txt b/data/products.default.txt index bd6a82d..bd6a82d 100644..100755 --- a/data/products.default.txt +++ b/data/products.default.txt diff --git a/data/products.esoteric.txt b/data/products.esoteric.txt index ae30221..4dde54f 100644..100755 --- a/data/products.esoteric.txt +++ b/data/products.esoteric.txt @@ -1,4 +1,4 @@ -absinth +absinthe acorn alfalfa alligator diff --git a/data/products.meat.txt b/data/products.meat.txt index 85c78ea..85c78ea 100644..100755 --- a/data/products.meat.txt +++ b/data/products.meat.txt diff --git a/data/products.seafood.txt b/data/products.seafood.txt index 477cafe..477cafe 100644..100755 --- a/data/products.seafood.txt +++ b/data/products.seafood.txt diff --git a/data/religions.txt b/data/religions.txt index dc9f014..cfd1d29 100644..100755 --- a/data/religions.txt +++ b/data/religions.txt @@ -1 +1,39 @@ -agnostic, anglican, atheist, atheist, baha'i, baptist, born-again christian, buddhist, calvinist, christian scientist, congregationalist, cult, deist, eastern orthodox, episcopalian, greek orthodox, hindu, jehovah's witness, jewish, lutheran, methodist, moonie, mormon, muslim, presbyterian, quaker, rastafarian, roman catholic, russian orthodox, satanist, scientologist, shia, sikh, sunni, tribalist, unitarian, wiccan, zen, zoroastrian +agnostic +anglican +atheist +atheist +baha'i +baptist +born-again christian +buddhist +calvinist +christian scientist +congregationalist +cult +deist +eastern orthodox +episcopalian +greek orthodox +hindu +jehovah's witness +jewish +lutheran +methodist +moonie +mormon +muslim +presbyterian +quaker +rastafarian +roman catholic +russian orthodox +satanist +scientologist +shia +sikh +sunni +tribalist +unitarian +wiccan +zen +zoroastrian diff --git a/data/sf.txt b/data/sf.txt index c8b5b01..e4796c4 100644..100755 --- a/data/sf.txt +++ b/data/sf.txt @@ -1 +1,21 @@ -mission, bernal heights, noe valley, castro, tenderloin, chinatown, sunset, richmond, bayview, excelsior, potrero hill, nob hill, civic center, soma, marina, pacific heights, twin peaks, embarcadero, north beach, haight, hayes valley +mission +bernal heights +noe valley +castro +tenderloin +chinatown +sunset +richmond +bayview +excelsior +potrero hill +nob hill +civic center +soma +marina +pacific heights +twin peaks +embarcadero +north beach +haight +hayes valley diff --git a/data/techniques.txt b/data/techniques.txt index 733c2fd..733c2fd 100644..100755 --- a/data/techniques.txt +++ b/data/techniques.txt diff --git a/index.html b/index.html index 3b5e456..e65baa7 100644..100755 --- a/index.html +++ b/index.html @@ -3,12 +3,70 @@ <head> <title>Delicious Corpse</title> <style type="text/css"> +* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } +html,body { width: 100%;height:100%;margin:0;padding:0 } +body { + font-family: Georgia; + background: #ffa7c5; + font-size: 80%; +} +html { + padding: 20px; +} +h1,h2,h3 { + font-weight: normal; +} +h1 { + font-style: italic; +} +#content { + border: 2px #aaa dashed; + padding: 20px; + background: white; + text-align: center; + max-width: 500px; + margin: 0px auto; + height: 100%; +} +button { + cursor: pointer; +} +.active { + font-weight: bold; +} +button:nth-child(6n+1):hover { color: red } +button:nth-child(6n+2):hover { color: #f80 } +button:nth-child(6n+3):hover { color: lime } +button:nth-child(6n+4):hover { color: blue } +button:nth-child(6n+5):hover { color: #f0f } +button:nth-child(6n+6):hover { color: #80f } </style> </head> <body> -<button id="generate">New Menu</button> -<div id="result"></div> +<div id="content"> + <h1>~ delicious corpse ~</h1> + <h3>HERE IS YOUR RANDOMLY GENERATED MENU</h3> + <h3>PICK YOUR FAVORITE COURSES</h3> + <button id="generate">SHOW ME A NEW RANDOM MENU</button> + <br> + <br> + ~ or pick your favorite shopping list ~<br> + <button class="switch active">omnivore</button> + <button class="switch">vegan</button> + <br> + <button class="switch">cereal</button> + <button class="switch">weirdo</button> + <button class="switch">religions</button> + <button class="switch">sf</button> + <br> + <button class="switch">diseases</button> + <button class="switch">drugs</button> + <button class="switch">elements</button> + <button class="switch">insects</button> + + <div id="result"></div> +</div> <script type="text/javascript" src="js/jquery-2.0.3.min.js"></script> <script type="text/javascript" src="js/app.js"></script> 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("")); } diff --git a/js/course.js b/js/course.js index 2924eb6..2a35719 100644..100755 --- a/js/course.js +++ b/js/course.js @@ -14,11 +14,11 @@ function course(n) { var ds = [ dish() ]; return ds.join(", "); } -function dish(){ - var pcount = rand(3) + 1; +function dish(n){ + var pcount = n || rand(2) + 1; var ps = []; while (pcount-- > 0) ps.push(product()); - if (rand(100) > 60) { + if (rand(100) < 90) { var d = ps.join(" and ") + " " + choice(preparations); } else { @@ -28,7 +28,7 @@ function dish(){ } function product(){ var result; - if (rand(100) > 90) { + if (rand(100) > 1) { var technique = choice(techniques); if (technique[0] == '-') { result = choice(products) + technique + " " + choice(products); @@ -36,9 +36,11 @@ function product(){ result = technique + " " + choice(products) } } +/* else if (rand(100) > 0) { result = choice(products) + " " + choice(products) } +*/ else { result = choice(products) } diff --git a/js/flatfile.js b/js/flatfile.js index 1b6b132..89a6b17 100644..100755 --- a/js/flatfile.js +++ b/js/flatfile.js @@ -7,7 +7,7 @@ Flatfile.prototype.load = function(){ var _this = this; app.loader.register(this.key); $.get("data/" + this.filename, function(data) { - window[_this.key] = data.split("\n"); + window[_this.key] = data.split("\n").filter(function(a){ return a && a.length > 0 }); app.loader.ready(_this.key); }) }
\ No newline at end of file diff --git a/js/jquery-2.0.3.min.js b/js/jquery-2.0.3.min.js index 2be209d..2be209d 100644..100755 --- a/js/jquery-2.0.3.min.js +++ b/js/jquery-2.0.3.min.js diff --git a/js/loader.js b/js/loader.js index ddf4b7e..90f04c7 100644..100755 --- a/js/loader.js +++ b/js/loader.js @@ -21,6 +21,9 @@ app.load = function(){ } app.ready = function(){ } +// so basically he also puts a bunch of variables in the global namespace. Does that seem +// contradictory to an OOP approach? in global namespace where will be only app variable. no there are also +// ******************************************************/ function Loader (readyCallback){ diff --git a/js/util.js b/js/util.js index 5828a91..5828a91 100644..100755 --- a/js/util.js +++ b/js/util.js |
