summaryrefslogtreecommitdiff
path: root/js/garden.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/garden.js')
-rw-r--r--js/garden.js50
1 files changed, 47 insertions, 3 deletions
diff --git a/js/garden.js b/js/garden.js
index d5efe54..6db8c95 100644
--- a/js/garden.js
+++ b/js/garden.js
@@ -43,11 +43,13 @@ class Season {
}
class Crop {
- constructor(name, {fallCrop, headStart, interval, maturity, multisow,
+ constructor(name, {fallCrop, family, headStart, interval, maturity, multisow,
pause, spacing, springPlant, resume, species,
transplant, trellis}) {
// Plant again in the fall?
this.fallCrop = fallCrop;
+ // Broad category (brassica, cucurbit, nightshade, etc.)
+ this.family = family;
// Weeks spent indoors before transplanting.
this.headStart = headStart || 0;
// Succession planting interval (weeks)
@@ -79,6 +81,7 @@ class Crop {
const CROPS = [
new Crop("Arugula", {
+ family: "Brassica",
interval: 2,
maturity: 6,
pause: 3,
@@ -88,6 +91,7 @@ const CROPS = [
springPlant: -4
}),
new Crop("Basil", {
+ family: "Mint",
headStart: 8,
maturity: 6,
species: ["ocimum basilicum"],
@@ -95,6 +99,7 @@ const CROPS = [
transplant: true
}),
new Crop("Bean (Bush)", {
+ family: "Legume",
interval: 2,
maturity: 8,
spacing: 9,
@@ -102,6 +107,7 @@ const CROPS = [
springPlant: 1
}),
new Crop("Bean (Pole)", {
+ family: "Legume",
maturity: 9,
spacing: 8,
species: ["phaseolus vulgaris"],
@@ -109,6 +115,7 @@ const CROPS = [
trellis: true
}),
new Crop("Beet", {
+ family: "Amaranth",
interval: 2,
maturity: 8,
multisow: 4,
@@ -120,6 +127,7 @@ const CROPS = [
}),
new Crop("Bok Choy", {
fallCrop: true,
+ family: "Brassica",
headStart: 4,
maturity: 7,
spacing: 4,
@@ -128,6 +136,7 @@ const CROPS = [
}),
new Crop("Broccoli", {
fallCrop: true,
+ family: "Brassica",
headStart: 4,
maturity: 12,
species: ["brassica oleracea"],
@@ -135,13 +144,15 @@ const CROPS = [
transplant: true
}),
new Crop("Brussels Sprouts", {
- headStart: 4,
fallCrop: true,
+ family: "Brassica",
+ headStart: 4,
maturity: 16,
species: ["brassica oleracea"],
transplant: true
}),
new Crop("Cabbage (Early)", {
+ family: "Brassica",
headStart: 4,
maturity: 6,
species: ["brassica oleracea"],
@@ -149,6 +160,7 @@ const CROPS = [
transplant: true
}),
new Crop("Cabbage (Late)", {
+ family: "Brassica",
fallCrop: true,
headStart: 4,
maturity: 14,
@@ -157,6 +169,7 @@ const CROPS = [
transplant: true
}),
new Crop("Cabbage (Asian)", {
+ family: "Brassica",
fallCrop: true,
headStart: 4,
maturity: 10,
@@ -165,6 +178,7 @@ const CROPS = [
transplant: true
}),
new Crop("Cauliflower", {
+ family: "Brassica",
fallCrop: true,
headStart: 4,
maturity: 10,
@@ -173,6 +187,7 @@ const CROPS = [
transplant: true
}),
new Crop("Carrot", {
+ family: "Umbellifer",
interval: 2,
maturity: 10,
spacing: 16,
@@ -180,6 +195,7 @@ const CROPS = [
springPlant: -4
}),
new Crop("Cilantro", {
+ family: "Umbellifer",
interval: 2,
maturity: 7,
species: ["coriandrum sativum"],
@@ -187,12 +203,14 @@ const CROPS = [
}),
new Crop("Claytonia", {
fallCrop: true,
+ family: "Montiaceae",
maturity: 6,
spacing: 9,
species: ["montia perfoliata"],
springPlant: -5
}),
new Crop("Cucumber (Vine)", {
+ family: "Cucurbit",
maturity: 9,
spacing: 2,
species: ["cucumis sativus"],
@@ -200,12 +218,14 @@ const CROPS = [
trellis: true
}),
new Crop("Dill", {
+ family: "Umbellifer",
interval: 4,
maturity: 8,
species: ["anethum graveolens"],
springPlant: 0
}),
new Crop("Eggplant", {
+ family: "Nightshade",
headStart: 8,
maturity: 11,
species: ["solanum melongena"],
@@ -213,6 +233,7 @@ const CROPS = [
transplant: true
}),
new Crop("Endive", {
+ family: "Aster",
headStart: 6,
maturity: 4,
species: ["cichorium endivia"],
@@ -221,12 +242,14 @@ const CROPS = [
}),
new Crop("Fennel", {
fallCrop: 'sow',
+ family: "Umbellifer",
maturity: 10,
species: ["foeniculum vulgare"],
springPlant: 0
}),
new Crop("Kale", {
fallCrop: true,
+ family: "Brassica",
headStart: 4,
maturity: 4,
species: ["brassica napus", "brassica oleracea"],
@@ -234,6 +257,7 @@ const CROPS = [
transplant: true
}),
new Crop("Lettuce (Leaf/Mini Head)", {
+ family: "Aster",
headStart: 4,
interval: 2,
maturity: 7,
@@ -245,6 +269,7 @@ const CROPS = [
transplant: true
}),
new Crop("Mache (Corn Salad)", {
+ family: "Honeysuckle",
interval: 2,
maturity: 7,
pause: 1,
@@ -254,6 +279,7 @@ const CROPS = [
springPlant: -4
}),
new Crop("Mustard (Asian Greens)", {
+ family: "Brassica",
headStart: 3,
interval: 2,
maturity: 6,
@@ -265,6 +291,7 @@ const CROPS = [
transplant: true
}),
new Crop("Onion", {
+ family: "Allium",
headStart: 6,
maturity: 14,
multisow: 3,
@@ -274,6 +301,7 @@ const CROPS = [
transplant: true
}),
new Crop("Parsley", {
+ family: "Umbellifer",
headStart: 6,
maturity: 7,
spacing: 4,
@@ -282,6 +310,7 @@ const CROPS = [
transplant: true
}),
new Crop("Parsnip", {
+ family: "Umbellifer",
maturity: 14,
spacing: 4,
species: ["pastinaca sativa"],
@@ -289,6 +318,7 @@ const CROPS = [
}),
new Crop("Pea", {
fallCrop: 'sow',
+ family: "Legume",
maturity: 12,
spacing: 8,
species: ["pisum sativum"],
@@ -296,6 +326,7 @@ const CROPS = [
trellis: true
}),
new Crop("Pepper", {
+ family: "Nightshade",
headStart: 8,
maturity: 10,
species: ["capsicum annuum"],
@@ -303,12 +334,14 @@ const CROPS = [
transplant: true
}),
new Crop("Potato", {
+ family: "Nightshade",
maturity: 12,
spacing: 4,
species: ["solanum tuberosum"],
springPlant: -3
}),
new Crop("Radish (Round)", {
+ family: "Brassica",
interval: 2,
maturity: 4,
multisow: 4,
@@ -319,12 +352,14 @@ const CROPS = [
springPlant: -3
}),
new Crop("Radish (Daikon)", {
+ family: "Brassica",
fallCrop: true,
maturity: 9,
spacing: 4,
species: ["raphanus raphanistrum"]
}),
new Crop("Shallot", {
+ family: "Allium",
headStart: 6,
maturity: 9,
multisow: 3,
@@ -334,6 +369,7 @@ const CROPS = [
transplant: true
}),
new Crop("Spinach", {
+ family: "Amaranth",
interval: 2,
maturity: 6,
multisow: 4,
@@ -344,18 +380,21 @@ const CROPS = [
springPlant: -5
}),
new Crop("Squash (Summer)", {
+ family: "Cucurbit",
maturity: 8,
spacing: 1.0 / 9,
species: ["cucurbita pepo"],
springPlant: 0
}),
new Crop("Squash (Winter)", {
+ family: "Cucurbit",
maturity: 12,
spacing: 0.5,
species: ["cucurbita maxima", "cucurbita moschata", "cucurbita pepo"],
springPlant: 1
}),
new Crop("Swiss Chard", {
+ family: "Amaranth",
headStart: 4,
maturity: 4,
spacing: 4,
@@ -364,6 +403,7 @@ const CROPS = [
transplant: true
}),
new Crop("Tomato (Indeterminate)", {
+ family: "Nightshade",
headStart: 7,
maturity: 11,
species: ["lycopersicon esculentum"],
@@ -372,6 +412,7 @@ const CROPS = [
trellis: true
}),
new Crop("Turnip (Salad)", {
+ family: "Brassica",
interval: 2,
maturity: 5,
multisow: 4,
@@ -461,13 +502,16 @@ function viewCropDetails(crop) {
const modal = document.createElement("div");
const heading = document.createElement("h2");
const subheading = document.createElement("span");
+ const family = document.createElement("h3");
const speciesDetail = `(${crop.species.join(", ")})`;
heading.appendChild(document.createTextNode(crop.name));
subheading.appendChild(document.createTextNode(speciesDetail));
subheading.classList.add("detail-subheading");
+ heading.appendChild(subheading);
+ family.appendChild(document.createTextNode(`${crop.family} family`));
modal.classList.add("modal");
modal.appendChild(heading);
- heading.appendChild(subheading);
+ modal.appendChild(family);
addDetail("Average time to maturity",
`${crop.maturity} weeks from ${crop.transplant ? "transplant" : "seed"}`);
if(crop.springPlant == -1) {