1 2; /* Start:"a:4:{s:4:"full";s:67:"/bitrix/components/bitrix/search.title/script.min.js?17599131626543";s:6:"source";s:48:"/bitrix/components/bitrix/search.title/script.js";s:3:"min";s:52:"/bitrix/components/bitrix/search.title/script.min.js";s:3:"map";s:52:"/bitrix/components/bitrix/search.title/script.map.js";}"*/ 3function JCTitleSearch(t){var e=this;this.arParams={AJAX_PAGE:t.AJAX_PAGE,CONTAINER_ID:t.CONTAINER_ID,INPUT_ID:t.INPUT_ID,MIN_QUERY_LEN:parseInt(t.MIN_QUERY_LEN,10)};if(t.WAIT_IMAGE){this.arParams.WAIT_IMAGE=t.WAIT_IMAGE}if(this.arParams.MIN_QUERY_LEN<=0){this.arParams.MIN_QUERY_LEN=1}this.cache=[];this.cache_key=null;this.startText="";this.running=false;this.runningCall=false;this.currentRow=-1;this.RESULT=null;this.CONTAINER=null;this.INPUT=null;this.WAIT=null;this.ShowResult=function(t){if(BX.type.isString(t)){e.RESULT.innerHTML=t}e.RESULT.style.display=e.RESULT.innerHTML===""?"none":"block";var s=e.adjustResultNode();var i=null;var n=null;var l=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(l){n=BX.findChild(l,{tag:"th"},true)}if(n){var r=BX.pos(l);r.width=r.right-r.left;var a=BX.pos(n);a.width=a.right-a.left;n.style.width=a.width+"px";e.RESULT.style.width=s.width+a.width+"px";e.RESULT.style.left=s.left-a.width-1+"px";if(r.width-a.width>s.width){e.RESULT.style.width=s.width+a.width-1+"px"}r=BX.pos(l);i=BX.pos(e.RESULT);if(i.right>r.right){e.RESULT.style.width=r.right-r.left+"px"}}var o=false;if(l){o=BX.findChild(e.RESULT,{class:"title-search-fader"},true)}if(o&&n){i=BX.pos(e.RESULT);o.style.left=i.right-i.left-18+"px";o.style.width=18+"px";o.style.top=0+"px";o.style.height=i.bottom-i.top+"px";o.style.display="block"}};this.onKeyPress=function(t){var s=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(!s){return false}var i=0;var n=s.rows.length;switch(t){case 27:e.RESULT.style.display="none";e.currentRow=-1;e.UnSelectAll();return true;case 40:if(e.RESULT.style.display=="none"){e.RESULT.style.display="block"}var l=-1;for(i=0;i<n;i++){if(!BX.findChild(s.rows[i],{class:"title-search-separator"},true)){if(l==-1){l=i}if(e.currentRow<i){e.currentRow=i;break}else if(s.rows[i].className=="title-search-selected"){s.rows[i].className=""}}}if(i==n&&e.currentRow!=i){e.currentRow=l}s.rows[e.currentRow].className="title-search-selected";return true;case 38:if(e.RESULT.style.display=="none"){e.RESULT.style.display="block"}var r=-1;for(i=n-1;i>=0;i--){if(!BX.findChild(s.rows[i],{class:"title-search-separator"},true)){if(r==-1){r=i}if(e.currentRow>i){e.currentRow=i;break}else if(s.rows[i].className=="title-search-selected"){s.rows[i].className=""}}}if(i<0&&e.currentRow!=i){e.currentRow=r}s.rows[e.currentRow].className="title-search-selected";return true;case 13:if(e.RESULT.style.display=="block"){for(i=0;i<n;i++){if(e.currentRow==i&&!BX.findChild(s.rows[i],{class:"title-search-separator"},true)){var a=BX.findChild(s.rows[i],{tag:"a"},true);if(a){window.location=a.href;return true}}}}return false;default:break}return false};this.onTimeout=function(){e.onChange((function(){setTimeout(e.onTimeout,500)}))};this.onChange=function(t){if(e.running){e.runningCall=true;return}e.running=true;if(e.INPUT.value!=e.oldValue&&e.INPUT.value!=e.startText){e.oldValue=e.INPUT.value;if(e.INPUT.value.length>=e.arParams.MIN_QUERY_LEN){e.cache_key=e.arParams.INPUT_ID+"|"+e.INPUT.value;if(e.cache[e.cache_key]==null){if(e.WAIT){var s=BX.pos(e.INPUT);var i=s.bottom-s.top-2;e.WAIT.style.top=s.top+1+"px";e.WAIT.style.height=i+"px";e.WAIT.style.width=i+"px";e.WAIT.style.left=s.right-i+2+"px";e.WAIT.style.display="block"}BX.ajax.post(e.arParams.AJAX_PAGE,{ajax_call:"y",INPUT_ID:e.arParam
3s.INPUT_ID,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();if(e.WAIT){e.WAIT.style.display="none"}if(!!t){t()}e.running=false;if(e.runningCall){e.runningCall=false;e.onChange()}}));return}e.ShowResult(e.cache[e.cache_key]);e.currentRow=-1;e.EnableMouseEvents()}else{e.RESULT.style.display="none";e.currentRow=-1;e.UnSelectAll()}}if(!!t){t()}e.running=false};this.onScroll=function(){if(BX.type.isElementNode(e.RESULT)&&e.RESULT.style.display!=="none"&&e.RESULT.innerHTML!==""){e.adjustResultNode()}};this.UnSelectAll=function(){var t=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(t){var s=t.rows.length;for(var i=0;i<s;i++){t.rows[i].className=""}}};this.EnableMouseEvents=function(){var t=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(t){var s=t.rows.length;for(var i=0;i<s;i++){if(!BX.findChild(t.rows[i],{class:"title-search-separator"},true)){t.rows[i].id="row_"+i;t.rows[i].onmouseover=function(t){if(e.currentRow!=this.id.substr(4)){e.UnSelectAll();this.className="title-search-selected";e.currentRow=this.id.substr(4)}};t.rows[i].onmouseout=function(t){this.className="";e.currentRow=-1}}}}};this.onFocusLost=function(t){setTimeout((function(){e.RESULT.style.display="none"}),250)};this.onFocusGain=function(){if(e.RESULT.innerHTML.length>0){e.ShowResult()}};this.onKeyDown=function(t){if(!t){t=window.event}if(e.RESULT.style.display=="block"&&e.onKeyPress(t.keyCode)){return BX.PreventDefault(t)}};this.adjustResultNode=function(){if(!(BX.type.isElementNode(e.RESULT)&&BX.type.isElementNode(e.CONTAINER))){return{top:0,right:0,bottom:0,left:0,width:0,height:0}}var t=BX.pos(e.CONTAINER);e.RESULT.style.position="absolute";e.RESULT.style.top=t.bottom+2+"px";e.RESULT.style.left=t.left+"px";e.RESULT.style.width=t.width+"px";return t};this.onContainerLayoutChange=function(){if(BX.type.isElementNode(e.RESULT)&&e.RESULT.style.display!=="none"&&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.INPUT=document.getElementById(this.arParams.INPUT_ID);this.startText=this.INPUT.value;this.oldValue=this.INPUT.value;BX.bind(this.INPUT,"focus",(function(){e.onFocusGain()}));BX.bind(this.INPUT,"blur",(function(){e.onFocusLost()}));this.INPUT.onkeydown=this.onKeyDown;if(this.arParams.WAIT_IMAGE){this.WAIT=document.body.appendChild(document.createElement("DIV"));this.WAIT.style.backgroundImage="url('"+this.arParams.WAIT_IMAGE+"')";if(!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()}));var t=BX.findParent(this.CONTAINER,BX.is_fixed);if(BX.type.isElementNode(t)){BX.bind(window,"scroll",BX.throttle(this.onScroll,100,this))}};BX.ready((function(){e.Init(t)}))} 4/* End */ 5; 6; /* Start:"a:4:{s:4:"full";s:87:"/local/templates/.default/components/bitrix/search.title/modal/script.js?16245351089988";s:6:"source";s:72:"/local/templates/.default/components/bitrix/search.title/modal/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 7function JCTitleSearch(arParams) 8{ 9 var _this = this; 10 11 this.arParams = {
12 'AJAX_PAGE': arParams.AJAX_PAGE, 13 'CONTAINER_ID': arParams.CONTAINER_ID, 14 'INPUT_ID': arParams.INPUT_ID, 15 'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN) 16 }; 17 if(arParams.WAIT_IMAGE) 18 this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE; 19 if(arParams.MIN_QUERY_LEN <= 0) 20 arParams.MIN_QUERY_LEN = 1; 21 22 this.cache = []; 23 this.cache_key = null; 24 25 this.startText = ''; 26 this.running = false; 27 this.runningCall = false; 28 this.currentRow = -1; 29 this.RESULT = null; 30 this.CONTAINER = null; 31 this.INPUT = null; 32 this.WAIT = null; 33 34 this.ShowResult = function(result) 35 { 36 if(BX.type.isString(result)) 37 { 38 _this.RESULT.innerHTML = result; 39 } 40 41 _this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none'; 42 var pos = _this.adjustResultNode(); 43 44 //adjust left column to be an outline 45 var res_pos; 46 var th; 47 var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true); 48 if(tbl) 49 { 50 th = BX.findChild(tbl, {'tag':'th'}, true); 51 } 52 53 if(th) 54 { 55 var tbl_pos = BX.pos(tbl); 56 tbl_pos.width = tbl_pos.right - tbl_pos.left; 57 58 var th_pos = BX.pos(th); 59 th_pos.width = th_pos.right - th_pos.left; 60 th.style.width = th_pos.width + 'px'; 61 62 _this.RESULT.style.width = (pos.width + th_pos.width) + 'px'; 63 64 //Move table to left by width of the first column 65 _this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px'; 66 67 //Shrink table when it's too wide 68 if((tbl_pos.width - th_pos.width) > pos.width) 69 _this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px'; 70 71 //Check if table is too wide and shrink result div to it's width 72 tbl_pos = BX.pos(tbl); 73 res_pos = BX.pos(_this.RESULT); 74 if(res_pos.right > tbl_pos.right) 75 { 76 _this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px'; 77 } 78 } 79 80 var fade; 81 if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true); 82 if(fade && th) 83 { 84 res_pos = BX.pos(_this.RESULT); 85 fade.style.left = (res_pos.right - res_pos.left - 18) + 'px'; 86 fade.style.width = 18 + 'px'; 87 fade.style.top = 0 + 'px'; 88 fade.style.height = (res_pos.bottom - res_pos.top) + 'px'; 89 fade.style.display = 'block'; 90 } 91 }; 92 93 this.onKeyPress = function(keyCode) 94 { 95 var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true); 96 if(!tbl) 97 return false; 98 99 var i; 100 var cnt = tbl.rows.length; 101 102 switch (keyCode) 103 { 104 case 27: // escape key - close search div 105 // _this.RESULT.style.display = 'none'; 106 _this.currentRow = -1; 107 _this.UnSelectAll(); 108 return true; 109 110 case 40: // down key - navigate down on search results 111 // if(_this.RESULT.style.display == 'none') 112 // _this.RESULT.style.display = 'block'; 113 114 var first = -1; 115 for(i = 0; i < cnt; i++) 116 { 117 if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true)) 118 { 119 if(first == -1) 120 first = i; 121 122 if(_this.currentRow < i) 123 { 124 _this.currentRow = i; 125 break; 126 } 127 else if(tbl.rows[i].className == 'title-search-selected') 128 { 129 tbl.rows[i].className = ''; 130 } 131 } 132 } 133 134 if(i == cnt && _this.currentRow != i) 135 _this.currentRow = first; 136 137 tbl.rows[_this.currentRow].className = 'title-search-selected'; 138 return true; 139 140 case 38: // up key - navigate up on search results 141 // if(_this.RESULT.style.display == 'none') 142 // _this.RESULT.style.display = 'block'; 143 144 var last = -1; 145 for(i = cnt-1; i >= 0; i--) 146 { 147 if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true)) 148 { 149 if(last == -1) 150 last = i; 151 152 if(_this.currentRow > i) 153 { 154 _this.currentRow = i; 155 break; 156 } 157 else if(tbl.rows[i].className == 'title-search-selected') 158 { 159 tbl.rows[i].className = ''; 160 } 161 } 162 } 163 164 if(i < 0 && _this.currentRow != i) 165 _this.currentRow = last; 166 167 tbl.rows[_this.currentRow].className = 'title-search-selected'; 168 return true; 169 170 case 13: // enter key - choose current search result 171 if(_this.RESULT.style.display == 'block') 172 { 173 for(i = 0; i < cnt; i++) 174 { 175 if(_this.currentRow == i) 176 { 177 if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true)) 178 { 179 var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true); 180 if(a) 181 { 182 window.location = a.href; 183 return true; 184 } 185 } 186 } 187 } 188 } 189 return false;
190 } 191 192 return false; 193 }; 194 195 this.onTimeout = function() 196 { 197 _this.onChange(function(){ 198 setTimeout(_this.onTimeout, 500); 199 }); 200 }; 201 202 this.onChange = function(callback) 203 { 204 if (_this.running) 205 { 206 _this.runningCall = true; 207 return; 208 } 209 _this.running = true; 210 211 if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText) 212 { 213 _this.oldValue = _this.INPUT.value; 214 if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN) 215 { 216 _this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value; 217 if(_this.cache[_this.cache_key] == null) 218 { 219 if(_this.WAIT) 220 { 221 var pos = BX.pos(_this.INPUT); 222 var height = (pos.bottom - pos.top)-2; 223 _this.WAIT.style.top = (pos.top+1) + 'px'; 224 _this.WAIT.style.height = height + 'px'; 225 _this.WAIT.style.width = height + 'px'; 226 _this.WAIT.style.left = (pos.right - height + 2) + 'px'; 227 _this.WAIT.style.display = 'block'; 228 } 229 230 BX.ajax.post( 231 _this.arParams.AJAX_PAGE, 232 { 233 'ajax_call':'y', 234 'INPUT_ID':_this.arParams.INPUT_ID, 235 'q':_this.INPUT.value, 236 'l':_this.arParams.MIN_QUERY_LEN 237 }, 238 function(result) 239 { 240 _this.cache[_this.cache_key] = result; 241 _this.ShowResult(result); 242 _this.currentRow = -1; 243 _this.EnableMouseEvents(); 244 if(_this.WAIT) 245 _this.WAIT.style.display = 'none'; 246 if (!!callback) 247 callback(); 248 _this.running = false; 249 if (_this.runningCall) 250 { 251 _this.runningCall = false; 252 _this.onChange(); 253 } 254 } 255 ); 256 return; 257 } 258 else 259 { 260 _this.ShowResult(_this.cache[_this.cache_key]); 261 _this.currentRow = -1; 262 _this.EnableMouseEvents(); 263 } 264 } 265 else 266 { 267 // _this.RESULT.style.display = 'none'; 268 _this.currentRow = -1; 269 _this.UnSelectAll(); 270 } 271 } 272 if (!!callback) 273 callback(); 274 _this.running = false; 275 }; 276 277 this.onScroll = function () 278 { 279 // if(BX.type.isElementNode(_this.RESULT) 280 // && _this.RESULT.style.display !== "none" 281 // && _this.RESULT.innerHTML !== '' 282 // ) 283 // { 284 // _this.adjustResultNode(); 285 // } 286 }; 287 288 this.UnSelectAll = function() 289 { 290 var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true); 291 if(tbl) 292 { 293 var cnt = tbl.rows.length; 294 for(var i = 0; i < cnt; i++) 295 tbl.rows[i].className = ''; 296 } 297 }; 298 299 this.EnableMouseEvents = function() 300 { 301 var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true); 302 if(tbl) 303 { 304 var cnt = tbl.rows.length; 305 for(var i = 0; i < cnt; i++) 306 if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true)) 307 { 308 tbl.rows[i].id = 'row_' + i; 309 tbl.rows[i].onmouseover = function (e) { 310 if(_this.currentRow != this.id.substr(4)) 311 { 312 _this.UnSelectAll(); 313 this.className = 'title-search-selected'; 314 _this.currentRow = this.id.substr(4); 315 } 316 }; 317 tbl.rows[i].onmouseout = function (e) { 318 this.className = ''; 319 _this.currentRow = -1; 320 }; 321 } 322 } 323 }; 324 325 this.onFocusLost = function(hide) 326 { 327 // setTimeout(function(){_this.RESULT.style.display = 'none';}, 250); 328 }; 329 330 this.onFocusGain = function() 331 { 332 // if(_this.RESULT.innerHTML.length) 333 // _this.ShowResult(); 334 }; 335 336 this.onKeyDown = function(e) 337 { 338 if(!e) 339 e = window.event; 340 341 if (_this.RESULT.style.display == 'block') 342 { 343 if(_this.onKeyPress(e.keyCode)) 344 return BX.PreventDefault(e); 345 } 346 }; 347 348 this.adjustResultNode = function() 349 { 350 if(!(BX.type.isElementNode(_this.RESULT) 351 && BX.type.isElementNode(_this.CONTAINER)) 352 ) 353 { 354 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; 355 } 356 357 var pos = BX.pos(_this.CONTAINER); 358 359 // _this.RESULT.style.position = 'absolute'; 360 // _this.RESULT.style.top = (pos.bottom + 2) + 'px'; 361 // _this.RESULT.style.left = pos.left + 'px'; 362 // _this.RESULT.style.width = pos.width + 'px'; 363 364 return pos; 365 }; 366 367 this._onContainerLayoutChange = function() 368 { 369 if(BX.type.isElementNode(_this.RESULT) 370 && _this.RESULT.style.display !== "none" 371 && _this.RESULT.innerHTML !== '' 372 ) 373 { 374 _this.adjustResultNode(); 375 } 376 }; 377 this.Init = function() 378 { 379 this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID); 380 BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange); 381 382 // this.RESULT = document.body.appendChild(document.createElement("DIV")); 383 // this.RESULT.className = 'title-search-result'; 384 385 this.RESULT = this.CONTAINER.querySelector(".hb-search-modal__items"); 386 387 this.INPUT = document.getElementById(this.arParams.INPUT_ID); 388 this.startText = this.oldValue = this.INPUT.value; 389 BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()}); 390 BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()}); 391 this.INPUT.onkeydown = this.onKeyDown; 392 393 if(this.arParams.WAIT_IMAGE) 394 { 395 this.WAIT = document.body.appendChild(document.createElement("DIV")); 396 this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')"; 397 if(!BX.browser.IsIE()) 398 this.WAIT.style.backgroundRepeat = 'none'; 399 this.WAIT.style.display = 'none'; 400 this.WAIT.style.position = 'absolute'; 401 this.WAIT.style.zIndex = '1100'; 402 } 403 404 BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()}); 405 406 var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed); 407 if(BX.type.isElementNode(fixedParent)) 408 { 409 BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this)); 410 } 411 }; 412 BX.ready(function (){_this.Init(arParams)}); 413} 414 415/* End */ 416;; /* /bitrix/components/bitrix/search.title/script.min.js?17599131626543*/ 417; /* /local/templates/.default/components/bitrix/search.title/modal/script.js?16245351089988*/ 418 419//# sourceMappingURL=template_b0c659777880192b5c6c28122f92dd3e.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.