From 585d6f87263849bf784e09e76f9c5e8f2a2ed5f9 Mon Sep 17 00:00:00 2001 From: zbina <216163753+zbina@users.noreply.github.com> Date: Fri, 13 Jun 2025 04:48:05 -0700 Subject: [PATCH 1/5] Create manifest.json --- submissions/Healthy Food/manifest.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 submissions/Healthy Food/manifest.json diff --git a/submissions/Healthy Food/manifest.json b/submissions/Healthy Food/manifest.json new file mode 100644 index 00000000..9786e09c --- /dev/null +++ b/submissions/Healthy Food/manifest.json @@ -0,0 +1,14 @@ +{ + "manifest_version": 3, + "name": "Healthy Food", + "description": "Explore healthy food options and daily wellness tips.", + "version": "1.0", + "action": { + "default_popup": "popup.html", + "default_icon": "icon.png" + }, + "permissions": ["storage"], + "icons": { + "128": "icon.png" + } +} From 34684d4760ded94649161622a4d54602b2938038 Mon Sep 17 00:00:00 2001 From: zbina <216163753+zbina@users.noreply.github.com> Date: Fri, 13 Jun 2025 04:49:07 -0700 Subject: [PATCH 2/5] Create popup.html --- submissions/Healthy Food/popup.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 submissions/Healthy Food/popup.html diff --git a/submissions/Healthy Food/popup.html b/submissions/Healthy Food/popup.html new file mode 100644 index 00000000..fb7cecc5 --- /dev/null +++ b/submissions/Healthy Food/popup.html @@ -0,0 +1,15 @@ + + + + Healthy Food + + + +

Healthy Food

+

+ + + + + + From 06bdc9d3abdef5f11d8ef6d1dc8f4eae7580969c Mon Sep 17 00:00:00 2001 From: zbina <216163753+zbina@users.noreply.github.com> Date: Fri, 13 Jun 2025 04:50:07 -0700 Subject: [PATCH 3/5] Create popup.css --- submissions/Healthy Food/popup.css | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 submissions/Healthy Food/popup.css diff --git a/submissions/Healthy Food/popup.css b/submissions/Healthy Food/popup.css new file mode 100644 index 00000000..907ba928 --- /dev/null +++ b/submissions/Healthy Food/popup.css @@ -0,0 +1,44 @@ +body { + width: 300px; + font-family: sans-serif; + padding: 10px; + background: #f4fff4; +} + +h1 { + font-size: 18px; + margin-bottom: 10px; +} + +#daily-tip { + font-style: italic; + margin-bottom: 10px; +} + +input { + width: 100%; + padding: 5px; + margin-bottom: 10px; +} + +ul { + list-style: none; + padding: 0; + max-height: 300px; + overflow-y: auto; +} + +li { + padding: 5px; + background: #ffffff; + border: 1px solid #ccc; + margin-bottom: 5px; + cursor: pointer; + display: flex; + justify-content: space-between; + align-items: center; +} + +li.fav { + background: #e0ffe0; +} From efbce0f47737a069797636068d641f5f17b75b8e Mon Sep 17 00:00:00 2001 From: zbina <216163753+zbina@users.noreply.github.com> Date: Fri, 13 Jun 2025 04:51:08 -0700 Subject: [PATCH 4/5] Create data.js --- submissions/Healthy Food/data.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 submissions/Healthy Food/data.js diff --git a/submissions/Healthy Food/data.js b/submissions/Healthy Food/data.js new file mode 100644 index 00000000..74d3510a --- /dev/null +++ b/submissions/Healthy Food/data.js @@ -0,0 +1,29 @@ +const foods = [ + "Apple", + "Avocado", + "Banana", + "Blueberries", + "Broccoli", + "Carrot", + "Chia seeds", + "Garlic", + "Green tea", + "Kale", + "Lentils", + "Oats", + "Quinoa", + "Salmon", + "Spinach", + "Sweet Potato", + "Tomato", + "Walnuts", + "Yogurt" +]; + +const tips = [ + "Drink more water throughout the day.", + "Eat a rainbow of vegetables daily.", + "Replace soda with green tea.", + "Snack on nuts instead of chips.", + "Add seeds like chia and flax to your diet." +]; From 9554bf08c3a3ea28efd73dddd5d6ca5508d41896 Mon Sep 17 00:00:00 2001 From: zbina <216163753+zbina@users.noreply.github.com> Date: Fri, 13 Jun 2025 04:51:59 -0700 Subject: [PATCH 5/5] Create popup.js --- submissions/Healthy Food/popup.js | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 submissions/Healthy Food/popup.js diff --git a/submissions/Healthy Food/popup.js b/submissions/Healthy Food/popup.js new file mode 100644 index 00000000..0e402cae --- /dev/null +++ b/submissions/Healthy Food/popup.js @@ -0,0 +1,51 @@ +function getRandomTip() { + return tips[Math.floor(Math.random() * tips.length)]; +} + +function loadFavorites() { + return JSON.parse(localStorage.getItem("favorites") || "[]"); +} + +function saveFavorites(favs) { + localStorage.setItem("favorites", JSON.stringify(favs)); +} + +function renderFoodList(filter = "") { + const list = document.getElementById("food-list"); + list.innerHTML = ""; + const favs = loadFavorites(); + + foods + .filter(f => f.toLowerCase().includes(filter.toLowerCase())) + .forEach(food => { + const li = document.createElement("li"); + li.textContent = food; + if (favs.includes(food)) li.classList.add("fav"); + + const btn = document.createElement("button"); + btn.textContent = favs.includes(food) ? "★" : "☆"; + btn.onclick = (e) => { + e.stopPropagation(); + const newFavs = favs.includes(food) + ? favs.filter(f => f !== food) + : [...favs, food]; + saveFavorites(newFavs); + renderFoodList(document.getElementById("search").value); + }; + + li.appendChild(btn); + li.onclick = () => { + window.open(`https://www.google.com/search?q=${encodeURIComponent(food)}+nutrition`, '_blank'); + }; + + list.appendChild(li); + }); +} + +document.addEventListener("DOMContentLoaded", () => { + document.getElementById("daily-tip").textContent = getRandomTip(); + document.getElementById("search").addEventListener("input", (e) => { + renderFoodList(e.target.value); + }); + renderFoodList(); +});