/* Add custom JS code below */

ابحث عن كفر سيارتك

اختر المقاس والماركة للحصول على الكفر المناسب

ابحث عن كفر سيارتك

اختر المقاس والماركة للحصول على الكفر المناسب

/* =========================================== Tire Search Database v1.0 جميع الماركات والمقاسات =========================================== */ /*========================= ماركات الكفرات =========================*/ const tireBrands = [ "GOODYEAR", "MICHELIN", "BRIDGESTONE", "PIRELLI", "CONTINENTAL", "YOKOHAMA", "DUNLOP", "HANKOOK", "TOYO", "FALKEN", "NEXEN", "SAILUN", "COMFORSER", "ARISUN", "HAMANN", "KUMHO", "MAXXIS", "COOPER", "GENERAL TIRE", "BFGOODRICH", "ATTURO", "ACCELERA", "APTANY", "ROADSTONE", "DOUBLESTAR", "GOODRIDE", "TRIANGLE", "LINGLONG", "WINRUN", "JOYROAD", "LEAO", "LANDSAIL", "MILEKING", "SUNFULL", "OTANI", "ROADX", "FORTUNE", "HAIDA", "DELINTE", "TORQUE" ]; /*========================= ماركات الجنوط =========================*/ const wheelBrands=[ "FUEL", "METHOD", "BLACK RHINO", "XD", "KMC", "HOSTILE", "FUEL OFFROAD", "ROTIFORM", "VOSSEN", "BBS", "OZ", "RAYS", "ENKEI", "WORK", "ADVAN", "FIFTEEN52", "KONIG", "XXR", "MKW", "HAMANN" ]; /*========================= العرض =========================*/ const widths=[ 125,135,145,155,165, 175,185,195, 205,215,225, 235,245,255, 265,275,285, 295,305,315, 325,335,345, 355,365,375, 385,395 ]; /*========================= الارتفاع =========================*/ const profiles=[ 20,25,30,35, 40,45,50, 55,60,65, 70,75,80, 85,90,95 ]; /*========================= الجنوط =========================*/ const rims=[ 10,12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26 ]; /*========================= عرض الجنط =========================*/ const wheelWidths=[ 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 12, 13, 14 ]; /*========================= عدد المسامير =========================*/ const bolts=[ "4x100", "4x108", "5x100", "5x108", "5x110", "5x112", "5x114.3", "5x120", "5x127", "6x114.3", "6x139.7", "8x165.1" ]; /*========================= Offset =========================*/ const offsets=[]; for(let i=-50;i<=70;i++){ offsets.push(i); } /*========================= Center Bore =========================*/ const centerBore=[ 54.1, 56.1, 57.1, 60.1, 63.4, 66.1, 67.1, 70.3, 71.6, 72.6, 73.1, 74.1, 78.1, 84.1, 106.1 ]; /* ========================================== Tire Size Relations Width -> Profile -> Rim ========================================== */ const tireDatabase = { 175: { 65: [14, 15], 70: [13, 14], 75: [14] }, 185: { 55: [15, 16], 60: [14, 15], 65: [14, 15], 70: [14] }, 195: { 45: [16], 50: [15, 16], 55: [15, 16], 60: [15, 16], 65: [15], 70: [14, 15] }, 205: { 40: [17], 45: [16, 17], 50: [16, 17], 55: [16, 17, 18], 60: [15, 16], 65: [15, 16], 70: [15] }, 215: { 35: [18], 40: [17, 18], 45: [17, 18], 50: [16, 17], 55: [16, 17, 18], 60: [16, 17], 65: [16], 70: [15, 16] }, 225: { 35: [18, 19], 40: [18], 45: [17, 18], 50: [17, 18], 55: [17, 18], 60: [16, 17], 65: [16] }, 235: { 35: [19], 40: [18, 19], 45: [17, 18], 50: [17, 18], 55: [17, 18], 60: [16, 17], 65: [16] }, 245: { 35: [19, 20], 40: [18, 19], 45: [18, 19], 50: [17, 18], 55: [17, 18], 60: [17] }, 255: { 35: [19, 20], 40: [18, 19], 45: [18, 19], 50: [18], 55: [17, 18], 60: [17] }, 265: { 60: [17, 18], 65: [17, 18], 70: [16, 17], 75: [16] }, 275: { 55: [18, 20], 60: [18], 65: [17, 18], 70: [17] }, 285: { 50: [20], 55: [18, 20], 60: [18], 65: [17] }, 295: { 40: [20, 22], 45: [20], 50: [20], 55: [18] }, 305: { 35: [20, 22], 40: [20], 45: [20] }, 315: { 35: [20, 22], 40: [20], 45: [20] } }; /* ========================================== Smart Tire Filter ========================================== */ const widthSelect = document.getElementById("width"); const profileSelect = document.getElementById("profile"); const rimSelect = document.getElementById("rim"); /* تعبئة قائمة العرض */ function loadWidths() { widthSelect.innerHTML = ''; Object.keys(tireDatabase).forEach(width => { widthSelect.innerHTML += ``; }); } /* تحديث الارتفاعات */ function loadProfiles(width) { profileSelect.innerHTML = ''; rimSelect.innerHTML = ''; if (!width || !tireDatabase[width]) return; Object.keys(tireDatabase[width]).forEach(profile => { profileSelect.innerHTML += ``; }); } /* تحديث الجنوط */ function loadRims(width, profile) { rimSelect.innerHTML = ''; if ( !width || !profile || !tireDatabase[width] || !tireDatabase[width][profile] ) return; tireDatabase[width][profile].forEach(rim => { rimSelect.innerHTML += ``; }); } /* الأحداث */ widthSelect.addEventListener("change", function () { loadProfiles(this.value); }); profileSelect.addEventListener("change", function () { loadRims( widthSelect.value, this.value ); }); /* تشغيل أول مرة */ loadWidths(); /* ========================================== Search Type Switcher ========================================== */ const tireForm = document.getElementById("tireForm"); const wheelForm = document.getElementById("wheelForm"); const searchTypes = document.querySelectorAll( 'input[name="searchType"]' ); searchTypes.forEach(radio=>{ radio.addEventListener("change",()=>{ if(radio.value==="tires"){ tireForm.style.display="grid"; wheelForm.style.display="none"; }else{ tireForm.style.display="none"; wheelForm.style.display="grid"; } }); }); /* ========================================== Wheel Database Loader ========================================== */ const wheelBrand=document.getElementById("wheelBrand"); const wheelSize=document.getElementById("wheelSize"); const wheelWidth=document.getElementById("wheelWidth"); const pcd=document.getElementById("pcd"); const offset=document.getElementById("offset"); wheelBrands.forEach(item=>{ wheelBrand.innerHTML+=` `; }); rims.forEach(item=>{ wheelSize.innerHTML+=` `; }); wheelWidths.forEach(item=>{ wheelWidth.innerHTML+=` `; }); bolts.forEach(item=>{ pcd.innerHTML+=` `; }); offsets.forEach(item=>{ offset.innerHTML+=` `; }); /* ========================================== Smart Search Engine ========================================== */ const tireSearchBtn = document.getElementById("searchTires"); const wheelSearchBtn = document.getElementById("searchWheels"); /* ========================= بحث الكفرات ========================= */ tireSearchBtn.addEventListener("click", function () { const brand = document.getElementById("brand").value; const width = document.getElementById("width").value; const profile = document.getElementById("profile").value; const rim = document.getElementById("rim").value; let query = []; if (brand) query.push(brand); if (width && profile && rim) { query.push(`${width}/${profile}R${rim}`); } else { if (width) query.push(width); if (profile) query.push(profile); if (rim) query.push(`R${rim}`); } if (query.length === 0) { alert("اختر مقاس الكفر أو الماركة أولاً"); return; } window.location.href = "/search?q=" + encodeURIComponent(query.join(" ")); }); /* ========================= بحث الجنوط ========================= */ wheelSearchBtn.addEventListener("click", function () { const brand = document.getElementById("wheelBrand").value; const size = document.getElementById("wheelSize").value; const width = document.getElementById("wheelWidth").value; const pcd = document.getElementById("pcd").value; const offset = document.getElementById("offset").value; let query = []; if (brand) query.push(brand); if (size) query.push(size); if (width) query.push(width); if (pcd) query.push(pcd); if (offset) query.push("ET" + offset); if (query.length === 0) { alert("اختر مواصفات الجنط أولاً"); return; } window.location.href = "/search?q=" + encodeURIComponent(query.join(" ")); }); /* ================================== Vehicle Database ================================== */ const vehicles = { "TOYOTA":{ "Camry":{ "2024":{ "SE":"235/45R18", "LE":"215/55R17" }, "2023":{ "SE":"235/45R18", "LE":"215/55R17" } }, "Land Cruiser":{ "2024":{ "GXR":"265/65R18", "VXR":"275/50R22" } } }, "NISSAN":{ "Patrol":{ "2024":{ "SE":"275/65R18", "LE":"265/70R17" } }, "Altima":{ "2024":{ "215/55R17":"215/55R17" } } }, "HYUNDAI":{ "Sonata":{ "2024":{ "Smart":"235/45R18", "Base":"215/55R17" } } } };