@@ -2739,32 +2737,15 @@ const CALCULATOR_CONFIG = {
// Auto-select cups when entering energy for kcal/cup
const foodSource = this.foodSources.find(fs => fs.id === id);
if (foodSource && foodSource.energyUnit === 'kcalcup' && parseFloat(energyInput.value) > 0) {
+ // Cups display removed; default to grams
const unitSelect = document.getElementById('unit');
- const cupsButton = document.getElementById('cupsButton');
-
- // First check if cups button will be enabled after update
- const willEnableCups = this.foodSources.some(fs =>
- fs.energyUnit === 'kcalcup' && fs.energy && parseFloat(fs.energy) > 0
- );
-
- if (willEnableCups && unitSelect) {
- // Set cups BEFORE updating calculations
- unitSelect.value = 'cups';
- unitSelect.setAttribute('value', 'cups');
- this.setActiveUnitButton('cups');
-
- // Enable the cups button manually since we know it will be valid
- if (cupsButton) {
- cupsButton.disabled = false;
- cupsButton.title = 'Show amounts in cups';
- }
+ if (unitSelect) {
+ unitSelect.value = 'g';
+ unitSelect.setAttribute('value', 'g');
+ this.setActiveUnitButton('g');
}
-
- // Now update calculations with cups already selected
- this.updateFoodCalculations();
- } else {
- this.updateFoodCalculations();
}
+ this.updateFoodCalculations();
});
energyInput.addEventListener('blur', () => this.validateFoodSourceEnergy(id));
}
@@ -2783,21 +2764,9 @@ const CALCULATOR_CONFIG = {
if (unitSelect) {
switch(energyUnitSelect.value) {
case 'kcalcup':
- // Check if we have energy value to enable cups
- const foodSource = this.foodSources.find(fs => fs.id === id);
- if (foodSource && foodSource.energy && parseFloat(foodSource.energy) > 0) {
- // Set cups BEFORE updating calculations
- unitSelect.value = 'cups';
- unitSelect.setAttribute('value', 'cups');
- this.setActiveUnitButton('cups');
-
- // Enable the cups button manually
- const cupsButton = document.getElementById('cupsButton');
- if (cupsButton) {
- cupsButton.disabled = false;
- cupsButton.title = 'Show amounts in cups';
- }
- }
+ // Cups display not available; default to grams
+ unitSelect.value = 'g';
+ this.setActiveUnitButton('g');
this.updateFoodCalculations();
break;
case 'kcal100g':
@@ -2813,9 +2782,9 @@ const CALCULATOR_CONFIG = {
this.updateFoodCalculations();
break;
case 'kcalcan':
- // For kcal/can, use grams as default (or ounces in imperial)
- unitSelect.value = this.isImperial ? 'oz' : 'g';
- this.setActiveUnitButton(unitSelect.value);
+ // For kcal/can, use grams as default
+ unitSelect.value = 'g';
+ this.setActiveUnitButton('g');
this.updateFoodCalculations();
break;
}
@@ -3106,58 +3075,14 @@ const CALCULATOR_CONFIG = {
imperialLabel.classList.toggle('active', this.isImperial);
}
- if (this.isImperial) {
- if (weightLabel) weightLabel.textContent = "Dog's Weight (lbs):";
- if (weightInput) {
- weightInput.placeholder = "Enter weight in lbs";
- weightInput.min = "0.2";
- weightInput.step = "0.1";
+ // Kaya: restrict to metric g/kg only
+ if (unitSelect) {
+ unitSelect.innerHTML = '
' +
+ '
';
+ if (!unitSelect.value || (unitSelect.value !== 'g' && unitSelect.value !== 'kg')) {
+ unitSelect.value = 'g';
+ this.setActiveUnitButton('g');
}
- if (unitSelect) {
- unitSelect.innerHTML = '
' +
- '
' +
- '
' +
- '
';
- unitSelect.value = 'oz'; // Auto-select ounces for imperial
- this.setActiveUnitButton('oz'); // Sync unit buttons
- }
-
- // Update energy units for all food sources to kcal/cup for imperial
- this.foodSources.forEach(fs => {
- if (fs.energyUnit === 'kcal100g') {
- fs.energyUnit = 'kcalcup';
- const energyUnitSelect = document.getElementById(`energy-unit-${fs.id}`);
- if (energyUnitSelect) {
- energyUnitSelect.value = 'kcalcup';
- }
- }
- });
- } else {
- if (weightLabel) weightLabel.textContent = "Dog's Weight (kg):";
- if (weightInput) {
- weightInput.placeholder = "Enter weight in kg";
- weightInput.min = "0.1";
- weightInput.step = "0.1";
- }
- if (unitSelect) {
- unitSelect.innerHTML = '
' +
- '
' +
- '
' +
- '
';
- unitSelect.value = 'g'; // Auto-select grams for metric
- this.setActiveUnitButton('g'); // Sync unit buttons
- }
-
- // Update energy units for all food sources to kcal/100g for metric
- this.foodSources.forEach(fs => {
- if (fs.energyUnit === 'kcalcup') {
- fs.energyUnit = 'kcal100g';
- const energyUnitSelect = document.getElementById(`energy-unit-${fs.id}`);
- if (energyUnitSelect) {
- energyUnitSelect.value = 'kcal100g';
- }
- }
- });
}
}
@@ -3340,6 +3265,8 @@ const CALCULATOR_CONFIG = {
if (age < 2) { age = 2; if (ageClampNote) ageClampNote.classList.remove('dog-calculator-hidden'); }
if (age > 12) { age = 12; if (ageClampNote) ageClampNote.classList.remove('dog-calculator-hidden'); }
+ // Bucket pills removed
+
// Calculate interpolated kibble grams/day for 30 kg at this age
const kibbleGrams = this.getKayaKibbleGramsForAge(age);
@@ -3394,6 +3321,8 @@ const CALCULATOR_CONFIG = {
return lowerVal + (upperVal - lowerVal) * t;
}
+
+
updateCupsButtonState() {
const cupsButton = document.getElementById('cupsButton');
if (!cupsButton) return;
diff --git a/src/css/main.css b/src/css/main.css
index d392c96..ff748b3 100644
--- a/src/css/main.css
+++ b/src/css/main.css
@@ -196,6 +196,8 @@
display: inline-block;
}
+
+
.dog-calculator-results {
background: linear-gradient(135deg, rgba(241, 154, 95, 0.08) 0%, rgba(241, 154, 95, 0.04) 100%);
border: 1px solid rgba(241, 154, 95, 0.2);
diff --git a/src/index.html b/src/index.html
index baa165e..672bd3b 100644
--- a/src/index.html
+++ b/src/index.html
@@ -10,6 +10,8 @@
Age adjusted to the supported 2–12 month range.