PageSourceSearch

https://akzs.ru/bitrix/components/bitrix/search.suggest.input/templates/.default/script.min.js?17429941987997

js akzs.ru collected 2026-10-02 16:29:43 UTC 7,997 bytes, 2 lines download raw bytes

1function JsSuggest(oHandler,sParams,sParser){var t=this;t.oObj=oHandler;t.sParams=sParams;if(sParser){t.sExp=new RegExp("["+sParser+"]+","i")}else{t.sExp=new RegExp(",")}t.oLast={str:false,arr:false};t.oThis={str:false,arr:false};t.oEl={start:false,end:false};t.oUnfinedWords={};t.bReady=true;t.eFocus=true;t.aDiv=null;t.oDiv=null;t.oActive=null;t.oPointer=[];t.oPointer_default=[];t.oPointer_this="input_field";t.oObj.onblur=function(){t.eFocus=false};t.oObj.onfocus=function(){if(!t.eFocus){t.eFocus=true;setTimeout((function(){t.CheckModif("focus")}),500)}};t.oLast["arr"]=t.oObj.value.split(t.sExp);t.oLast["str"]=t.oLast["arr"].join(":");setTimeout((function(){t.CheckModif("this")}),500);this.CheckModif=function(e){var o=false;var r=0;var n=false;var i="";var s={};if(!t.eFocus){return}if(t.bReady&&t.oObj.value.length>0){t.oThis["arr"]=t.oObj.value.split(t.sExp);t.oThis["str"]=t.oThis["arr"].join(":");if(t.oThis["str"]&&t.oThis["str"]!=t.oLast["str"]){s["position"]=TCJsUtils.getCursorPosition(t.oObj);if(s["position"]["end"]>0&&!t.sExp.test(t.oObj.value.substr(s["position"]["end"]-1,1))){s["arr"]=t.oObj.value.substr(0,s["position"]["end"]).split(t.sExp);o=t.oThis["arr"][s["arr"].length-1];t.oEl["start"]=s["position"]["end"]-s["arr"][s["arr"].length-1].length;t.oEl["end"]=t.oEl["start"]+o.length;t.oEl["content"]=o;t.oLast["arr"]=t.oThis["arr"];t.oLast["str"]=t.oThis["str"]}}if(o){for(r=2;r<=o.length;r++){i=o.substr(0,r);if(t.oUnfinedWords[i]=="!fined"){n=true;break}}if(!n){t.Send(o)}}}setTimeout((function(){t.CheckModif("this")}),500)};t.Send=function(sSearch){if(!sSearch){return}var oError=[];t.bReady=false;if(BX("wait_container")){BX("wait_container").innerHTML=BX.message("JS_CORE_LOADING");BX.show(BX("wait_container"))}BX.ajax.post("/bitrix/components/bitrix/search.suggest.input/search.php",{search:sSearch,params:t.sParams},(function(data){var result={};t.bReady=true;try{eval("result = "+data+";")}catch(t){oError["result_unval"]=t}if(TCJsUtils.empty(result)){oError["result_empty"]="Empty result"}try{if(TCJsUtils.empty(oError)&&typeof result=="object"){if(!(result.length==1&&result[0]["NAME"]==t.oEl["content"])){t.Show(result);return}}else{t.oUnfinedWords[t.oEl["content"]]="!fined"}}catch(t){oError["unknown_error"]=t}if(BX("wait_container")){BX.hide(BX("wait_container"))}}))};t.Show=function(e){t.Destroy();t.oDiv=document.body.appendChild(document.createElement("DIV"));t.oDiv.id=t.oObj.id+"_div";t.oDiv.className="search-popup";t.oDiv.style.position="absolute";t.aDiv=t.Print(e);var o=TCJsUtils.GetRealPos(t.oObj);t.oDiv.style.width=parseInt(o["width"],10)+"px";TCJsUtils.show(t.oDiv,o["left"],o["bottom"]);TCJsUtils.addEvent(document,"click",t.CheckMouse);TCJsUtils.addEvent(document,"keydown",t.CheckKeyword)};t.Print=function(e){var o=null;var r={};var n=0;var i=null;var s=null;var a=t.oDiv.id;for(var l in e){if(e.hasOwnProperty(l)){o=e[l];var c={};c["ID"]=o["ID"]&&o["ID"].length>0?o["ID"]:n++;c["GID"]=a+"_"+c["ID"];c["NAME"]=TCJsUtils.htmlspecialcharsEx(o["NAME"]);c["CNT"]=o["CNT"];r[c["GID"]]=c;t.oPointer.push(c["GID"]);i=t.oDiv.appendChild(document.createElement("DIV"));i.id=c["GID"];i.name=a+"_div";i.className="search-popup-row";i.onmouseover=function(){t.Init();this.className="search-popup-row-active"};i.onmouseout=function(){t.Init();this.className="search-popup-row"};i.onclick=function(){t.oActive=this.id};s=i.appendChild(document.createElement("DIV"));s.id=i.id+"_NAME";s.className="search-popup-el search-popup-el-cnt";s.innerHTML=c["CNT"];s=i.appendChild(document.createElement("DIV"));s.id=i.id+"_NAME";s.className="search-popup-el search-popup-el-name";s.innerHTML=c["NAME"]}}t.oPointer.push("input_field");t.oPointer_default=t.oPointer;return r};t.Destroy=function(){try{TCJsUtils.hide(t.oDiv);t.oDiv.parentNode.removeChild(t.oDiv)}catch(t){}t.aDiv=[];t.oPointer=[];t.oPointer_default=[];t.oPointer_this="input_field";t.bReady=true;t.eFocus=true;t.oActive=null;TCJsUtils.removeEvent(document,"click",t.CheckMouse);TCJsUtils.removeEvent(document,"keydown",t.CheckKeyword)};t.Replace=function(){if(typeof t.oActive=="string"){var e=t.aDiv[t.oActive];var o="";if(typeof e=="object"){var r=document.createElement("span");r.innerHTML=e["NAME"].replaceAll("&quot;",'"').replaceAll("&amp;","&");o=r.innerHTML}var n=t.oEl["start"];while(n<t.oObj.value.length&&t.oObj.value.substring(n,n+1)==" "){n++}t.oObj.value=t.oObj.value.substring(0,n)+o.replaceAll("&lt;","<").replaceAll("&gt;",">")+t.oObj.value.substr(t.oEl["end"]);TCJsUtils.setCursorPosition(t.oObj,n+o.length)}};t.Init=function(){t.oActive=false;t.oPointer=t.oPointer_default;t.Clear();t.oPointer_this="input_pointer"};t.Clear=function(){var e=t.oDiv.getElementsByTagName("div");if(e.length>0&&typeof e=="object"){for(var o in e){if(e.hasOwnProperty(o)){var r=e[o];if(r&&typeof r=="object"&&r.name==t.oDiv.id+"_div"){r.className="search-popup-row"}}}}};t.CheckMouse=function(){t.Replace();t.Destroy()};t.CheckKeyword=function(e){var o=e||window.event;var r=null;var n=null;if(o.keyCode>37&&o.keyCode<41||o.keyCode==13){t.Clear();switch(o.keyCode){case 38:r=t.oPointer.pop();if(t.oPointer_this==r){t.oPointer.unshift(r);r=t.oPointer.pop()}if(r!="input_field"){t.oActive=r;n=document.getElementById(r);if(typeof n=="object"){n.className="search-popup-row-active"}}t.oPointer.unshift(r);break;case 40:r=t.oPointer.shift();if(t.oPointer_this==r){t.oPointer.push(r);r=t.oPointer.shift()}if(r!="input_field"){t.oActive=r;n=document.getElementById(r);if(typeof n=="object"){n.className="search-popup-row-active"}}t.oPointer.push(r);break;case 39:case 13:t.Replace();t.Destroy();break;default:break}t.oPointer_this=r}else{t.Destroy()}}}
1var TCJsUtils={arEvents:[],addEvent:function(t,e,o){if(t.attachEvent){t.attachEvent("on"+e,o)}else if(t.addEventListener){t.addEventListener(e,o,false)}else{t["on"+e]=o}this.arEvents[this.arEvents.length]={element:t,event:e,fn:o}},removeEvent:function(t,e,o){if(t.detachEvent){t.detachEvent("on"+e,o)}else if(t.removeEventListener){t.removeEventListener(e,o,false)}else{t["on"+e]=null}},getCursorPosition:function(t){var e={start:0,end:0};if(!t||typeof t!="object"){return e}try{if(document.selection!=null&&t.selectionStart==null){t.focus();var o=document.selection.createRange();var r=o.parentElement();var n=o.getBookmark();var i=t.value;var s=t.value;var a="__"+Math.random()+"__";while(i.indexOf(a)!=-1){a="__"+Math.random()+"__"}if(!r||r==null||r.type!="textarea"&&r.type!="text"){return e}o.text=a+o.text+a;i=t.value;e["start"]=i.indexOf(a);i=i.replace(a,"");e["end"]=i.indexOf(a);t.value=s;o.moveToBookmark(n);o.select();return e}return{start:t.selectionStart,end:t.selectionEnd}}catch{return e}},setCursorPosition:function(t,e){if(typeof t!="object"){return false}t.focus();try{if(document.selection!=null&&t.selectionStart==null){var o=document.selection.createRange();o.select()}else{t.selectionStart=e;t.selectionEnd=e}return true}catch{return false}},empty:function(t){var e=true;if(t){for(var o in t){if(t.hasOwnProperty(o)){e=false;break}}}return e},show:function(t,e,o){if(typeof t!="object"){return}var r=parseInt(t.style.zIndex,10);if(r<=0||isNaN(r)){r=100}t.style.zIndex=r;t.style.left=e+"px";t.style.top=o+"px"},hide:function(t){if(t){t.style.display="none"}},GetRealPos:function(t){if(!t||!t.offsetParent){return false}var e={};var o=t.offsetParent;e["left"]=t.offsetLeft;e["top"]=t.offsetTop;while(o&&o.tagName!="BODY"){e["left"]+=o.offsetLeft;e["top"]+=o.offsetTop;o=o.offsetParent}e["right"]=e["left"]+t.offsetWidth;e["bottom"]=e["top"]+t.offsetHeight;e["width"]=t.offsetWidth;e["height"]=t.offsetHeight;return e},htmlspecialcharsEx:function(t){return t.replaceAll("&amp;","&amp;amp;").replaceAll("&lt;","&amp;lt;").replaceAll("&gt;","&amp;gt;").replaceAll("&quot;","&amp;quot;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")},htmlspecialcharsback:function(t){return t.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&quot;",'"').replaceAll("&amp;","&")}};
2//# sourceMappingURL=script.map.js

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.