👗

Welcome to Clothing Size Converter!

First time here? Perfect!

In just 3 minutes, you'll be converting sizes like a fashion expert!

No fashion experience needed!

🏆

Achievement Unlocked!

You're making great progress!

👗 Clothing Size Converter

Convert clothing sizes instantly between US, UK, EU, Asian and 10+ international sizing systems. Perfect for online shopping worldwide!

🎯 Choose Your Learning Mode

🤔 What Is Clothing Size Conversion?

Think of it like translating languages - but for clothes! Same shirt, different numbers!

Different countries use different sizing systems. A US size 8 dress might be a UK 12 or EU 40. This tool instantly translates between all sizing systems, making global shopping easy!

🛍️
Online Shopping
Buy from any country
✈️
Travel Shopping
Shop abroad confidently
🎁
Gift Buying
Get the right size
👔
Business Orders
International uniforms
📦
Import/Export
Fashion trade sizing
🏪
Retail
Help global customers

Quick Convert

👆

Select your size and click Convert!

Your international size chart will appear here

🎯 Try Popular Conversions

👗 US Size 8 Dress
Popular women's size to EU/UK
👔 EU 42 Men's Shirt
European to US/UK sizing
👟 UK 9 Shoes
Shoe size conversion
🎌 Asian XL
Asian to Western sizes
👶 Kids 110cm
Children's size by height
👖 32" Waist Jeans
Inch to international
`; } // Display results document.getElementById('resultsDisplay').innerHTML = `
${tableHTML} ${recommendation} ${brandHTML}
`; // Show OTA section showOTA(); // Track achievement OnboardingManager.unlockAchievement('first_conversion', '🎯 First Conversion', 'Successfully converted your first size!'); // Track analytics trackEvent('size_converted', { clothing_type: clothingType, from_system: fromSystem }); } function useSample(sampleId) { const samples = { 'us8-dress': { type: 'womens-dress', system: 'US', size: '8' }, 'eu42-shirt': { type: 'mens-shirt', system: 'EU', size: '50' }, 'uk9-shoes': { type: 'shoes', system: 'UK', size: '9' }, 'asian-xl': { type: 'mens-shirt', system: 'JP', size: 'LL' }, 'kids-110': { type: 'kids', system: 'CN', size: '110' }, 'jeans-32': { type: 'mens-pants', system: 'US', size: '32' } }; const sample = samples[sampleId]; if (sample) { document.getElementById('clothingType').value = sample.type; document.getElementById('fromSystem').value = sample.system; updateConverter(); setTimeout(() => { document.getElementById('sizeInput').value = sample.size; convertSize(); }, 100); } } function updateMeasurements() { const unit = document.querySelector('input[name="unit"]:checked').value; const chestInput = document.getElementById('chestMeasure'); const waistInput = document.getElementById('waistMeasure'); if (unit === 'inch') { chestInput.placeholder = 'e.g., 38'; waistInput.placeholder = 'e.g., 30'; } else { chestInput.placeholder = 'e.g., 96'; waistInput.placeholder = 'e.g., 76'; } } function skipOnboarding() { document.getElementById('onboardingModal').classList.remove('show'); localStorage.setItem('clothing_converter_visited', 'true'); } function startTutorial() { OnboardingManager.startTutorial(); } // ========== OTA FUNCTIONS ========== function showOTA() { const otaContainer = document.getElementById('otaContainer'); if (otaContainer && (otaContainer.style.display === 'none' || !otaContainer.style.display)) { otaContainer.style.display = 'block'; setTimeout(() => { const otaHeader = document.querySelector('.ota-header h3'); if (otaHeader) { otaHeader.style.animation = 'pulse 1s ease-in-out'; } }, 100); } } // ========== AI ASSISTANT FUNCTIONS ========== function openAIModal() { const modal = document.getElementById('aiModal'); if(modal) modal.classList.add('show'); if (aiModalState.apiKey && aiModalState.currentView === 'gemini') { showGeminiChat(); } else { showAISelector(); } updateAPIKeyStatus(); } function closeAIModal() { const modal = document.getElementById('aiModal'); if(modal) modal.classList.remove('show'); setTimeout(() => { aiModalState.currentView = 'selector'; showAISelector(); }, 300); } function showAISelector() { document.getElementById('aiModalTitle').textContent = 'Choose Your AI Assistant'; document.getElementById('aiSelector').style.display = 'flex'; document.getElementById('geminiChat').style.display = 'none'; document.getElementById('apiKeySetup').style.display = 'none'; aiModalState.currentView = 'selector'; } function showGeminiChat() { document.getElementById('aiModalTitle').innerHTML = ' Gemini AI Assistant'; document.getElementById('aiSelector').style.display = 'none'; document.getElementById('geminiChat').style.display = 'flex'; document.getElementById('apiKeySetup').style.display = 'none'; aiModalState.currentView = 'gemini'; const chatMessages = document.getElementById('chatMessages'); if (!chatMessages.innerHTML.trim()) { addMessage('assistant', `Hello! I can help you with: • Understanding size conversions • Finding your perfect fit • Shopping internationally • Brand-specific sizing What would you like to know?`); } } function showAPIKeySetup() { document.getElementById('aiModalTitle').textContent = 'Setup Gemini API'; document.getElementById('aiSelector').style.display = 'none'; document.getElementById('geminiChat').style.display = 'none'; document.getElementById('apiKeySetup').style.display = 'block'; aiModalState.currentView = 'setup'; } function selectAI(aiType) { switch(aiType) { case 'chatgpt': const toolContext = `I need help with Clothing Size Converter. This is a fashion utility on WIA Pin Code platform for converting international clothing sizes.`; const chatUrl = `https://chat.openai.com/?q=${encodeURIComponent(toolContext)}`; window.open(chatUrl, '_blank'); closeAIModal(); trackEvent('ai_selection', { ai_type: 'chatgpt' }); break; case 'claude': const claudeContext = `I need help with Clothing Size Converter. This is a fashion utility on WIA Pin Code platform for converting international clothing sizes.`; const claudeUrl = `https://claude.ai/chat?q=${encodeURIComponent(claudeContext)}`; window.open(claudeUrl, '_blank'); closeAIModal(); trackEvent('ai_selection', { ai_type: 'claude' }); break; case 'gemini': if (!aiModalState.apiKey) { showAPIKeySetup(); } else { showGeminiChat(); } trackEvent('ai_selection', { ai_type: 'gemini' }); break; } } function saveGeminiApiKey() { const apiKey = document.getElementById('geminiApiKeyInput').value.trim(); if (apiKey) { localStorage.setItem('geminiApiKey', apiKey); aiModalState.apiKey = apiKey; showGeminiChat(); updateAPIKeyStatus(); } else { alert('Please enter a valid API key'); } } function updateAPIKeyStatus() { const statusEl = document.getElementById('apiKeyStatus'); if (aiModalState.apiKey) { statusEl.innerHTML = 'Change API Key'; } else { statusEl.textContent = 'No API key set'; } } function addMessage(type, content) { const chatMessages = document.getElementById('chatMessages'); const messageDiv = document.createElement('div'); messageDiv.className = `message ${type}`; if (type === 'user') { messageDiv.innerHTML = `You: ${content}`; } else { messageDiv.innerHTML = `✨ Gemini:
${content.replace(/\n/g, '
')}`; } chatMessages.appendChild(messageDiv); chatMessages.scrollTop = chatMessages.scrollHeight; } async function sendToGemini() { const input = document.getElementById('geminiInput'); const message = input.value.trim(); if (!message) return; addMessage('user', message); input.value = ''; const loadingMsg = document.createElement('div'); loadingMsg.className = 'message assistant'; loadingMsg.innerHTML = '✨ Gemini:
Thinking...'; loadingMsg.id = 'loading-message'; document.getElementById('chatMessages').appendChild(loadingMsg); try { const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=${aiModalState.apiKey}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ contents: [{ parts: [{ text: `Context: User is using Clothing Size Converter tool on WIA Pin Code platform. This tool converts clothing sizes between different international systems. User question: ${message}` }] }], generationConfig: { temperature: 0.7, maxOutputTokens: 1000 } }) }); const data = await response.json(); document.getElementById('loading-message').remove(); if (data.candidates && data.candidates[0] && data.candidates[0].content) { const reply = data.candidates[0].content.parts[0].text; addMessage('assistant', reply); } else { addMessage('assistant', 'Sorry, I could not generate a response. Please try again.'); } } catch (error) { document.getElementById('loading-message')?.remove(); if (error.message.includes('API key')) { addMessage('error', 'Invalid API key. Please check your API key and try again.'); showAPIKeySetup(); } else { addMessage('error', 'Failed to connect to Gemini. Please check your internet connection.'); } } } // ========== UTILITY FUNCTIONS ========== function showNotification(message, type = 'success') { const toast = document.createElement('div'); toast.className = `toast ${type}`; toast.textContent = message; document.body.appendChild(toast); setTimeout(() => { toast.remove(); }, 3000); } function trackEvent(eventName, data = {}) { if (typeof gtag !== 'undefined') { gtag('event', eventName, { 'event_category': TOOL_CONFIG.category, 'event_label': TOOL_CONFIG.name, ...data }); } } async function updateToolCount() { try { const response = await fetch('/api/tool-count.php'); const data = await response.json(); document.querySelectorAll('.dynamic-tools-count').forEach(el => { el.textContent = `${data.count}+ free online tools in 211 languages. No signup, no fees, just tools that work.`; }); document.querySelectorAll('.dynamic-count').forEach(el => { const prefix = el.getAttribute('data-text') || ''; const suffix = el.getAttribute('data-suffix') || ''; const icon = el.textContent.split(' ')[0] || ''; el.textContent = `${icon} ${prefix} ${data.count}+ ${suffix}`; }); } catch (error) { const fallbackCount = 333; document.querySelectorAll('.dynamic-tools-count').forEach(el => { el.textContent = `${fallbackCount}+ free online tools in 211 languages. No signup, no fees, just tools that work.`; }); document.querySelectorAll('.dynamic-count').forEach(el => { const prefix = el.getAttribute('data-text') || ''; const suffix = el.getAttribute('data-suffix') || ''; const icon = el.textContent.split(' ')[0] || ''; el.textContent = `${icon} ${prefix} ${fallbackCount}+ ${suffix}`; }); } } function updateCurrentYear() { const currentYear = new Date().getFullYear(); document.querySelectorAll('.current-year').forEach(el => { el.textContent = currentYear; }); } // ========== EVENT LISTENERS ========== document.addEventListener('DOMContentLoaded', function() { // Initialize converter updateConverter(); // Initialize onboarding OnboardingManager.init(); // Add convert button ID for tutorial const convertBtns = document.querySelectorAll('.btn'); convertBtns.forEach(btn => { if (btn.textContent.includes('Convert')) { btn.id = 'convertBtn'; } }); // AI button event document.getElementById('aiBtn').addEventListener('click', openAIModal); // Modal outside click document.getElementById('aiModal').addEventListener('click', function(e) { if (e.target === this) { closeAIModal(); } }); // Keyboard events document.addEventListener('keydown', function(e) { if (e.key === 'Enter') { const geminiInput = document.getElementById('geminiInput'); if (document.activeElement === geminiInput) { sendToGemini(); } } if (e.key === 'Escape') { closeAIModal(); } }); // Initialize API key status updateAPIKeyStatus(); updateCurrentYear(); updateToolCount(); // Track WIA Pin Code clicks document.querySelectorAll('a[href*="wia"]').forEach(link => { link.addEventListener('click', function() { trackEvent('wia_link_click', { link: link.textContent }); }); }); }); // Google Analytics window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-XXXXXXXXX'); trackEvent('page_view', { tool: TOOL_CONFIG.name, category: TOOL_CONFIG.category });