basic working recipe app

This commit is contained in:
Martin Donnelly 2016-02-24 13:31:29 +00:00
parent b6da7161f8
commit 4bce53d91b
7 changed files with 742 additions and 819 deletions

View File

@ -164,4 +164,11 @@ buttons {
#sidedrawer .entry {
padding-bottom: 5px;
border-bottom:1px solid #e0c0e0;
}
padding-right: 16px;
}
#sidedrawer .entry:after {
font-family:Linearicons-Free;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;
float:right;
content:"\e87a"
}

53
app/css/md.css Normal file
View File

@ -0,0 +1,53 @@
body {
font-family: 'Roboto Slab', "Helvetica Neue", Helvetica, Arial;
}
ul {
margin: 0;
padding: 0;
}
li {
display: inline;
margin: 0;
padding: 0 4px 0 0;
}
.dates {
padding: 2px;
border: solid 1px #80007e;
background-color: #ffffff;
}
#btc, #fx {
font-size: 75%;
}
.up, .ontime {
color: darkgreen;
}
.down, .delayed {
color: darkred;
}
.nochange {
color: #000000;
}
.password {
border: 1px solid #cccccc;
background-color: #efefef;
font-family: monospace;
white-space: pre;
}
.mui--text-danger {
color: #F44336;
}
.fnBlock {
font-size:20px;
}
.fnRefresh {
}

View File

@ -4,8 +4,11 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//fonts.googleapis.com/css?family=Roboto+Slab:400,300,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="//cdn.linearicons.com/free/1.0.0/icon-font.min.css">
<link href="//cdn.muicss.com/mui-0.4.6/css/mui.min.css" rel="stylesheet" type="text/css" />
<link href="css/app.css" rel="stylesheet" type="text/css" />
<link href="css/md.css" rel="stylesheet" type="text/css" />
<script src="//cdn.muicss.com/mui-0.4.6/js/mui.min.js"></script>
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="libs/ejs.js"></script>
@ -16,10 +19,22 @@
<div id="sidedrawer" class="mui--no-user-select">
<div id="sidedrawer-brand" class="mui--appbar-line-height mui--text-title">Recipes</div>
<div class="mui-divider"></div>
<div id="functions" class="fnBlock">
<span id="fnRefresh" class="lnr lnr-sync"></span>
<span id="fnSearch" class="lnr lnr-magnifier"></span>
</div>
<div id='searchbox' class="mui-textfield" style="display: none;">
<input id='newsearch' type="text" placeholder="Search for..">
</div>
<div class="mui-divider"></div>
<div id="listContainer">
</div>
<div class="mui-divider"><div id="addNew">+ Add</div></div>
<div class="mui-divider"></div>
<div class="mui-textfield">
<input id='newurl' type="text" placeholder="Add new url">
<div id="addstatus" style="display:none;">Adding...</div>
</div>
</div>
<header id="header">
<div class="mui-appbar mui--appbar-line-height">

View File

@ -1,6 +1,19 @@
/**
* Created by Martin on 24/02/2016.
*/
$.fn.pressEnter = function (fn) {
return this.each(function () {
$(this).bind('enterPress', fn);
$(this).keyup(function (e) {
if (e.keyCode == 13) {
$(this).trigger("enterPress");
}
})
});
};
(function () {
"use strict";
console.log('GO!');
@ -41,7 +54,7 @@
},
success: function (data) {
console.log(data);
// console.log(data);
displayPage(data);
},
error: function (xhr, type) {
@ -72,7 +85,7 @@
},
success: function (data) {
console.log(data);
// console.log(data);
displayList(data);
},
error: function (xhr, type) {
@ -101,7 +114,7 @@
},
success: function (data) {
console.log(data);
// console.log(data);
// displayList(data);
},
error: function (xhr, type) {
@ -116,14 +129,22 @@
getList();
};
$('#addNew').click(function () {
var url = prompt("Please enter a new url", "");
$('#newurl').pressEnter(function () {
var url = $(this).val();
if (url != null) {
console.log('Adding: ' + url);
addNew(url);
$('#addstatus').fadeIn(400).delay(1500).fadeOut(400);
$(this).val('');
setTimeout((function () {
getList();
}), 5000);
}
});
$('#fnRefresh').on('click', function () {
getList();
});
start();
})();

File diff suppressed because it is too large Load Diff

View File

@ -68,11 +68,12 @@ function cleaner(b) {
}
function insertRecipe(obj) {
logger.debug(obj);
// logger.debug(obj);
db.run('BEGIN TRANSACTION');
db.run('INSERT INTO `recipes`(`url`,`html`,`reduced`,`title`) VALUES (?,?,?,?);', obj);
db.run('commit');
logger.debug('Insert done..');
}
var doInsertRecipe = (obj) =>{
@ -116,7 +117,7 @@ function genericGrab(url) {
logger.debug(tdihbody.length);
tdihbody = cleaner(tdihbody);
logger.debug(title);
fs.writeFileSync(htmlfile, tdihbody.html());
// fs.writeFileSync(htmlfile, tdihbody.html());
obj.push(url);
obj.push($.html());
obj.push(tdihbody.html());
@ -124,7 +125,7 @@ function genericGrab(url) {
busEmitter.emit("saveRecipeData", obj);
}
fs.writeFileSync(bodyfile, $.html());
// fs.writeFileSync(bodyfile, $.html());
});
}
@ -198,6 +199,9 @@ router.post('/add', function(req, res) {
else {
logger.error('No data block!');
}
res.writeHead(200, {"ContentType": "application/json"});
//res.send(JSON.stringify(t));
res.end(JSON.stringify({adding:url}));
});

