Plugin Directory

Changeset 3803650


Ignore:
Timestamp:
11/15/2026 05:53:58 PM (less than one hour ago)
Author:
actry
Message:

Release 1.3.5: weight hint in the measurements form, wording fixes in French, German, Spanish and Indonesian

Location:
cabina
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • cabina/tags/1.3.5/assets/widget.iife.js

    r3795263 r3803650  
    49944994    };
    49954995  }
     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  }
    49965008  const FIELD_CONFIG = {
    49975009    heightCm: { label: "", placeholder: "170", min: 100, max: 220, step: 0.5, required: false },
    … …  
    50775089    let sessoFormula = sesso;
    50785090    let heightHintEl = null;
     5091    let weightHintEl = null;
    50795092    const fieldNames = ["heightCm", "weightKg", "bustCm", "waistCm", "hipsCm"];
    50805093    const invisibleLabels = [
    … …  
    51925205        heightHintEl = hint;
    51935206      }
     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      }
    51945215      container.appendChild(wrapper);
    51955216    }
    … …  
    52915312      updateConfirmButton();
    52925313      updateHeightHint();
     5314      updateWeightHint();
    52935315    }
    52945316    function updateAutoLabel(name) {
    … …  
    52995321    }
    53005322    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       };
    53065323      const target = numero(fields.heightCm, 100, 220);
    53075324      const peso = numero(fields.weightKg, 30, 250);
    53085325      const daPeso = target != null && peso != null ? misureDaAltezzaPeso(target, peso, sessoFormula) : null;
     5326      updateWeightHint();
    53095327      if (daPeso) {
    53105328        for (const name of ["bustCm", "waistCm", "hipsCm"]) {
    … …  
    53335351        if (v != null) fields[name].value = String(v);
    53345352      }
     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";
    53355370    }
    53365371    function updateHeightHint() {
    … …  
    85658600            fitFitted: senzaChiave(getLocaleString("form.fit_fitted")),
    85668601            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"))
    85688606          },
    85698607          {
  • cabina/tags/1.3.5/cabina.php

    r3795263 r3803650  
    44 * Plugin URI: https://cabina.io/en/integrations/woocommerce
    55 * 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.4
     6 * Version: 1.3.5
    77 * Author: Cabina
    88 * Author URI: https://cabina.io
    … …  
    2121defined('ABSPATH') || exit;
    2222
    23 define('CABINA_VERSION', '1.3.4');
     23define('CABINA_VERSION', '1.3.5');
    2424define('CABINA_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2525define('CABINA_PLUGIN_URL', plugin_dir_url(__FILE__));
  • cabina/tags/1.3.5/readme.txt

    r3795263 r3803650  
    66Tested up to: 7.1
    77Requires PHP: 7.4
    8 Stable tag: 1.3.4
     8Stable tag: 1.3.5
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    124124== Changelog ==
    125125
     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
    126131= 1.3.4 =
    127132
  • cabina/trunk/assets/widget.iife.js

    r3795263 r3803650  
    49944994    };
    49954995  }
     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  }
    49965008  const FIELD_CONFIG = {
    49975009    heightCm: { label: "", placeholder: "170", min: 100, max: 220, step: 0.5, required: false },
    … …  
    50775089    let sessoFormula = sesso;
    50785090    let heightHintEl = null;
     5091    let weightHintEl = null;
    50795092    const fieldNames = ["heightCm", "weightKg", "bustCm", "waistCm", "hipsCm"];
    50805093    const invisibleLabels = [
    … …  
    51925205        heightHintEl = hint;
    51935206      }
     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      }
    51945215      container.appendChild(wrapper);
    51955216    }
    … …  
    52915312      updateConfirmButton();
    52925313      updateHeightHint();
     5314      updateWeightHint();
    52935315    }
    52945316    function updateAutoLabel(name) {
    … …  
    52995321    }
    53005322    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       };
    53065323      const target = numero(fields.heightCm, 100, 220);
    53075324      const peso = numero(fields.weightKg, 30, 250);
    53085325      const daPeso = target != null && peso != null ? misureDaAltezzaPeso(target, peso, sessoFormula) : null;
     5326      updateWeightHint();
    53095327      if (daPeso) {
    53105328        for (const name of ["bustCm", "waistCm", "hipsCm"]) {
    … …  
    53335351        if (v != null) fields[name].value = String(v);
    53345352      }
     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";
    53355370    }
    53365371    function updateHeightHint() {
    … …  
    85658600            fitFitted: senzaChiave(getLocaleString("form.fit_fitted")),
    85668601            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"))
    85688606          },
    85698607          {
  • cabina/trunk/cabina.php

    r3795263 r3803650  
    44 * Plugin URI: https://cabina.io/en/integrations/woocommerce
    55 * 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.4
     6 * Version: 1.3.5
    77 * Author: Cabina
    88 * Author URI: https://cabina.io
    … …  
    2121defined('ABSPATH') || exit;
    2222
    23 define('CABINA_VERSION', '1.3.4');
     23define('CABINA_VERSION', '1.3.5');
    2424define('CABINA_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2525define('CABINA_PLUGIN_URL', plugin_dir_url(__FILE__));
  • cabina/trunk/readme.txt

    r3795263 r3803650  
    66Tested up to: 7.1
    77Requires PHP: 7.4
    8 Stable tag: 1.3.4
     8Stable tag: 1.3.5
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    124124== Changelog ==
    125125
     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
    126131= 1.3.4 =
    127132
Note: See TracChangeset for help on using the changeset viewer.