PageSourceSearch

https://www.banden-kopen.nl/static/version1790892678/frontend/Mage…/Arman_MatchMyCar/js/matchmycar.min.js

js banden-kopen.nl collected 2026-10-02 02:02:48 UTC 7,834 bytes, 50 lines download raw bytes

1(function(){'use strict';var SEARCH_URL='/matchmycar/frontend_search/index';window.MatchMyCar={init:function(containerId,options){var container=document.getElementById(containerId);if(!container)return;options=options||{};var makeSelect=container.querySelector('[data-mmc-make]');var modelSelect=container.querySelector('[data-mmc-model]');var yearSelect=container.querySelector('[data-mmc-year]');var submitBtn=container.querySelector('[data-mmc-submit]');var tiresResult=container.querySelector('[data-mmc-tires]');if(!makeSelect)return;this._fetch('makes',{},function(data){makeSelect.innerHTML='<option value="">-- Kies merk --</option>';(data.makes||[]).forEach(function(m){var opt=document.createElement('option');opt.value=m.make_slug;opt.textContent=m.make;makeSelect.appendChild(opt);});makeSelect.disabled=false;});makeSelect.addEventListener('change',function(){var makeSlug=this.value;if(modelSelect){modelSelect.innerHTML='<option value="">-- Kies model --</option>';modelSelect.disabled=true;}
2if(yearSelect){yearSelect.innerHTML='<option value="">-- Kies jaar --</option>';yearSelect.disabled=true;}
3if(!makeSlug)return;MatchMyCar._fetch('models',{make:makeSlug},function(data){if(!modelSelect)return;modelSelect.innerHTML='<option value="">-- Kies model --</option>';(data.models||[]).forEach(function(m){var opt=document.createElement('option');opt.value=m.model_slug;opt.textContent=m.model+' ('+m.year_from+'-'+(m.year_to||'heden')+')';modelSelect.appendChild(opt);});modelSelect.disabled=false;});});if(modelSelect){modelSelect.addEventListener('change',function(){var makeSlug=makeSelect.value;var modelSlug=this.value;if(yearSelect){yearSelect.innerHTML='<option value="">-- Kies jaar --</option>';yearSelect.disabled=true;}
4if(!makeSlug||!modelSlug)return;MatchMyCar._fetch('years',{make:makeSlug,model:modelSlug},function(data){if(!yearSelect)return;yearSelect.innerHTML='<option value="">-- Kies jaar --</option>';(data.years||[]).forEach(function(y){var opt=document.createElement('option');opt.value=y;opt.textContent=y;yearSelect.appendChild(opt);});yearSelect.disabled=false;});});}
5if(submitBtn){submitBtn.addEventListener('click',function(){var makeSlug=makeSelect.value;var modelSlug=modelSelect?modelSelect.value:'';var year=yearSelect?parseInt(yearSelect.value,10):0;if(!makeSlug||!modelSlug||!year){alert('Selecteer merk, model en bouwjaar.');return;}
6submitBtn.textContent='Zoeken...';submitBtn.disabled=true;MatchMyCar._fetch('tires',{make:makeSlug,model:modelSlug,year:year},function(data){submitBtn.textContent='Zoek banden';submitBtn.disabled=false;if(options.onSelect){options.onSelect(data);return;}
7if(!data.tires||!data.tires.length){if(tiresResult){tiresResult.innerHTML='<div style="padding:16px;text-align:center;color:#9aa5b4;font-size:.85rem;">'
8+'Geen bandenmaten gevonden voor dit voertuig.</div>';tiresResult.style.display='block';}
9return;}
10if(data.tires.length===1&&data.tires[0].search_url){window.location.href=data.tires[0].search_url;return;}
11MatchMyCar._renderTires(data.tires,tiresResult,makeSelect,modelSelect,yearSelect);});});}},_renderTires:function(tires,container,makeEl,modelEl,yearEl){if(!container)return;var make=makeEl?makeEl.options[makeEl.selectedIndex].text:'';var model=modelEl?modelEl.options[modelEl.selectedIndex].text:'';var year=yearEl?yearEl.value:'';var html='<div style="margin-top:16px;">'
12+'<div style="font-size:.72rem;font-weight:700;text-transform:uppercase;'
13+'letter-spacing:1.5px;color:#9aa5b4;margin-bottom:10px;">'
14+'Bandenmaten voor '+make+' '+model+' '+year+'</div>'
15+'<div style="display:flex;gap:8px;flex-wrap:wrap;">';
15tires.forEach(function(tire){var url=tire.category_url||tire.search_url||'#';html+='<a href="'+url+'" '
16+'style="display:inline-flex;align-items:center;gap:6px;'
17+'background:#1a2740;color:#fff;padding:10px 18px;border-radius:8px;'
18+'text-decoration:none;font-size:.88rem;font-weight:700;'
19+'border:1.5px solid transparent;transition:all .2s;" '
20+'onmouseover="this.style.borderColor=\'#e8552a\';this.style.background=\'#e8552a\';" '
21+'onmouseout="this.style.borderColor=\'transparent\';this.style.background=\'#1a2740\';">'
22+'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'
23+'<circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="4"/></svg>'
24+tire.tire_size
25+(tire.bolt_pattern?' <span style="font-size:.72rem;opacity:.6;font-weight:400;">('+tire.bolt_pattern+')</span>':'')
26+'</a>';});html+='</div></div>';container.innerHTML=html;container.style.display='block';},_fetch:function(action,params,callback){var url=SEARCH_URL+'?action='+encodeURIComponent(action);Object.keys(params).forEach(function(k){url+='&'+encodeURIComponent(k)+'='+encodeURIComponent(params[k]);});fetch(url).then(function(r){return r.json();}).then(function(data){if(data.success)callback(data);}).catch(function(e){console.error('MatchMyCar fetch error:',e);});},initFitsOn:function(containerId,tireSize){var container=document.getElementById(containerId);if(!container||!tireSize)return;var url=SEARCH_URL+'?action=vehicles_by_tire&tire_size='+encodeURIComponent(tireSize);fetch(url).then(function(r){return r.json();}).then(function(data){if(!data.success||!data.vehicles||!data.vehicles.length)return;var html='<div class="mmc-fits-on">'
27+'<div class="mmc-fits-on-title">'
28+'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">'
29+'<path d="M5 17H3a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v3"/>'
30+'<rect x="9" y="11" width="14" height="10" rx="2"/>'
31+'<circle cx="12" cy="20" r="1"/><circle cx="20" cy="20" r="1"/></svg>'
32+' Past op '+data.total+' voertuigen'
33+'</div>'
34+'<div class="mmc-fits-on-list">';data.vehicles.forEach(function(v){html+='<div class="mmc-fits-on-item">'
35+v.make+' '+v.model
36+' <span class="mmc-fits-on-years">('+v.year_from+'-'+(v.year_to||'heden')+')</span>'
37+'</div>';});if(data.total>data.vehicles.length){html+='<div class="mmc-fits-on-more">+ '+(data.total-data.vehicles.length)+' andere voertuigen</div>';}
38html+='</div></div>';container.innerHTML=html;container.style.display='block';}).catch(function(){});},initBandScanWidget:function(tireSize){if(!tireSize)return;var existing=document.getElementById('mmc-bandscan-widget');if(existing)existing.remove();var url=SEARCH_URL+'?action=vehicles_by_tire&tire_size='+encodeURIComponent(tireSize)+'&limit=6';fetch(url).then(function(r){return r.json();}).then(function(data){if(!data.success||!data.vehicles||!data.vehicles.length)return;var el=document.createElement('div');el.id='mmc-bandscan-widget';el.style.cssText='background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08);'
39+'border-radius:10px;padding:14px 18px;margin-bottom:24px;';var vehicleHtml=data.vehicles.map(function(v){return'<span style="display:inline-flex;align-items:center;gap:4px;background:rgba(255,255,255,.07);'
40+'border-radius:100px;padding:3px 10px;font-size:.72rem;color:rgba(255,255,255,.7);margin:2px;">'
41+v.make+' '+v.model
42+' <span style="opacity:.5;">('+v.year_from+'-'+(v.year_to||'nu')+')</span>'
43+'</span>';}).join('');el.innerHTML='<div style="font-size:.68rem;font-weight:700;text-transform:uppercase;'
44+'letter-spacing:1.5px;color:#e8552a;margin-bottom:8px;">'
45+'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="vertical-align:middle;margin-right:4px;">'
46+'<path d="M5 17H3a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v3"/>'
47+'<rect x="9" y="11" width="14" height="10" rx="2"/></svg>'
48+'Deze maat past op '+data.total+' voertuigen'
49+'</div>'
50+'<div style="display:flex;flex-wrap:wrap;gap:4px;">'+vehicleHtml+'</div>';var specsEl=document.getElementById('bs-band-specs');if(specsEl&&specsEl.parentNode){specsEl.parentNode.insertBefore(el,specsEl.nextSibling);}}).catch(function(){});}};}());

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.