View File

@ -1,12 +1,12 @@
<!-- RDFa Breadcrumbs Plugin by Nitin Yawalkar --><div class="breadcrumb breadcrumbs"><div class="rdfa-breadcrumb"><div xmlns:v="http://rdf.data-vocabulary.org/#"><p><span class="breadcrumbs-title"> </span><span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="http://www.marksdailyapple.com/" class="home">Home</a></span> <span class="separator">&#xBB;</span> <span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="http://www.marksdailyapple.com/category/recipes/" title="Recipes">Recipes</a></span> <span class="separator">&#xBB;</span> Shakshuka (Eggs Poached in Spicy Tomato Sauce)</p></div></div></div><!-- RDFa Breadcrumbs Plugin by Nitin Yawalkar --> <div class="postLiner">
<!-- RDFa Breadcrumbs Plugin by Nitin Yawalkar --><div class="breadcrumb breadcrumbs"><div class="rdfa-breadcrumb"><div xmlns:v="http://rdf.data-vocabulary.org/#"><p><span class="breadcrumbs-title"> </span><span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="http://www.marksdailyapple.com/" class="home">Home</a></span> <span class="separator">&#xBB;</span> <span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="http://www.marksdailyapple.com/category/recipes/" title="Recipes">Recipes</a></span> <span class="separator">&#xBB;</span> Herb Chicken Cooked Under a Brick</p></div></div></div><!-- RDFa Breadcrumbs Plugin by Nitin Yawalkar --> <div class="postLiner">
<div class="postFlag">
<div>
1 Sep </div>
18 Aug </div>
</div>
<div class="postContent postContentInside">
<h1><a href="http://www.marksdailyapple.com/shakshuka-eggs-poached-in-spicy-tomato-sauce/" rel="bookmark" title="Permanent Link to Shakshuka (Eggs Poached in Spicy Tomato Sauce)">
Shakshuka (Eggs Poached in Spicy Tomato Sauce) </a></h1>
<h1><a href="http://www.marksdailyapple.com/herb-chicken-cooked-under-a-brick/" rel="bookmark" title="Permanent Link to Herb Chicken Cooked Under a Brick">
Herb Chicken Cooked Under a Brick </a></h1>
<div class="wwsgd" style="display:none;"><div style="border: thin dotted black; padding: 10px 10px 0 10px; margin-bottom: 10px;"><p>Welcome! If you want to lose weight, gain muscle, increase energy levels or just generally look and feel healthier you&apos;ve come to the right place.</p>
<p>Here&apos;s where to start:</p>
<ol>
@ -14,45 +14,43 @@
<li>Subscribe to my <a title="Subscribe" href="http://www.marksdailyapple.com/subscribe-to-blog/?utm_source=mda_wwsgd&amp;utm_medium=link&amp;utm_campaign=mda_wwsgd_newsletter" target="_blank">weekly newsletter</a> to receive an eBook called <em>Primal Blueprint Fitness</em> and more - all for free.</li>
<li>Cut to the chase by visiting <a title="PrimalBlueprint.com" href="https://www.primalblueprint.com/?utm_source=mda_wwsgd&amp;utm_medium=link&amp;utm_campaign=mda_wwsgd_pb_homepage" target="_blank">PrimalBlueprint.com</a>. There you&apos;ll find <a title="Books and Media" href="https://www.primalblueprint.com/books/?utm_source=mda_wwsgd&amp;utm_medium=link&amp;utm_campaign=mda_wwsgd_books" target="_blank">books</a>, <a title="Primal Kitchen" href="https://www.primalblueprint.com/primal-kitchen/mayo-12-oz/?utm_source=mda_wwsgd&amp;utm_medium=link&amp;utm_campaign=mda_wwsgd_food" target="_blank">food</a>, and the best <a title="Supplements" href="https://www.primalblueprint.com/supplements/?utm_source=mda_wwsgd&amp;utm_medium=link&amp;utm_campaign=mda_wwsgd_supplements" target="_blank">supplements</a> on the planet to help you take control of your health for life.</li>
</ol>
<p>Thanks for visiting!</p></div></div><p><img class="alignright" title="Shakshuka" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/shakshuka2.jpg" alt="" width="320" height="212">Whether you&#x2019;re looking for a new breakfast idea or are fond of serving breakfast for dinner, shakshuka fits the bill. Instead of calling the dish shakshuka you can also just call it &#x201C;Eggs Poached in Spicy Tomato Sauce&#x201D; because that&#x2019;s exactly what this straightforward but surprisingly delicious meal is.</p>
<p>Especially popular in Israel, shakshuka is loved around the world for its comforting flavor and simple preparation. Although the sauce is often sopped up with pita bread, it&#x2019;s thick enough that you can skip the bread and eat it with a spoon (or spread extra sauce over a hunk of <a title="How to Cook the Perfect Steak" href="http://www.marksdailyapple.com/how-to-cook-the-perfect-steak/#axzz1rkfvTaeG">grilled meat</a> for a really fantastic meal.)</p>
<p><span id="more-30717"></span></p>
<p>Most recipes for shakshuka call for <a title="Are Your Canned Foods Safe to Eat?" href="http://www.marksdailyapple.com/are-your-canned-foods-safe-to-eat-a-bpa-free-buying-guide/#axzz1rkfvTaeG">canned (or boxed) tomatoes</a>, but you shouldn&#x2019;t hesitate to use plump, super-ripe fresh tomatoes if you can find them. Tomatoes are the main ingredient in shakshuka and some say that little else, besides <a title="Egg Purchasing Guide" href="http://www.marksdailyapple.com/egg-purchasing-guide/">eggs</a> and garlic, should be added. However, this version leans in the direction of spicing things up with more flavor and variety. Onion, bell pepper, jalapeno, cumin and paprika make the meal more than just a pot of simmered tomatoes.</p>
<p>The eggs are added at the end and then cooked until just set. The contrasting flavors and textures in your bowl &#x2013; creamy, soft eggs swimming in thick, spicy sauce &#x2013; is what shakshuka is all about.</p>
<p><em> Servings: 4</em></p>
<p>Thanks for visiting!</p></div></div><p><img class="alignright" title="Brick Chicken" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/BrickChicken2.jpg" alt="" width="320" height="212">Who would&#x2019;ve guessed that the secret to the juiciest, most tender <a title="Choosing Chicken: A Primal Purchasing Guide " href="http://www.marksdailyapple.com/chicken-labels/#axzz2302s02YL">chicken</a> breast you&#x2019;ve ever tasted was a brick? Not a fancy culinary instrument that happens to be called a brick, but an actual brick, the type used to build houses and fireplaces and to landscape yards. A brick set on top of a cooking chicken applies just enough pressure to push the bird against the hot pan, crisping up the skin and cooking all the meat evenly and quickly before it dries out. The bird comes out juicy and tender on the inside, crispy and golden on the outside.</p>
<p><span id="more-30764"></span></p>
<p>As long as you have a few bricks laying around, the technique couldn&#x2019;t be easier. First, remove the backbone from the chicken so the bird can be splayed out flat. With a pair of kitchen shears, this is quick work. Next, rub the chicken down with something tasty. In this case, a smoky, herbal rub made from thyme, oregano, garlic and smoked paprika add tons of flavor. You can go this route, or use any of your own favorite rubs or <a title="How to Marinate Meat" href="http://www.marksdailyapple.com/how-to-marinate-meat/#axzz2302kCvBn">marinades</a>.</p>
<p>Now, it&#x2019;s time for the bricks to work their magic. Heat an ovenproof skillet on the stove and set the chicken in it, skin side down. Put the bricks on top and leave it alone for 6-8 minutes. Transfer the skillet to a hot oven and leave the chicken alone again, with bricks on top, for 20 minutes or so. Flip the bird, let it cook a little longer, and you&#x2019;re minutes away from tasting a culinary miracle. The chicken breasts are not only moist, they&#x2019;re down right succulent. The rest of the bird is amazing too. You might as well make room in your kitchen cupboard now to permanently store two bricks. After trying this recipe, you&#x2019;ll never want to roast chicken any other way.</p>
<p><strong>Ingredients:</strong></p>
<img class="alignnone" title="Ingredients" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/ingredients-28.jpg" alt="" width="540" height="378">
<img class="alignnone" title="Ingredients" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/ingredients-29.jpg" alt="" width="540" height="360">
<ul>
<li>1/4 cup olive oil</li>
<li>1 to 3 jalapeno peppers, (depending on how spicy you like it) seeded and finely chopped</li>
<li>1 green bell pepper, cut into thin strips</li>
<li>1 white or yellow onion, finely chopped</li>
<li>4 cloves of garlic, finely chopped</li>
<li>1/2 teaspoon ground cumin</li>
<li>2 teaspoons paprika</li>
<li>28-ounces whole peeled tomatoes in their juice or 2 pounds fresh tomatoes, chopped</li>
<li>4 to 6 eggs</li>
<li>1/4 cup roughly chopped parsley</li>
<li>Optional: crumbled feta cheese</li>
<li>Salt to taste</li>
<li>1 whole chicken, 3-4 pounds (approx 1.5 kg)</li>
<li>2 tablespoons oil (30 ml)</li>
<li>1 tablespoon fresh thyme (15 ml)</li>
<li>1 teaspoon dried oregano (5 ml)</li>
<li>1/4 teaspoon garlic powder (approx 1 ml)</li>
<li>1 teaspoon smoked paprika (5 ml)</li>
<li>1/2 teaspoon salt (2.5 ml)</li>
<li>1/4 teaspoon pepper (approx 1 ml)</li>
</ul>
<p><strong>Tools:</strong></p>
<ul>
<li>Ovenproof skillet</li>
<li>1-2 bricks, wrapped in foil</li>
</ul>
<p><strong>Instructions:</strong></p>
<p>Preheat the oven to 400 degrees Fahrenheit.</p>
<p>Heat olive oil over medium-high heat in a deep skillet. Add peppers and onion and saut&#xE9; until onion is lightly browned, about five minutes.</p>
<img class="alignnone" title="Step 1" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/step1-1.jpg" alt="" width="540" height="360">
<p>Add garlic, cumin and paprika and saut&#xE9; one minute more.</p>
<img class="alignnone" title="Step 2" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/step2-1.jpg" alt="" width="540" height="362">
<p>Add tomatoes. Break them apart with a large spoon or spatula as they cook. Reduce heat slightly and simmer 15-20 minutes (longer if tomatoes are fresh), stirring occasionally, until sauce has thickened and most of the liquid is gone. Add salt to taste.</p>
<img class="alignnone" title="Step 3" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/step3-1.jpg" alt="" width="540" height="360">
<p>Crack the eggs evenly around the skillet. Place the skillet in the oven and cook until the egg whites are set, 6-8 minutes.</p>
<img class="alignnone" title="Step 4" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/step4-1.jpg" alt="" width="540" height="369">
<p>Garnish with parsley (and feta). Serve warm.</p>
<p><img class="alignnone" title="Shakshuka" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/shakshuka1.jpg" alt="" width="540" height="374"><br>
<div id="df2vb41" class="dfads-javascript-load"></div>
<noscript></noscript>
</p>
<p>In a bowl, mix together 1 tablespoon (15 ml) of the oil with the thyme, oregano, garlic powder, paprika, salt and pepper. Set aside.</p>
<p>Set the chicken on a cutting board breast side down.</p>
<p>Starting at the tail, use a knife or better yet, kitchen shears, to cut all the way down the back, keeping as close to the backbone as you can. Then, cut down the other side of the backbone, splitting the chicken open. Remove the backbone.</p>
<img class="alignnone" title="Step 1" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/step1-2.jpg" alt="" width="540" height="441">
<img class="alignnone" title="Step 2" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/step2-2.jpg" alt="" width="540" height="360">
<p>Spread the chicken open, lightly pressing down to flatten it. Rub the spice mixture all over the chicken, getting some under the skin and directly onto the meat.</p>
<img class="alignnone" title="Step 3" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/step3-2.jpg" alt="" width="540" height="360">
<p>Preheat oven to 400 &#xB0;F (204 &#xB0;C)</p>
<p>Heat the remaining tablespoon of oil in a large ovenproof skillet over medium-high heat. When the skillet is really hot, add the chicken skin side down and place the bricks on top to push the bird down against the skillet. You can get away with using one brick if the chicken is small, but larger birds usually need two bricks.</p>
<img class="alignnone" title="Step 4" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/step4-2.jpg" alt="" width="540" height="360">
<p>Cook until the skin is golden brown, 6-8 minutes (it&#x2019;s okay to take the bricks off and peek).</p>
<img class="alignnone" title="Cooked Chicken" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/cooked_chicken.jpg" alt="" width="540" height="360">
<p>Put the skillet in the oven and roast the chicken with the bricks on top for 25 minutes. Take off the bricks and turn the chicken over. Put the bricks back on and roast another 10 or so minutes until the chicken is done. The juices should run clear when you pierce the bird with a fork; you can also stab it with a thermometer and make sure it reads at least 165 &#xB0;F (74 &#xB0;C).</p>
<p><img class="alignnone" title="Brick Chicken" src="http://cdn.marksdailyapple.com/wordpress/wp-content/themes/Marks-Daily-Apple-Responsive/images/blog2/BrickChicken2.jpg" alt="" width="540" height="360"><br>
<div></div></p>
<div class="clear"></div>
<div class="postFooter">