Permalink
Browse files

Fixed more HTML gen bugs surrounding empty datavalues

  • Loading branch information...
leeclarke committed Mar 22, 2011
1 parent 6ca75ba commit de630c6f1798c010f88f6ccf42513d19e7aaf157
Showing with 12 additions and 9 deletions.
  1. +8 −7 background.html
  2. +4 −2 popup.html
View
@@ -71,7 +71,7 @@
if(data.$summary) microformat += ("<p class=\"summary\">" + data.$summary + "</p>\n");
if(data.$author) microformat += ("<p class=\"author\">" + data.$author + "</p>\n");
if(data.$published) microformat += ("<p>Published <span class=\"published\">" + data.$published + "</span></p>\n");
- if(data.$photos.length>0) {
+ if(data.$photos.length>0 && data.$photos[0].length > 0) {
microformat += ("<img src=\"" + data.$photos[0] + "\" class=\"photo\" style=\"height:140px;width:140px;border-width:0px;\" alt=\"" + data.$recName + "\">\n");
}
if(data.$summery) microformat += ("<p class=\"summery\">" + data.$summery + "</p>\n");
@@ -87,7 +87,7 @@
microformat += ("<span class=\"instructions\">" + data.$instructions + "</span>\n");
}
- if(data.$yield) microformat += ("<p>Yield:<span class=\"yield\">"+data.$yield+"</span></p>\n");
+ if(data.$yield) microformat += ("<p>Yield:<span class=\"yield\"> "+data.$yield+"</span></p>\n");
if(data.$preptime || data.$cooktime) {
microformat += "<span class=\"duration\">\n";
@@ -97,29 +97,30 @@
if(data.$preptime) {
prep = parseTime(data.$preptime);
- microformat += ("<p>Prep Time:<span class=\"preptime\"><span class=\"value-title\" title=\""+prep+"\"></span>"+data.$preptime+"</span></p>\n");
+ microformat += ("<p>Prep Time:<span class=\"preptime\"><span class=\"value-title\" title=\""+prep+"\"></span> "+data.$preptime+"</span></p>\n");
}
if(data.$cooktime) {
cook = parseTime(data.$cooktime);
- microformat += ("<p>Cook time:<span class=\"cooktime\"><span class=\"value-title\" title=\""+cook+"\"></span>"+data.$cooktime+"</span></p>\n");
+ microformat += ("<p>Cook time:<span class=\"cooktime\"><span class=\"value-title\" title=\""+cook+"\"></span> "+data.$cooktime+"</span></p>\n");
}
microformat += "</span>\n";
}
- if(data.$nutritions.length>0) {
+ if(data.$nutritions.length>0 && data.$nutritions[0].length >0) {
microformat +="<h2>Nutrition</h2>\n";
microformat +="<p>\n";
microformat +="<span class=\"nutrition\">"
for(n in data.$nutritions) {
- microformat += toProperCase(data.$nutritionTypes[n])+": <span class=\""+ (data.$nutritionTypes[n].replace(" ","")).toLowerCase() + "\">" +(data.$nutritions[n] + "</span>\n");
+ if(data.$nutritions[n].length >0)
+ microformat += toProperCase(data.$nutritionTypes[n])+": <span class=\""+ (data.$nutritionTypes[n].replace(" ","")).toLowerCase() + "\">" +(data.$nutritions[n] + "</span>\n");
}
microformat +="</span>\n</p>\n";
}
- if(data.$tags && data.$tags.length >0) {
+ if(data.$tags && data.$tags.length >0 && data.$tags[0].length > 0) {
var tagCode = [];
microformat +="<span>Tags: ";
for(t in data.$tags) {
View
@@ -1,3 +1,5 @@
+<! doctype html>
+<meta charset=utf-8>
<!- hRecipeHelper, a Chrome extention for building microformat compatable. Copyright (c) 2011 Lee Clarke LICENSE: GNU v2 -->
<link type="text/css" href="css/le-frog-cust/jquery-ui-1.8.10.custom.css" rel="Stylesheet" />
<link type="text/css" href="css/form-style.css" rel="Stylesheet" />
@@ -50,13 +52,13 @@
<img src="clearpixel.gif" width=465px height=1px>
</div>
<div id="tabs-2">
- <div><label for="results">Results</label><textarea id="results" name="results" rows="20" cols="40"></textarea></div>
+ <div><label for="results">Results</label><div><small>(Copy and paste below into the HTML edit area on your blog.)</small></div><textarea id="results" name="results" rows="20" cols="40"></textarea></div>
<img src="clearpixel.gif" width=465px height=1px>
</div>
<div id="tabs-3">
<div>
<p style="text-align: center;"><a href="https://github.com/leeclarke/hRecipeHelper/wiki" alt="help" style="color:#285c00;text-decoration: none;font-weight: bold;">Need help? Check the wiki!</a></p>
- <p><b>hRecipeHelper</b> makes it easy to include microformatted <a href="http://microformats.org/wiki/hrecipe" style="color:#285c00;text-decoration: none;font-weight: bold;">hRecipes</a> in your blogs and webpages ensuring that Google or any other Recipe related tool can easily read the Information. Version 1.0 supports hRecipe 0.22 Format and is compatable with Google search.</p>
+ <p><b>hRecipeHelper</b> makes it easy to include microformatted <a href="http://microformats.org/wiki/hrecipe" style="color:#285c00;text-decoration: none;font-weight: bold;">hRecipes</a> in your blogs and webpages ensuring that Google or any other Recipe related tool can easily read the Information. Version 1.2 supports hRecipe 0.22 Format and is compatable with Google search.</p>
<p><small><b>hRecipeHelper</b> is Free Software and distributed under a GNUv2 license, <a href="https://github.com/leeclarke/hRecipeHelper/blob/master/GNU_LICENSE" style="color:#285c00;text-decoration: none;font-weight: bold;">click</a> here if ya really want to know more!<br><br>
Copyright &copy 2011 <b>Lee Clarke</b></small></p>
</div>

0 comments on commit de630c6

Please sign in to comment.