-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
392 lines (366 loc) · 13.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced Kombucha Calculator</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
max-width: 800px;
margin: 2rem auto;
padding: 0 1rem;
background-color: #f9f5f0;
}
.calculator {
background: white;
padding: 2rem;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
h1, h2, h3 {
color: #2d3748;
margin-bottom: 1rem;
}
.input-group {
margin-bottom: 1.5rem;
}
label {
display: block;
margin-bottom: 0.5rem;
color: #4a5568;
}
input {
width: 100%;
padding: 0.5rem;
border: 1px solid #cbd5e0;
border-radius: 4px;
margin-bottom: 0.5rem;
}
.recipe {
margin-top: 2rem;
padding: 1rem;
background: #f7fafc;
border-radius: 4px;
}
.recipe-item {
display: flex;
justify-content: space-between;
margin-bottom: 0.5rem;
padding: 0.5rem 0;
border-bottom: 1px solid #edf2f7;
}
select {
width: 100%;
padding: 0.5rem;
border: 1px solid #cbd5e0;
border-radius: 4px;
margin-bottom: 1rem;
background: white;
}
button {
background: #4a5568;
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 4px;
cursor: pointer;
margin-right: 0.5rem;
margin-bottom: 0.5rem;
}
button:hover {
background: #2d3748;
}
.add-ins {
display: flex;
flex-wrap: wrap;
gap: 1rem;
margin-top: 1rem;
}
.add-in-item {
background: #edf2f7;
padding: 0.5rem;
border-radius: 4px;
display: flex;
align-items: center;
gap: 0.5rem;
}
.add-in-item input {
width: 60px;
margin: 0;
}
.tabs {
display: flex;
gap: 1rem;
margin-bottom: 1rem;
}
.tab {
padding: 0.5rem 1rem;
cursor: pointer;
border-bottom: 2px solid transparent;
}
.tab.active {
border-bottom-color: #4a5568;
font-weight: bold;
}
.notes {
margin-top: 1rem;
padding: 1rem;
background: #fffaf0;
border-radius: 4px;
font-size: 0.9rem;
}
</style>
</head>
<body>
<div class="calculator">
<h1>Advanced Kombucha Calculator</h1>
<div class="tabs">
<div class="tab active" onclick="switchTab('basic')">Basic Recipe</div>
<div class="tab" onclick="switchTab('custom')">Custom Recipe</div>
</div>
<div id="basic-tab">
<div class="input-group">
<label for="preset">Recipe Preset:</label>
<select id="preset" onchange="applyPreset()">
<option value="sweet">Sweet Kombucha (Max Sugar)</option>
<option value="balanced">Balanced Kombucha</option>
<option value="light">Light Kombucha (Low Sugar)</option>
<option value="herbal">Herbal Wellness Blend</option>
<option value="antioxidant">Antioxidant Boost</option>
<option value="ginger">Ginger Zing</option>
<option value="turmeric">Golden Turmeric</option>
</select>
</div>
</div>
<div id="custom-tab" style="display: none;">
<div class="input-group">
<label for="sugar-ratio">Sugar Ratio (g/L):</label>
<input type="number" id="sugar-ratio" value="70" min="20" max="100" onchange="updateCustomRecipe()">
</div>
<div class="input-group">
<label for="tea-ratio">Tea Ratio (g/L):</label>
<input type="number" id="tea-ratio" value="6" min="4" max="10" onchange="updateCustomRecipe()">
</div>
<div class="input-group">
<label for="starter-ratio">Starter Ratio (mL/L):</label>
<input type="number" id="starter-ratio" value="100" min="50" max="200" onchange="updateCustomRecipe()">
</div>
</div>
<div class="input-group">
<label for="batch-size">Desired Batch Size (L):</label>
<input type="number" id="batch-size" value="1" min="0.1" step="0.1" onchange="calculateRecipe()">
</div>
<h3>Add-ins (per liter)</h3>
<div class="add-ins" id="add-ins">
<!-- Add-ins will be populated by JavaScript -->
</div>
<div class="recipe">
<h2>Recipe:</h2>
<div class="recipe-item">
<span>Water:</span>
<span id="water">1 L</span>
</div>
<div class="recipe-item">
<span>Sugar:</span>
<span id="sugar">70 g</span>
</div>
<div class="recipe-item">
<span>Tea:</span>
<span id="tea">6 g</span>
</div>
<div class="recipe-item">
<span>Starter:</span>
<span id="starter">100 mL</span>
</div>
<div id="add-ins-recipe">
<!-- Additional ingredients will be shown here -->
</div>
</div>
<div class="notes" id="recipe-notes">
<!-- Recipe notes will be shown here -->
</div>
</div>
<script>
// Base recipes for different styles
const recipes = {
sweet: {
name: 'Sweet Kombucha',
water: 1,
sugar: 70,
tea: 6,
starter: 100,
addIns: {},
notes: 'Classic sweet kombucha recipe with maximum sugar content. Ferment for 7-10 days.'
},
balanced: {
name: 'Balanced Kombucha',
water: 1,
sugar: 50,
tea: 6,
starter: 100,
addIns: {},
notes: 'Well-balanced recipe with moderate sugar content. Ferment for 7-10 days.'
},
light: {
name: 'Light Kombucha',
water: 1,
sugar: 30,
tea: 6,
starter: 100,
addIns: {},
notes: 'Lower sugar recipe for a lighter brew. Ferment for 5-7 days.'
},
herbal: {
name: 'Herbal Wellness Blend',
water: 1,
sugar: 50,
tea: 6,
starter: 100,
addIns: {
ashwagandha: 2,
'ginkgo leaf': 2
},
notes: 'Wellness blend with adaptogenic herbs. Add herbs during second fermentation.'
},
antioxidant: {
name: 'Antioxidant Boost',
water: 1,
sugar: 50,
tea: 6,
starter: 100,
addIns: {
'acai berry': 3,
'goji berry': 2
},
notes: 'Rich in antioxidants. Add berries during second fermentation.'
},
ginger: {
name: 'Ginger Zing',
water: 1,
sugar: 50,
tea: 6,
starter: 100,
addIns: {
'fresh ginger': 15,
'lemon juice': 15
},
notes: 'Spicy ginger blend. Add fresh ginger and lemon during second fermentation.'
},
turmeric: {
name: 'Golden Turmeric',
water: 1,
sugar: 50,
tea: 6,
starter: 100,
addIns: {
turmeric: 5,
'black pepper': 0.25,
'fresh ginger': 5
},
notes: 'Anti-inflammatory blend. Add spices during second fermentation. Black pepper increases turmeric absorption.'
}
};
// Available add-ins with their units
const availableAddIns = {
'ashwagandha': 'g',
'acai berry': 'g',
'fresh ginger': 'g',
'turmeric': 'g',
'ginkgo leaf': 'g',
'goji berry': 'g',
'black pepper': 'g',
'lemon juice': 'mL',
'hibiscus': 'g',
'lavender': 'g',
'rose hips': 'g',
'mint': 'g'
};
let currentRecipe = recipes.sweet;
let customMode = false;
function switchTab(tab) {
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
document.querySelector(`.tab:nth-child(${tab === 'basic' ? 1 : 2})`).classList.add('active');
document.getElementById('basic-tab').style.display = tab === 'basic' ? 'block' : 'none';
document.getElementById('custom-tab').style.display = tab === 'custom' ? 'block' : 'none';
customMode = tab === 'custom';
calculateRecipe();
}
function populateAddIns() {
const container = document.getElementById('add-ins');
container.innerHTML = '';
Object.entries(availableAddIns).forEach(([name, unit]) => {
const div = document.createElement('div');
div.className = 'add-in-item';
div.innerHTML = `
<label>${name}:</label>
<input type="number" min="0" step="0.25" value="0"
onchange="calculateRecipe()" data-addin="${name}">
<span>${unit}</span>
`;
container.appendChild(div);
});
}
function updateCustomRecipe() {
if (!customMode) return;
currentRecipe = {
name: 'Custom Recipe',
water: 1,
sugar: parseFloat(document.getElementById('sugar-ratio').value),
tea: parseFloat(document.getElementById('tea-ratio').value),
starter: parseFloat(document.getElementById('starter-ratio').value),
addIns: {},
notes: 'Custom recipe with adjusted ratios.'
};
calculateRecipe();
}
function applyPreset() {
const preset = document.getElementById('preset').value;
currentRecipe = recipes[preset];
// Reset add-in inputs
document.querySelectorAll('#add-ins input').forEach(input => {
const addin = input.dataset.addin;
input.value = currentRecipe.addIns[addin] || 0;
});
calculateRecipe();
}
function calculateRecipe() {
const batchSize = parseFloat(document.getElementById('batch-size').value);
if (batchSize <= 0 || isNaN(batchSize)) {
alert('Please enter a valid batch size');
return;
}
// Update base recipe
document.getElementById('water').textContent = `${(currentRecipe.water * batchSize).toFixed(1)} L`;
document.getElementById('sugar').textContent = `${Math.round(currentRecipe.sugar * batchSize)} g`;
document.getElementById('tea').textContent = `${Math.round(currentRecipe.tea * batchSize)} g`;
document.getElementById('starter').textContent = `${Math.round(currentRecipe.starter * batchSize)} mL`;
// Update add-ins
const addInsRecipe = document.getElementById('add-ins-recipe');
addInsRecipe.innerHTML = '';
document.querySelectorAll('#add-ins input').forEach(input => {
const amount = parseFloat(input.value);
if (amount > 0) {
const div = document.createElement('div');
div.className = 'recipe-item';
const name = input.dataset.addin;
const unit = availableAddIns[name];
div.innerHTML = `
<span>${name}:</span>
<span>${(amount * batchSize).toFixed(2)} ${unit}</span>
`;
addInsRecipe.appendChild(div);
}
});
// Update notes
document.getElementById('recipe-notes').innerHTML = `
<strong>Recipe Notes:</strong><br>
${currentRecipe.notes}
`;
}
// Initialize
populateAddIns();
calculateRecipe();
</script>
</body>
</html>