File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/templates/aspro_next/components/bitrix/search.title/fixed/script.min.js
Back
function JCTitleSearch2(t){var e=this;this.arParams={AJAX_PAGE:t.AJAX_PAGE,CONTAINER_ID:t.CONTAINER_ID,INPUT_ID:t.INPUT_ID,INPUT_ID_TMP:t.INPUT_ID_TMP,MIN_QUERY_LEN:parseInt(t.MIN_QUERY_LEN)},t.WAIT_IMAGE&&(this.arParams.WAIT_IMAGE=t.WAIT_IMAGE),t.MIN_QUERY_LEN<=0&&(t.MIN_QUERY_LEN=1),this.cache=[],this.cache_key=null,this.startText="",this.running=!1,this.needRunAgain=!1,this.currentRow=-1,this.RESULT=null,this.CONTAINER=null,this.INPUT=null,this.WAIT=null,this.ShowResult=function(t){BX.type.isString(t)&&(e.RESULT.innerHTML=t),e.RESULT.style.display=""!==e.RESULT.innerHTML?"block":"none";var s,n,i,a=e.adjustResultNode(),l=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},!0);if(l&&(n=BX.findChild(l,{tag:"th"},!0)),n){var r=BX.pos(l);r.width=r.right-r.left;var o=BX.pos(n);o.width=o.right-o.left,n.style.width=o.width+"px",e.RESULT.style.width=a.width+o.width+"px",e.RESULT.style.left=a.left-o.width-1+"px",r.width-o.width>a.width&&(e.RESULT.style.width=a.width+o.width-1+"px"),r=BX.pos(l),(s=BX.pos(e.RESULT)).right>r.right&&(e.RESULT.style.width=r.right-r.left+"px")}l&&(i=BX.findChild(e.RESULT,{class:"title-search-fader"},!0)),i&&n&&(s=BX.pos(e.RESULT),i.style.left=s.right-s.left-18+"px",i.style.width="18px",i.style.top="0px",i.style.height=s.bottom-s.top+"px",i.style.display="block")},this.onKeyPress=function(t){var s,n=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},!0);if(!n)return!1;var i=n.rows.length;switch(t){case 27:return e.RESULT.style.display="none",e.currentRow=-1,e.UnSelectAll(),!0;case 40:"none"==e.RESULT.style.display&&(e.RESULT.style.display="block");var a=-1;for(s=0;s<i;s++)if(!BX.findChild(n.rows[s],{class:"title-search-separator"},!0)){if(-1==a&&(a=s),e.currentRow<s){e.currentRow=s;break}"title-search-selected"==n.rows[s].className&&(n.rows[s].className="")}return s==i&&e.currentRow!=s&&(e.currentRow=a),n.rows[e.currentRow].className="title-search-selected",!0;case 38:"none"==e.RESULT.style.display&&(e.RESULT.style.display="block");var l=-1;for(s=i-1;s>=0;s--)if(!BX.findChild(n.rows[s],{class:"title-search-separator"},!0)){if(-1==l&&(l=s),e.currentRow>s){e.currentRow=s;break}"title-search-selected"==n.rows[s].className&&(n.rows[s].className="")}return s<0&&e.currentRow!=s&&(e.currentRow=l),n.rows[e.currentRow].className="title-search-selected",!0;case 13:if("block"==e.RESULT.style.display)for(s=0;s<i;s++)if(e.currentRow==s&&!BX.findChild(n.rows[s],{class:"title-search-separator"},!0)){var r=BX.findChild(n.rows[s],{tag:"a"},!0);if(r)return window.location=r.href,!0}return!1}return!1},this.onTimeout=function(){e.onChange(function(){setTimeout(e.onTimeout,500)})},this.onChange=function(t){if(e.running)e.needRunAgain=!0;else{if(e.running=!0,e.INPUT.value!=e.oldValue&&e.INPUT.value!=e.startText)if(e.oldValue=e.INPUT.value,e.INPUT.value.length>=e.arParams.MIN_QUERY_LEN){if(e.cache_key=e.arParams.INPUT_ID+"|"+e.INPUT.value,null==e.cache[e.cache_key]){if(e.WAIT){var s=BX.pos(e.INPUT),n=s.bottom-s.top-2;e.WAIT.style.top=s.top+1+"px",e.WAIT.style.height=n+"px",e.WAIT.style.width=n+"px",e.WAIT.style.left=s.right-n+2+"px",e.WAIT.style.display="block"}return void BX.ajax.post(e.arParams.AJAX_PAGE,{ajax_call:"y",INPUT_ID:e.arParams.INPUT_ID_TMP,q:e.INPUT.value,l:e.arParams.MIN_QUERY_LEN},function(s){e.cache[e.cache_key]=s,e.ShowResult(s),e.currentRow=-1,e.EnableMouseEvents(),e.WAIT&&(e.WAIT.style.display="none"),t&&t(),e.running=!1,e.needRunAgain&&(e.needRunAgain=!1,e.onChange(t))})}e.ShowResult(e.cache[e.cache_key]),e.currentRow=-1,e.EnableMouseEvents()}else e.RESULT.style.display="none",e.currentRow=-1,e.UnSelectAll();t&&t(),e.running=!1}},this.UnSelectAll=function(){var t=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},!0);if(t)for(var s=t.rows.length,n=0;n<s;n++)t.rows[n].className=""},this.EnableMouseEvents=function(){var t=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},!0);if(t)for(var s=t.rows.length,n=0;n<s;n++)BX.findChild(t.rows[n],{class:"title-search-separator"},!0)||(t.rows[n].id="row_"+n,t.rows[n].onmouseover=function(t){e.currentRow!=this.id.substr(4)&&(e.UnSelectAll(),this.className="title-search-selected",e.currentRow=this.id.substr(4))},t.rows[n].onmouseout=function(t){this.className="",e.currentRow=-1})},this.onFocusLost=function(t){setTimeout(function(){e.RESULT.style.display="none"},300)},this.onFocusGain=function(){e.RESULT.innerHTML.length&&e.ShowResult()},this.onKeyDown=function(t){if(t||(t=window.event),"block"==e.RESULT.style.display&&e.onKeyPress(t.keyCode))return BX.PreventDefault(t)},this.adjustResultNode=function(){var t,s,n=BX.findParent(e.CONTAINER,BX.is_fixed);return n?(e.RESULT.style.position="fixed",e.RESULT.style.zIndex=BX.style(n,"z-index")+2,t=BX.pos(e.CONTAINER,!0)):(e.RESULT.style.position="absolute",t=BX.pos(e.CONTAINER)),s=BX.pos(e.INPUT),t.width=t.right-t.left,e.RESULT.style.top=t.bottom+2+"px",e.RESULT.style.left=s.left+"px",$(e.INPUT).closest(".inline-search-block.with-close").length?e.RESULT.style.width=s.width+"px":e.RESULT.style.width=t.width+"px",t},this._onContainerLayoutChange=function(){"none"!==e.RESULT.style.display&&""!==e.RESULT.innerHTML&&e.adjustResultNode()},this.Init=function(){this.CONTAINER=document.getElementById(this.arParams.CONTAINER_ID),BX.addCustomEvent(this.CONTAINER,"OnNodeLayoutChange",this._onContainerLayoutChange),this.RESULT=document.body.appendChild(document.createElement("DIV")),this.RESULT.className="title-search-result "+this.arParams.INPUT_ID,"title-search-input_fixed"!=this.arParams.INPUT_ID&&(this.RESULT.className+=" "+arNextOptions.THEME.TYPE_SEARCH+"_type"),this.INPUT=document.getElementById(this.arParams.INPUT_ID),this.startText=this.oldValue=this.INPUT.value,BX.bind(this.INPUT,"focus",function(){e.onFocusGain()}),BX.bind(this.INPUT,"blur",function(){e.onFocusLost()}),BX.browser.IsSafari()||BX.browser.IsIE()?this.INPUT.onkeydown=this.onKeyDown:this.INPUT.onkeypress=this.onKeyDown,this.arParams.WAIT_IMAGE&&(this.WAIT=document.body.appendChild(document.createElement("DIV")),this.WAIT.style.backgroundImage="url('"+this.arParams.WAIT_IMAGE+"')",BX.browser.IsIE()||(this.WAIT.style.backgroundRepeat="none"),this.WAIT.style.display="none",this.WAIT.style.position="absolute",this.WAIT.style.zIndex="1100"),BX.bind(this.INPUT,"bxchange",function(){e.onChange()})},BX.ready(function(){e.Init(t)})}
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.28 |
proxy
|
phpinfo
|
Settings