This commit is contained in:
Jim Shepich III 2022-02-05 04:43:53 -05:00
parent a48e151296
commit e28fa0d9d1
4 changed files with 54 additions and 15 deletions

View File

@ -410,9 +410,10 @@
} }
] ]
}, },
"future_lists":{ "_test":{
"title":"Lists I Plan on Adding", "title":"Test",
"list":["My Favorite Movies","My Favorite Food",{"nested lists":["Useful Websites","Favorite foods",{"title":"cereals","dropdown":true,"list":["Cocoa Pebbles","Froot Loops"]}]}] "hidden":true,
"list":["My Favorite Movies",{"test":"It works"},"My Favorite Food",{"nested lists":["Useful Websites","Favorite foods",{"title":"cereals","dropdown":true,"list":["Cocoa Pebbles","Froot Loops"]}]}]
}, },
"foods":{ "foods":{
"title":"My Favorite Foods", "title":"My Favorite Foods",
@ -420,11 +421,29 @@
"sections":[ "sections":[
{ {
"title":"Breakfast", "title":"Breakfast",
"list":[{"Cereal":["Reese's Puffs","Honeycombs"]}, "Crepes"] "list":[{"Cereal":["Reese's Puffs","Honeycombs","Frosted Mini Wheats","Eggo Cereal","Froot Loops","Frosted Flakes"]}, "Crepes", "Pancakes","Bacon","Hash browns","Smokey links","French fries"]
}, },
{ {
"title":"Snacks", "title":"Snacks",
"list":["Pretzels","Popcorn"] "list":["Pretzels (especially Old Dutch)","Popcorn (especially Orville Redenbacher)",{"Cheese":["Swiss","Colby Jack","Cheddar","Mozzarella"]},{"Candy":["Take 5","Kit Kat","Snickers","Reese's cups","Milky Way",{"Gummy bears":["Albanese","Meijer brand"]}]}]
},
{
"title":"Fruits",
"description":"Here are some of my favorite fruits presented in a tier-list along with tips on how to get the best experience out of them. One metric I use to rank the fruits that you might find odd is the shelf life. The reason I care about the shelf life of my fruits is that I hate going to the grocery store, so I prefer fruits that I can stockpile.",
"sections":[
{
"title":"S-Tier",
"list":[{"Mango":"When you can smell the aroma through the skin, the mango is ready to eat. Usually takes around a week from when you buy them. I loved Rubicon mango juice so much as a kid that my grandparents went to Toronto to buy it for me. Mango is my preferred flavor of smoothie."},{"Watermelon":"The best watermelons sound hollow when you knock on them and have a faded spot on their rind. Nothing beats a cool, juicy watermelon on a warm summer afternoon."},{"Lychee":"Out of all the fruits on my list, I think lychees and watermelons are the only ones that are consistently sweet. Lychees dry out your mouth a little bit, which annoying, but it's also kinda neat because that's not what you'd expect from a fruit. Lychee flavored Ramune is awesome."}]
},
{
"title":"A-Tier",
"list":[{"Apple":"Loses points because they can be tough and hard to eat, and sometimes they just taste too sour, but follow my instructions and they'll usually be good. Plus, they can last up to 3 weeks on the shelf, and they're very versatile (apple juice, cider, doughnuts, pies, etc.). Honeycrisp is my favorite cultivar, and the best honeycrisps are the biggest and the yellowest. Apples usually taste better a week after you buy them. I'm also a fan of the Opal cultivar, which tastes like a cross-breed with pears."},{"Banana":"Taste is A-tier, but the short shelf life (and concomitant fruit flies) is a big negative. What brings them back is that bananas have such good synergy with other fruits (and other foods: see peanutbutter banana sandwich). Healthiest when they're green, sweetest when they're brown, and best when they're just yellow. I like to make banana smoothies: 150 mL milk, two bananas, a tablespoon of sugar, optionally a spoon or two of yogurt, and 7 ice cubes."},{"Peach":"Taste is S-tier, but they go bad way too fast and the window where they are soft enough to eat but not overripe is way too small. I've heard you can tell that a peach is ready to eat when it's as squishy as the meat of your thumb, but obviously I've still had issues."},{"Pear":"Like peaches, ripe pears taste divine. I don't like flavors that are too overpowering, and I find that pears are perfectly subtle. However, unless the pear is at the perfect point of ripeness, it is too tough to bite into and tastes starchy like an unripe banana."},{"Cherry":"It's hard to come by bad cherries in Michigan (just avoid the maraschinos). I'd say that the taste is B-tier, but they get points because the seeds are so fun to spit."},{"Clementine":"Ironically, the \"sweet orange\" can often be a bit too sour for my taste. Plus, I got the stomach flu during my orange juice phase, so I developed a bit of an aversion. But, clementines are usually pretty sweet, don't have that undertone that I dislike, and they last pretty long on the shelf."},{"Grape":"Grapes taste pretty good. They aren't super sweet or really juicy like other fruits, but they still taste good. The great advantage of grapes over all other fruits is that you don't need to wash your hands or your face after eating them because of their durable dry skin."}]
},
{
"title":"B-Tier",
"list":[{"Blueberry":"Good blueberries can be really good, but bad blueberries can be really sour and nasty, and the worst thing is that since they're so small, it's always a mixed bag when you buy them. I've noticed that blueberries, like apples, tend to follow a bigger is better rule."},{"Raspberry":"Like blueberries, raspberries are a mixed bag. On average, I'd say the taste of plain raspberries is C-tier, but raspberry jelly is really good, so here they are."},{"Apricot":"They have a good flavor, but like peaches and pears, apricots have a small window where they are squishy but not overripe."}]
}
]
} }
] ]
} }

