Descrição
Calculadora de Tamanhos
Insere as medidas em milímetros (mm) para ver o tamanho ideal.
// Tabela de medidas oficial do modelo Blanditos Caicos (Tamanhos 20 ao 26)
const currentShoeData = [
{ size: 27, length: 176, width: 75 },
{ size: 28, length: 182, width: 75 },
{ size: 29, length: 190, width: 76 },
{ size: 30, length: 196, width: 78 },
{ size: 31, length: 203, width: 80 },
{ size: 32, length: 209, width: 81 },
{ size: 33, length: 216, width: 82 },
{ size: 34, length: 220, width: 84 },
];
function calculateRuutSizeInstant() {
const footLenInput = document.getElementById(‘foot-length’).value;
const footWidthInput = document.getElementById(‘foot-width’).value;
const sizeDisplay = document.getElementById(‘calc_result_size’);
const detailsDisplay = document.getElementById(‘calc_result_details’);
const resultBox = document.getElementById(‘calculator-result-box’);
const rulerWrapper = document.getElementById(‘ruut-ruler-wrapper’);
const rulerMarker = document.getElementById(‘ruler-marker’);
const rulerArrow = document.getElementById(‘ruler-arrow’);
if (!footLenInput || parseFloat(footLenInput) <= 0) {
sizeDisplay.innerText = "–";
sizeDisplay.style.color = "#ddd";
detailsDisplay.innerHTML = "Introduz as medidas do pezinho para calcular.";
detailsDisplay.style.color = "#555";
resultBox.style.borderColor = "#eaeaea";
resultBox.style.background = "#ffffff";
rulerWrapper.style.display = "none";
return;
}
const footLength = parseFloat(footLenInput);
const footWidth = footWidthInput ? parseFloat(footWidthInput) : null;
let recommendedSize = null;
let widthWarning = false;
let cFolga = 0;
// Regra da Ruut: Folga ideal de +8mm a +12mm
for (let i = 0; i = footLength + 8 && shoe.length shoe.width) widthWarning = true;
break;
} else if (shoe.length > footLength + 12 && i === 0) {
recommendedSize = “Abaixo do 20”;
break;
} else if (shoe.length > footLength + 12) {
const prevShoe = currentShoeData[i – 1];
if (prevShoe.length >= footLength + 8) {
recommendedSize = prevShoe;
if (footWidth && prevShoe.width !== null && footWidth > prevShoe.width) widthWarning = true;
} else {
recommendedSize = shoe;
if (footWidth && shoe.width !== null && footWidth > shoe.width) widthWarning = true;
}
break;
}
}
if (recommendedSize === null && footLength > (currentShoeData[currentShoeData.length – 1].length – 8)) {
recommendedSize = “Acima do 26”;
}
rulerWrapper.style.display = “block”;
if (recommendedSize === “Abaixo do 20” || recommendedSize === “Acima do 26”) {
sizeDisplay.innerText = “❌”;
sizeDisplay.style.color = “#e74c3c”;
resultBox.style.borderColor = “#ffcccc”;
resultBox.style.background = “#fff5f5”;
detailsDisplay.style.color = “#555”;
if (recommendedSize === “Abaixo do 20”) {
const folgaMax = currentShoeData[0].length – footLength;
detailsDisplay.innerHTML = `Pé pequeno para o tamanho mínimo (20).
Folga de ${folgaMax}mm no Tam. 20 (máx. ideal: 12mm).`;
updateIndicators(folgaMax);
} else {
const folgaMin = currentShoeData[currentShoeData.length – 1].length – footLength;
detailsDisplay.innerHTML = `Pé ultrapassa o tamanho máximo disponível (26).
Folga de apenas ${folgaMin}mm no Tam. 26.`;
updateIndicators(folgaMin);
}
} else {
sizeDisplay.innerText = recommendedSize.size;
cFolga = recommendedSize.length – footLength;
if (cFolga >= 8 && cFolga <= 12) {
sizeDisplay.style.color = "#2ecc71"; // Verde Ideal
resultBox.style.borderColor = "#bbf7d0";
resultBox.style.background = "#f0fdf4";
} else {
sizeDisplay.style.color = "#e74c3c"; // Vermelho fora da folga ideal
resultBox.style.borderColor = "#ffcccc";
resultBox.style.background = "#fff5f5";
}
let text = `Fica com +${cFolga}mm de folga no comprimento.`;
if (footWidth && recommendedSize.width !== null) {
const lFolga = recommendedSize.width – footWidth;
if (widthWarning) {
text += `
⚠️ Ajuste lateral justo (${lFolga}mm de folga).`;
} else {
text += `
E +${lFolga}mm de folga na largura.`;
}
}
detailsDisplay.innerHTML = text;
detailsDisplay.style.color = “#333”;
updateIndicators(cFolga);
}
}
function updateIndicators(folgaMm) {
const marker = document.getElementById(‘ruler-marker’);
const arrow = document.getElementById(‘ruler-arrow’);
let percentage = 0;
if (folgaMm <= 8) {
percentage = (folgaMm / 8) * 40;
} else if (folgaMm <= 12) {
percentage = 40 + ((folgaMm – 8) / 4) * 20;
} else {
percentage = 60 + ((folgaMm – 12) / 8) * 40;
}
if (percentage 100) percentage = 100;
marker.style.left = percentage + “%”;
arrow.style.left = percentage + “%”;
}







Avaliações
Ainda não existem avaliações.