From 28f5a459ddd7b9281896f3ce685e630a5053dfb9 Mon Sep 17 00:00:00 2001 From: Dayowe Date: Mon, 9 Jun 2025 10:12:28 +0200 Subject: [PATCH] fixes --- dog-food-calculator-widget.js | 15 +++++++++++++++ iframe.html | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/dog-food-calculator-widget.js b/dog-food-calculator-widget.js index dbf27e3..ed8c4d0 100644 --- a/dog-food-calculator-widget.js +++ b/dog-food-calculator-widget.js @@ -724,8 +724,14 @@ .dog-calc-share-copy { background: #f19a5f; } .dog-calc-share-copy:hover { background: #e87741; transform: translateY(-1px); } + .dog-calc-share-url { + display: flex; + width: 100%; + } + .dog-calc-share-url input { flex: 1; + width: 100%; padding: 10px 16px; border: 1px solid #e8e3ed; border-radius: 6px; @@ -1301,6 +1307,7 @@ const weightLabel = this.container.querySelector('#weightLabel'); const weightInput = this.container.querySelector('#weight'); const unitSelect = this.container.querySelector('#unit'); + const energyUnitSelect = this.container.querySelector('#energyUnit'); if (metricLabel && imperialLabel) { metricLabel.classList.toggle('active', !this.isImperial); @@ -1322,6 +1329,10 @@ `; } + // Set energy unit to kcal/cup for imperial + if (energyUnitSelect && energyUnitSelect.value === 'kcal100g') { + energyUnitSelect.value = 'kcalcup'; + } } else { if (weightLabel) weightLabel.textContent = "Dog's Weight (kg):"; if (weightInput) { @@ -1337,6 +1348,10 @@ `; } + // Set energy unit to kcal/100g for metric + if (energyUnitSelect && energyUnitSelect.value === 'kcalcup') { + energyUnitSelect.value = 'kcal100g'; + } } } diff --git a/iframe.html b/iframe.html index 86a9a0f..56234f1 100644 --- a/iframe.html +++ b/iframe.html @@ -726,8 +726,14 @@ .dog-calculator-share-copy { background: #f19a5f; } .dog-calculator-share-copy:hover { background: #e87741; transform: translateY(-1px); } + .dog-calculator-share-url { + display: flex; + width: 100%; + } + .dog-calculator-share-url input { flex: 1; + width: 100%; padding: 10px 16px; border: 1px solid #e8e3ed; border-radius: 6px; @@ -1243,6 +1249,7 @@ const weightLabel = document.getElementById('weightLabel'); const weightInput = document.getElementById('weight'); const unitSelect = document.getElementById('unit'); + const energyUnitSelect = document.getElementById('energyUnit'); if (metricLabel && imperialLabel) { metricLabel.classList.toggle('active', !this.isImperial); @@ -1262,6 +1269,10 @@ '' + ''; } + // Set energy unit to kcal/cup for imperial + if (energyUnitSelect && energyUnitSelect.value === 'kcal100g') { + energyUnitSelect.value = 'kcalcup'; + } } else { if (weightLabel) weightLabel.textContent = "Dog's Weight (kg):"; if (weightInput) { @@ -1275,6 +1286,10 @@ '' + ''; } + // Set energy unit to kcal/100g for metric + if (energyUnitSelect && energyUnitSelect.value === 'kcalcup') { + energyUnitSelect.value = 'kcal100g'; + } } }