1 line
961 B
JavaScript
1 line
961 B
JavaScript
(function(){var s=document.getElementById("modelSelect");if(!s)return;var w=s.parentElement;var d=document.createElement("input");d.id="ddSearch";d.placeholder="Filtrer 394 options...";d.style.cssText="width:100%;padding:7px 10px;background:rgba(0,0,0,.3);border:1px solid rgba(255,255,255,.1);border-radius:8px;color:#fafafa;font-size:12px;margin-bottom:5px;outline:none;display:none";w.insertBefore(d,s);s.addEventListener("focus",function(){d.style.display="block";d.focus()});d.addEventListener("input",function(){var q=this.value.toLowerCase();s.querySelectorAll("optgroup").forEach(function(g){var v=0;Array.from(g.children).forEach(function(o){var m=o.textContent.toLowerCase().indexOf(q)>=0||o.value.indexOf(q)>=0;o.hidden=!m;if(m)v++});g.hidden=!v})});d.addEventListener("blur",function(){var self=this;setTimeout(function(){self.style.display="none";self.value="";s.querySelectorAll("optgroup,option").forEach(function(e){e.hidden=false})},300)})})(); |