View File

@ -95,7 +95,7 @@ function gen_list_html(list){
if(section.hasOwnProperty("dropdown") && section.dropdown){ if(section.hasOwnProperty("dropdown") && section.dropdown){
//If the section is marked with the "dropdown" attribute, then nest the section's data in a details/summary tag. //If the section is marked with the "dropdown" attribute, then nest the section's data in a details/summary tag.
section_html = `<details class="heading"><summary>${title}</summary>${description}${gen_list_html(section)}</details>`; section_html = `<details class="heading" open><summary>${title}</summary>${description}${gen_list_html(section)}</details>`;
} else { } else {
section_html = `${title}${description}${gen_list_html(section)}`; section_html = `${title}${description}${gen_list_html(section)}`;
} }
@ -185,6 +185,13 @@ function gen_item_html(item,type="default"){
break; break;
case "kv-pair": case "kv-pair":
console.log(item);
if(!(item.hasOwnProperty("k")&&item.hasOwnProperty("v"))||Object.keys(item).length==1){
var key = Object.keys(item)[0];
item["k"] = key;
item["v"] = item[key];
//If the item is an object containing a single key-value pair, then use that pair as the k and v for displaying.
}
if(item.hasOwnProperty("link")){ if(item.hasOwnProperty("link")){
item_html = `<span class="list-key"><a href="${item.link}" target="blank_">${item["k"]}</a></span>`; item_html = `<span class="list-key"><a href="${item.link}" target="blank_">${item["k"]}</a></span>`;
} else { } else {
@ -223,14 +230,19 @@ function gen_item_html(item,type="default"){
//If the element is a simple string or number, then we don't need to do any special formatting. //If the element is a simple string or number, then we don't need to do any special formatting.
} else if (typeof item === "object"){ } else if (typeof item === "object"){
var keys = Object.keys(item); var keys = Object.keys(item);
if(keys.length == 1 && Array.isArray(item[keys[0]])){ if(keys.length == 1){
var temp = { if (Array.isArray(item[keys[0]])){
"title":keys[0],
"type":"default",
"list":item[keys[0]]
};
//An item that is a dictionary only containing a list is probably a sublist. Format it as such, and pass it back through this switch statement. //An item that is a dictionary only containing a list is probably a sublist. Format it as such, and pass it back through this switch statement.
item_html = gen_item_html(temp,"sublist"); var temp = {
"title":keys[0],
"type":"default",
"list":item[keys[0]]
};
item_html = gen_item_html(temp,"sublist");
} else {
item_html = gen_item_html(item,"kv-pair");
//A item that is dictionary with one key, whose value is not a list, is to be treated as a term-explanation type key-value pair.
}
} else { } else {
item_html = gen_item_html(item,"sublist"); item_html = gen_item_html(item,"sublist");
//At this point, if there is no other specification, an item that's an object is probably a sublist. //At this point, if there is no other specification, an item that's an object is probably a sublist.

View File

@ -99,7 +99,7 @@ details{
} }
summary{ summary{
padding:0.8em; padding:0.8rem;
margin-bottom:0.25rem; margin-bottom:0.25rem;
} }
@ -107,6 +107,10 @@ summary h2, summary h3, summary h4, summary h5, summary h6 {
display:inline; display:inline;
} }
details details{
padding-left:1.5rem;
}
details.heading{ details.heading{
display:block; display:block;
margin-bottom:0.1rem; margin-bottom:0.1rem;

View File

@ -90,11 +90,15 @@ h2{
text-align:left; text-align:left;
/*margin-left:auto; /*margin-left:auto;
margin-right:auto;*/ margin-right:auto;*/
font-size:1.5rem; font-size:1.75rem;
margin-top:1rem; margin-top:1rem;
margin-bottom:0.5rem; margin-bottom:0.5rem;
} }
h3{
font-size:1.25rem;
}
hr{ hr{
border-top: 0.15rem solid black; border-top: 0.15rem solid black;
} }