commit 25278c2580b7d36ebae4a502046bf21de453f612
Author: root <root@hub.scroll.pub> Date: 2024-12-28 20:33:07 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..9e366c5 --- /dev/null +++ b/body.html @@ -0,0 +1,27 @@ +<header> + <h1>Recipe Cost Calculator</h1> + <p>Calculate the total cost of your recipe by entering the ingredients, their cost, and quantity.</p> +</header> + +<main> + <form id="recipe-form"> + <div id="ingredients-container"> + <div class="ingredient"> + <input type="text" placeholder="Ingredient Name" required> + <input type="number" placeholder="Cost (per unit)" step="0.01" required> + <input type="number" placeholder="Quantity" step="0.01" required> + <button type="button" class="remove-ingredient">×</button> + </div> + </div> + <button type="button" id="add-ingredient">Add Ingredient</button> + <button type="submit">Calculate Total Cost</button> + </form> + + <div id="result"> + <h2>Total Cost: <span id="total-cost">$0.00</span></h2> + </div> +</main> + +<footer> + <p>Simplify your recipe budgeting with this easy-to-use calculator.</p> +</footer> \ No newline at end of file diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..e951915 --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://recipecost.scroll.pub +metaTags +editButton /edit.html +title Recipe Cost Calculator +style.css +body.html +script.js \ No newline at end of file diff --git a/prompt.json b/prompt.json new file mode 100644 index 0000000..039453b --- /dev/null +++ b/prompt.json @@ -0,0 +1,25 @@ +{ + "id": "9e3c4518-5b8d-427c-af34-3a0823d9b2fb", + "object": "chat.completion", + "created": 1735417970, + "model": "deepseek-chat", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "---domain---\nrecipecost.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://recipecost.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Recipe Cost Calculator\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>Recipe Cost Calculator</h1>\n <p>Calculate the total cost of your recipe by entering the ingredients, their cost, and quantity.</p>\n</header>\n\n<main>\n <form id=\"recipe-form\">\n <div id=\"ingredients-container\">\n <div class=\"ingredient\">\n <input type=\"text\" placeholder=\"Ingredient Name\" required>\n <input type=\"number\" placeholder=\"Cost (per unit)\" step=\"0.01\" required>\n <input type=\"number\" placeholder=\"Quantity\" step=\"0.01\" required>\n <button type=\"button\" class=\"remove-ingredient\">×</button>\n </div>\n </div>\n <button type=\"button\" id=\"add-ingredient\">Add Ingredient</button>\n <button type=\"submit\">Calculate Total Cost</button>\n </form>\n\n <div id=\"result\">\n <h2>Total Cost: <span id=\"total-cost\">$0.00</span></h2>\n </div>\n</main>\n\n<footer>\n <p>Simplify your recipe budgeting with this easy-to-use calculator.</p>\n</footer>\n---style.css---\n:root {\n --primary-color: #4CAF50;\n --secondary-color: #45a049;\n --background-color: #f4f4f4;\n --text-color: #333;\n --border-color: #ddd;\n}\n\nbody {\n font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n margin: 0;\n padding: 0;\n background-color: var(--background-color);\n color: var(--text-color);\n line-height: 1.6;\n}\n\nheader {\n background-color: var(--primary-color);\n color: white;\n padding: 2rem;\n text-align: center;\n}\n\nmain {\n max-width: 800px;\n margin: 2rem auto;\n padding: 1rem;\n background: white;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n}\n\n.ingredient {\n display: flex;\n gap: 1rem;\n margin-bottom: 1rem;\n}\n\n.ingredient input {\n flex: 1;\n padding: 0.5rem;\n border: 1px solid var(--border-color);\n border-radius: 4px;\n}\n\n.remove-ingredient {\n background-color: #ff4444;\n color: white;\n border: none;\n border-radius: 50%;\n width: 30px;\n height: 30px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.remove-ingredient:hover {\n background-color: #cc0000;\n}\n\n#add-ingredient {\n background-color: var(--primary-color);\n color: white;\n border: none;\n padding: 0.5rem 1rem;\n border-radius: 4px;\n cursor: pointer;\n margin-bottom: 1rem;\n}\n\n#add-ingredient:hover {\n background-color: var(--secondary-color);\n}\n\nbutton[type=\"submit\"] {\n background-color: var(--primary-color);\n color: white;\n border: none;\n padding: 0.75rem 1.5rem;\n border-radius: 4px;\n cursor: pointer;\n width: 100%;\n}\n\nbutton[type=\"submit\"]:hover {\n background-color: var(--secondary-color);\n}\n\n#result {\n text-align: center;\n margin-top: 2rem;\n padding: 1rem;\n background-color: var(--background-color);\n border-radius: 8px;\n}\n\n#total-cost {\n color: var(--primary-color);\n font-weight: bold;\n}\n\nfooter {\n text-align: center;\n padding: 1rem;\n background-color: var(--primary-color);\n color: white;\n margin-top: 2rem;\n}\n\n@media (max-width: 600px) {\n .ingredient {\n flex-direction: column;\n }\n\n .ingredient input {\n width: 100%;\n }\n}\n---script.js---\ndocument.addEventListener('DOMContentLoaded', function () {\n const ingredientsContainer = document.getElementById('ingredients-container');\n const addIngredientButton = document.getElementById('add-ingredient');\n const recipeForm = document.getElementById('recipe-form');\n const totalCostDisplay = document.getElementById('total-cost');\n\n addIngredientButton.addEventListener('click', function () {\n const newIngredient = document.createElement('div');\n newIngredient.classList.add('ingredient');\n newIngredient.innerHTML = `\n <input type=\"text\" placeholder=\"Ingredient Name\" required>\n <input type=\"number\" placeholder=\"Cost (per unit)\" step=\"0.01\" required>\n <input type=\"number\" placeholder=\"Quantity\" step=\"0.01\" required>\n <button type=\"button\" class=\"remove-ingredient\">×</button>\n `;\n ingredientsContainer.appendChild(newIngredient);\n\n newIngredient.querySelector('.remove-ingredient').addEventListener('click', function () {\n ingredientsContainer.removeChild(newIngredient);\n });\n });\n\n recipeForm.addEventListener('submit', function (event) {\n event.preventDefault();\n let totalCost = 0;\n\n const ingredients = ingredientsContainer.querySelectorAll('.ingredient');\n ingredients.forEach(ingredient => {\n const cost = parseFloat(ingredient.querySelector('input[type=\"number\"]:nth-of-type(1)').value);\n const quantity = parseFloat(ingredient.querySelector('input[type=\"number\"]:nth-of-type(2)').value);\n totalCost += cost * quantity;\n });\n\n totalCostDisplay.textContent = `$${totalCost.toFixed(2)}`;\n });\n});\n---end---" + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 252, + "completion_tokens": 1311, + "total_tokens": 1563, + "prompt_cache_hit_tokens": 0, + "prompt_cache_miss_tokens": 252 + }, + "system_fingerprint": "fp_f1afce2943" +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..afb51a0 --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# recipecost1.scroll.pub +Website generated by DeepSeek from prompt: a website to calculate the cost of a recipe given the ingredients' name, cost and quantity \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..272de70 --- /dev/null +++ b/script.js @@ -0,0 +1,36 @@ +document.addEventListener('DOMContentLoaded', function () { + const ingredientsContainer = document.getElementById('ingredients-container'); + const addIngredientButton = document.getElementById('add-ingredient'); + const recipeForm = document.getElementById('recipe-form'); + const totalCostDisplay = document.getElementById('total-cost'); + + addIngredientButton.addEventListener('click', function () { + const newIngredient = document.createElement('div'); + newIngredient.classList.add('ingredient'); + newIngredient.innerHTML = ` + <input type="text" placeholder="Ingredient Name" required> + <input type="number" placeholder="Cost (per unit)" step="0.01" required> + <input type="number" placeholder="Quantity" step="0.01" required> + <button type="button" class="remove-ingredient">×</button> + `; + ingredientsContainer.appendChild(newIngredient); + + newIngredient.querySelector('.remove-ingredient').addEventListener('click', function () { + ingredientsContainer.removeChild(newIngredient); + }); + }); + + recipeForm.addEventListener('submit', function (event) { + event.preventDefault(); + let totalCost = 0; + + const ingredients = ingredientsContainer.querySelectorAll('.ingredient'); + ingredients.forEach(ingredient => { + const cost = parseFloat(ingredient.querySelector('input[type="number"]:nth-of-type(1)').value); + const quantity = parseFloat(ingredient.querySelector('input[type="number"]:nth-of-type(2)').value); + totalCost += cost * quantity; + }); + + totalCostDisplay.textContent = `$${totalCost.toFixed(2)}`; + }); +}); \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..db9bdad --- /dev/null +++ b/style.css @@ -0,0 +1,121 @@ +:root { + --primary-color: #4CAF50; + --secondary-color: #45a049; + --background-color: #f4f4f4; + --text-color: #333; + --border-color: #ddd; +} + +body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + margin: 0; + padding: 0; + background-color: var(--background-color); + color: var(--text-color); + line-height: 1.6; +} + +header { + background-color: var(--primary-color); + color: white; + padding: 2rem; + text-align: center; +} + +main { + max-width: 800px; + margin: 2rem auto; + padding: 1rem; + background: white; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); + border-radius: 8px; +} + +.ingredient { + display: flex; + gap: 1rem; + margin-bottom: 1rem; +} + +.ingredient input { + flex: 1; + padding: 0.5rem; + border: 1px solid var(--border-color); + border-radius: 4px; +} + +.remove-ingredient { + background-color: #ff4444; + color: white; + border: none; + border-radius: 50%; + width: 30px; + height: 30px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; +} + +.remove-ingredient:hover { + background-color: #cc0000; +} + +#add-ingredient { + background-color: var(--primary-color); + color: white; + border: none; + padding: 0.5rem 1rem; + border-radius: 4px; + cursor: pointer; + margin-bottom: 1rem; +} + +#add-ingredient:hover { + background-color: var(--secondary-color); +} + +button[type="submit"] { + background-color: var(--primary-color); + color: white; + border: none; + padding: 0.75rem 1.5rem; + border-radius: 4px; + cursor: pointer; + width: 100%; +} + +button[type="submit"]:hover { + background-color: var(--secondary-color); +} + +#result { + text-align: center; + margin-top: 2rem; + padding: 1rem; + background-color: var(--background-color); + border-radius: 8px; +} + +#total-cost { + color: var(--primary-color); + font-weight: bold; +} + +footer { + text-align: center; + padding: 1rem; + background-color: var(--primary-color); + color: white; + margin-top: 2rem; +} + +@media (max-width: 600px) { + .ingredient { + flex-direction: column; + } + + .ingredient input { + width: 100%; + } +} \ No newline at end of file