Comply Compatible List
<div style="max-width: 600px; margin: 0 auto; padding: 20px; border: 1px solid #ddd; border-radius: 8px; font-family: sans-serif;"> <h3 style="text-align: center; margin-bottom: 20px;">尋找適合您的 Comply 耳膠</h3> <div style="margin-bottom: 15px;"> <label for="brandSelect" style="display: block; margin-bottom: 5px; font-weight: bold;">1. 選擇耳機品牌:</label> <select id="brandSelect" style="width: 100%; padding: 10px; border-radius: 4px; border: 1px solid #ccc;"> <option value="">請選擇品牌...</option> </select> </div> <div style="margin-bottom: 15px;"> <label for="modelSelect" style="display: block; margin-bottom: 5px; font-weight: bold;">2. 選擇耳機型號:</label> <select id="modelSelect" disabled style="width: 100%; padding: 10px; border-radius: 4px; border: 1px solid #ccc; background-color: #f9f9f9;"> <option value="">請先選擇品牌...</option> </select> </div> <div id="resultBox" style="margin-top: 25px; padding: 15px; background-color: #f0f8ff; border-radius: 4px; text-align: center; display: none;"> <span style="font-size: 1.1em; color: #555;">適用的 Comply 型號為:</span><br> <span id="complyResult" style="font-size: 1.5em; font-weight: bold; color: #e60012; display: block; margin-top: 10px;"></span> </div></div><script>const earphoneData = [ { make: "Apple®", model: "AirPods Pro (Gen 1 & Gen 2)", tip: "Apple Airpods Pro TrueGrip" }, { make: "Samsung", model: "Galaxy Buds3 Pro", tip: "Samsung Galaxy Buds Pro 3 TrueGrip" }, { make: "Sony®", model: "WF-1000XM5", tip: "Sony TrueGrip for WF-1000XM5 (TW-200-C)" }, { make: "Google", model: "Pixel Buds Pro 2", tip: "TW-700-B" }, { make: "Sony®", model: "WF-1000XM4", tip: "Sony TrueGrip (TW-200-C)" }, { make: "Sennheiser™", model: "Momentum True Wireless 4", tip: "TW-400-C" } ];const brandSelect = document.getElementById('brandSelect');const modelSelect = document.getElementById('modelSelect');const resultBox = document.getElementById('resultBox');const complyResult = document.getElementById('complyResult');const uniqueBrands = [...new Set(earphoneData.map(item => item.make))].sort();uniqueBrands.forEach(brand => { const option = document.createElement('option'); option.value = brand; option.textContent = brand; brandSelect.appendChild(option);});brandSelect.addEventListener('change', function() { const selectedBrand = this.value; modelSelect.innerHTML = '<option value="">請選擇型號...</option>'; resultBox.style.display = 'none'; if (selectedBrand) { modelSelect.disabled = false; modelSelect.style.backgroundColor = '#fff'; const models = earphoneData.filter(item => item.make === selectedBrand); models.forEach(item => { const option = document.createElement('option'); option.value = item.model; option.textContent = item.model; modelSelect.appendChild(option); }); } else { modelSelect.disabled = true; modelSelect.style.backgroundColor = '#f9f9f9'; modelSelect.innerHTML = '<option value="">請先選擇品牌...</option>'; }});modelSelect.addEventListener('change', function() { const selectedBrand = brandSelect.value; const selectedModel = this.value; if (selectedModel) { const matchedData = earphoneData.find(item => item.make === selectedBrand && item.model === selectedModel); if (matchedData) { if (matchedData.tip === "No Compatibility") { complyResult.textContent = "目前無相容型號"; complyResult.style.color = "#888"; } else { complyResult.textContent = matchedData.tip; complyResult.style.color = "#e60012"; } resultBox.style.display = 'block'; } } else { resultBox.style.display = 'none'; }});</script>