Changeset 3803650
- Timestamp:
- 11/15/2026 05:53:58 PM (less than one hour ago)
- Location:
- cabina
- Files:
-
- 6 edited
- 1 copied
-
tags/1.3.5 (copied) (copied from cabina/trunk )
-
tags/1.3.5/assets/widget.iife.js (modified) (7 diffs)
-
tags/1.3.5/cabina.php (modified) (2 diffs)
-
tags/1.3.5/readme.txt (modified) (2 diffs)
-
trunk/assets/widget.iife.js (modified) (7 diffs)
-
trunk/cabina.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cabina/tags/1.3.5/assets/widget.iife.js
r3795263 r3803650 4994 4994 }; 4995 4995 } 4996 const BMI_FORSE_LIBBRE = 40; 4997 const LIBBRE_PER_KG = 2.2046; 4998 function pesoForseInLibbre(heightCm, weight, sesso, daFoto) { 4999 const comeChili = misureDaAltezzaPeso(heightCm, weight, sesso); 5000 if (!comeChili) return false; 5001 const chiavi = ["bustCm", "waistCm", "hipsCm"].filter((k) => daFoto?.[k] != null); 5002 if (chiavi.length === 0) return weight / (heightCm / 100) ** 2 >= BMI_FORSE_LIBBRE; 5003 const comeLibbre = misureDaAltezzaPeso(heightCm, weight / LIBBRE_PER_KG, sesso); 5004 if (!comeLibbre) return false; 5005 const scarto = (m) => chiavi.reduce((s, k) => s + Math.abs(m[k] - daFoto[k]), 0); 5006 return scarto(comeLibbre) * 2 < scarto(comeChili); 5007 } 4996 5008 const FIELD_CONFIG = { 4997 5009 heightCm: { label: "", placeholder: "170", min: 100, max: 220, step: 0.5, required: false }, … … 5077 5089 let sessoFormula = sesso; 5078 5090 let heightHintEl = null; 5091 let weightHintEl = null; 5079 5092 const fieldNames = ["heightCm", "weightKg", "bustCm", "waistCm", "hipsCm"]; 5080 5093 const invisibleLabels = [ … … 5192 5205 heightHintEl = hint; 5193 5206 } 5207 if (fieldName === "weightKg") { 5208 const hint = document.createElement("div"); 5209 hint.setAttribute("data-cabina-weight-hint", ""); 5210 hint.setAttribute("aria-live", "polite"); 5211 hint.style.cssText = "font-size:12px;color:#92400e;margin-top:2px;display:none;"; 5212 wrapper.appendChild(hint); 5213 weightHintEl = hint; 5214 } 5194 5215 container.appendChild(wrapper); 5195 5216 } … … 5291 5312 updateConfirmButton(); 5292 5313 updateHeightHint(); 5314 updateWeightHint(); 5293 5315 } 5294 5316 function updateAutoLabel(name) { … … 5299 5321 } 5300 5322 function recalibrateFromHeight() { 5301 const numero = (field, min, max) => {5302 const raw = field.value.trim();5303 const n = raw === "" ? NaN : parseFloat(normalizeDecimal(raw));5304 return !isNaN(n) && n >= min && n <= max ? n : null;5305 };5306 5323 const target = numero(fields.heightCm, 100, 220); 5307 5324 const peso = numero(fields.weightKg, 30, 250); 5308 5325 const daPeso = target != null && peso != null ? misureDaAltezzaPeso(target, peso, sessoFormula) : null; 5326 updateWeightHint(); 5309 5327 if (daPeso) { 5310 5328 for (const name of ["bustCm", "waistCm", "hipsCm"]) { … … 5333 5351 if (v != null) fields[name].value = String(v); 5334 5352 } 5353 } 5354 function numero(field, min, max) { 5355 const raw = field.value.trim(); 5356 const n = raw === "" ? NaN : parseFloat(normalizeDecimal(raw)); 5357 return !isNaN(n) && n >= min && n <= max ? n : null; 5358 } 5359 function updateWeightHint() { 5360 if (!weightHintEl) return; 5361 const altezza = numero(fields.heightCm, 100, 220); 5362 const peso = numero(fields.weightKg, 30, 250); 5363 let avviso = ""; 5364 if (altezza != null && peso != null) { 5365 if (!misureDaAltezzaPeso(altezza, peso, sessoFormula)) avviso = strings.weightUnused ?? "With these values the weight isn't used. Check height (cm) and weight (kg)."; 5366 else if (pesoForseInLibbre(altezza, peso, sessoFormula, autoBaseMeasures && calibrateCircumferences(autoBaseMeasures, referenceHeightCm, altezza))) avviso = strings.weightCheckUnit ?? "Check that the weight is in kg, not pounds."; 5367 } 5368 weightHintEl.textContent = avviso; 5369 weightHintEl.style.display = avviso ? "block" : "none"; 5335 5370 } 5336 5371 function updateHeightHint() { … … 8565 8600 fitFitted: senzaChiave(getLocaleString("form.fit_fitted")), 8566 8601 fitRegular: senzaChiave(getLocaleString("form.fit_regular")), 8567 fitRelaxed: senzaChiave(getLocaleString("form.fit_relaxed")) 8602 fitRelaxed: senzaChiave(getLocaleString("form.fit_relaxed")), 8603 // Riga sotto il peso (15/11/2026): stessi fallback del piede. 8604 weightUnused: senzaChiave(getLocaleString("form.weight_unused")), 8605 weightCheckUnit: senzaChiave(getLocaleString("form.weight_check_unit")) 8568 8606 }, 8569 8607 { -
cabina/tags/1.3.5/cabina.php
r3795263 r3803650 4 4 * Plugin URI: https://cabina.io/en/integrations/woocommerce 5 5 * Description: Add a try-on button to your product pages. Cabina lets your customers virtually try on garments using their own photo. Zero code required. 6 * Version: 1.3. 46 * Version: 1.3.5 7 7 * Author: Cabina 8 8 * Author URI: https://cabina.io … … 21 21 defined('ABSPATH') || exit; 22 22 23 define('CABINA_VERSION', '1.3. 4');23 define('CABINA_VERSION', '1.3.5'); 24 24 define('CABINA_PLUGIN_DIR', plugin_dir_path(__FILE__)); 25 25 define('CABINA_PLUGIN_URL', plugin_dir_url(__FILE__)); -
cabina/tags/1.3.5/readme.txt
r3795263 r3803650 6 6 Tested up to: 7.1 7 7 Requires PHP: 7.4 8 Stable tag: 1.3. 48 Stable tag: 1.3.5 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 124 124 == Changelog == 125 125 126 = 1.3.5 = 127 128 * Measurements form: a line under the weight field says when the weight is not used for the estimate, or when it looks like pounds instead of kilograms 129 * Wording fixes in French, German, Spanish and Indonesian 130 126 131 = 1.3.4 = 127 132 -
cabina/trunk/assets/widget.iife.js
r3795263 r3803650 4994 4994 }; 4995 4995 } 4996 const BMI_FORSE_LIBBRE = 40; 4997 const LIBBRE_PER_KG = 2.2046; 4998 function pesoForseInLibbre(heightCm, weight, sesso, daFoto) { 4999 const comeChili = misureDaAltezzaPeso(heightCm, weight, sesso); 5000 if (!comeChili) return false; 5001 const chiavi = ["bustCm", "waistCm", "hipsCm"].filter((k) => daFoto?.[k] != null); 5002 if (chiavi.length === 0) return weight / (heightCm / 100) ** 2 >= BMI_FORSE_LIBBRE; 5003 const comeLibbre = misureDaAltezzaPeso(heightCm, weight / LIBBRE_PER_KG, sesso); 5004 if (!comeLibbre) return false; 5005 const scarto = (m) => chiavi.reduce((s, k) => s + Math.abs(m[k] - daFoto[k]), 0); 5006 return scarto(comeLibbre) * 2 < scarto(comeChili); 5007 } 4996 5008 const FIELD_CONFIG = { 4997 5009 heightCm: { label: "", placeholder: "170", min: 100, max: 220, step: 0.5, required: false }, … … 5077 5089 let sessoFormula = sesso; 5078 5090 let heightHintEl = null; 5091 let weightHintEl = null; 5079 5092 const fieldNames = ["heightCm", "weightKg", "bustCm", "waistCm", "hipsCm"]; 5080 5093 const invisibleLabels = [ … … 5192 5205 heightHintEl = hint; 5193 5206 } 5207 if (fieldName === "weightKg") { 5208 const hint = document.createElement("div"); 5209 hint.setAttribute("data-cabina-weight-hint", ""); 5210 hint.setAttribute("aria-live", "polite"); 5211 hint.style.cssText = "font-size:12px;color:#92400e;margin-top:2px;display:none;"; 5212 wrapper.appendChild(hint); 5213 weightHintEl = hint; 5214 } 5194 5215 container.appendChild(wrapper); 5195 5216 } … … 5291 5312 updateConfirmButton(); 5292 5313 updateHeightHint(); 5314 updateWeightHint(); 5293 5315 } 5294 5316 function updateAutoLabel(name) { … … 5299 5321 } 5300 5322 function recalibrateFromHeight() { 5301 const numero = (field, min, max) => {5302 const raw = field.value.trim();5303 const n = raw === "" ? NaN : parseFloat(normalizeDecimal(raw));5304 return !isNaN(n) && n >= min && n <= max ? n : null;5305 };5306 5323 const target = numero(fields.heightCm, 100, 220); 5307 5324 const peso = numero(fields.weightKg, 30, 250); 5308 5325 const daPeso = target != null && peso != null ? misureDaAltezzaPeso(target, peso, sessoFormula) : null; 5326 updateWeightHint(); 5309 5327 if (daPeso) { 5310 5328 for (const name of ["bustCm", "waistCm", "hipsCm"]) { … … 5333 5351 if (v != null) fields[name].value = String(v); 5334 5352 } 5353 } 5354 function numero(field, min, max) { 5355 const raw = field.value.trim(); 5356 const n = raw === "" ? NaN : parseFloat(normalizeDecimal(raw)); 5357 return !isNaN(n) && n >= min && n <= max ? n : null; 5358 } 5359 function updateWeightHint() { 5360 if (!weightHintEl) return; 5361 const altezza = numero(fields.heightCm, 100, 220); 5362 const peso = numero(fields.weightKg, 30, 250); 5363 let avviso = ""; 5364 if (altezza != null && peso != null) { 5365 if (!misureDaAltezzaPeso(altezza, peso, sessoFormula)) avviso = strings.weightUnused ?? "With these values the weight isn't used. Check height (cm) and weight (kg)."; 5366 else if (pesoForseInLibbre(altezza, peso, sessoFormula, autoBaseMeasures && calibrateCircumferences(autoBaseMeasures, referenceHeightCm, altezza))) avviso = strings.weightCheckUnit ?? "Check that the weight is in kg, not pounds."; 5367 } 5368 weightHintEl.textContent = avviso; 5369 weightHintEl.style.display = avviso ? "block" : "none"; 5335 5370 } 5336 5371 function updateHeightHint() { … … 8565 8600 fitFitted: senzaChiave(getLocaleString("form.fit_fitted")), 8566 8601 fitRegular: senzaChiave(getLocaleString("form.fit_regular")), 8567 fitRelaxed: senzaChiave(getLocaleString("form.fit_relaxed")) 8602 fitRelaxed: senzaChiave(getLocaleString("form.fit_relaxed")), 8603 // Riga sotto il peso (15/11/2026): stessi fallback del piede. 8604 weightUnused: senzaChiave(getLocaleString("form.weight_unused")), 8605 weightCheckUnit: senzaChiave(getLocaleString("form.weight_check_unit")) 8568 8606 }, 8569 8607 { -
cabina/trunk/cabina.php
r3795263 r3803650 4 4 * Plugin URI: https://cabina.io/en/integrations/woocommerce 5 5 * Description: Add a try-on button to your product pages. Cabina lets your customers virtually try on garments using their own photo. Zero code required. 6 * Version: 1.3. 46 * Version: 1.3.5 7 7 * Author: Cabina 8 8 * Author URI: https://cabina.io … … 21 21 defined('ABSPATH') || exit; 22 22 23 define('CABINA_VERSION', '1.3. 4');23 define('CABINA_VERSION', '1.3.5'); 24 24 define('CABINA_PLUGIN_DIR', plugin_dir_path(__FILE__)); 25 25 define('CABINA_PLUGIN_URL', plugin_dir_url(__FILE__)); -
cabina/trunk/readme.txt
r3795263 r3803650 6 6 Tested up to: 7.1 7 7 Requires PHP: 7.4 8 Stable tag: 1.3. 48 Stable tag: 1.3.5 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 124 124 == Changelog == 125 125 126 = 1.3.5 = 127 128 * Measurements form: a line under the weight field says when the weight is not used for the estimate, or when it looks like pounds instead of kilograms 129 * Wording fixes in French, German, Spanish and Indonesian 130 126 131 = 1.3.4 = 127 132
Note:
See TracChangeset
for help on using the changeset viewer.