PageSourceSearch

https://www.duim24.ru/bitrix/cache/js/s1/duim/template_832a08241ef…76214e0f5269f1c4557b0_v1.js?179085540325566

js duim24.ru collected 2026-10-01 12:01:06 UTC 25,566 bytes, 580 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:97:"/local/templates/duim/components/bitrix/sale.basket.basket.line/duim/script.min.js?15882298093876";s:6:"source";s:78:"/local/templates/duim/components/bitrix/sale.basket.basket.line/duim/script.js";s:3:"min";s:82:"/local/templates/duim/components/bitrix/sale.basket.basket.line/duim/script.min.js";s:3:"map";s:82:"/local/templates/duim/components/bitrix/sale.basket.basket.line/duim/script.map.js";}"*/
3"use strict";function BitrixSmallCart(){}BitrixSmallCart.prototype={activate:function(){this.cartElement=BX(this.cartId);this.fixedPosition=this.arParams.POSITION_FIXED=="Y";if(this.fixedPosition){this.cartClosed=true;this.maxHeight=false;this.itemRemoved=false;this.verticalPosition=this.arParams.POSITION_VERTICAL;this.horizontalPosition=this.arParams.POSITION_HORIZONTAL;this.topPanelElement=BX("bx-panel");this.fixAfterRender();this.fixAfterRenderClosure=this.closure("fixAfterRender");var t=this.closure("fixCart");this.fixCartClosure=t;if(this.topPanelElement&&this.verticalPosition=="top")BX.addCustomEvent(window,"onTopPanelCollapse",t);var e=null;BX.bind(window,"resize",function(){clearTimeout(e);e=setTimeout(t,200)})}this.setCartBodyClosure=this.closure("setCartBody");BX.addCustomEvent(window,"OnBasketChange",this.closure("refreshCart",{}))},fixAfterRender:function(){this.statusElement=BX(this.cartId+"status");if(this.statusElement){if(this.cartClosed)this.statusElement.innerHTML=this.openMessage;else this.statusElement.innerHTML=this.closeMessage}this.productsElement=BX(this.cartId+"products");this.fixCart()},closure:function(t,e){var i=this;return e?function(){i[t](e)}:function(e){i[t](e)}},toggleOpenCloseCart:function(){if(this.cartClosed){BX.removeClass(this.cartElement,"bx-closed");BX.addClass(this.cartElement,"bx-opener");this.statusElement.innerHTML=this.closeMessage;this.cartClosed=false;this.fixCart()}else{BX.addClass(this.cartElement,"bx-closed");BX.removeClass(this.cartElement,"bx-opener");BX.removeClass(this.cartElement,"bx-max-height");this.statusElement.innerHTML=this.openMessage;this.cartClosed=true;var t=this.cartElement.querySelector("[data-role='basket-item-list']");if(t)t.style.top="auto"}setTimeout(this.fixCartClosure,100)},setVerticalCenter:function(t){var e=t/2-this.cartElement.offsetHeight/2;if(e<5)e=5;this.cartElement.style.top=e+"px"},fixCart:function(){if(this.horizontalPosition=="hcenter"){var t="innerWidth"in window?window.innerWidth:document.documentElement.offsetWidth;var e=t/2-this.cartElement.offsetWidth/2;if(e<5)e=5;this.cartElement.style.left=e+"px"}var i="innerHeight"in window?window.innerHeight:document.documentElement.offsetHeight;switch(this.verticalPosition){case"top":if(this.topPanelElement)this.cartElement.style.top=this.topPanelElement.offsetHeight+5+"px";break;case"vcenter":this.setVerticalCenter(i);break}if(this.productsElement){var s=this.cartElement.querySelector("[data-role='basket-item-list']");if(this.cartClosed){if(this.maxHeight){BX.removeClass(this.cartElement,"bx-max-height");if(s)s.style.top="auto";this.maxHeight=false}}else{if(this.maxHeight){if(this.productsElement.scrollHeight==this.productsElement.clientHeight){BX.removeClass(this.cartElement,"bx-max-height");if(s)s.style.top="auto";this.maxHeight=false}}else{if(this.verticalPosition=="top"||this.verticalPosition=="vcenter"){if(this.cartElement.offsetTop+this.cartElement.offsetHeight>=i){BX.addClass(this.cartElement,"bx-max-height");if(s)s.style.top=82+"px";this.maxHeight=true}}else{if(this.cartElement.offsetHeight>=i){BX.addClass(this.cartElement,"bx-max-height");if(s)s.style.top=82+"px";this.maxHeight=true}}}}if(this.verticalPosition=="vcenter")this.setVerticalCenter(i)}},refreshCart:function(t){if(this.itemRemoved){this.itemRemoved=false;return}t.sessid=BX.bitrix_sessid();t.siteId=this.siteId;t.templateName=this.templateName;t.arParams=this.arParams;BX.ajax({url:this.ajaxPath,method:"POST",dataType:"html",data:t,onsuccess:this.setCartBodyClosure})},setCartBody:function(t){if(this.cartElement)this.cartElement.innerHTML=t.replace(/#CURRENT_URL#/g,this.currentUrl);if(this.fixedPosition)setTimeout(this.fixAfterRenderClosure,100)},removeItemFromCart:function(t){this.refreshCart({sbblRemoveItemFromCart:t});this.itemRemoved=true;BX.onCustomEvent("OnBasketChange")}};
4/* End */
5;
6; /* Start:"a:4:{s:4:"full";
6s:73:"/bitrix/components/arturgolubev/search.title/script.min.js?17479879056313";s:6:"source";s:54:"/bitrix/components/arturgolubev/search.title/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
7function 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)};if(t.WAIT_IMAGE)this.arParams.WAIT_IMAGE=t.WAIT_IMAGE;if(t.MIN_QUERY_LEN<=0)t.MIN_QUERY_LEN=1;this.cache=[];this.cache_key=null;this.startText="";this.running=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!==""?"block":"none";var s=e.adjustResultNode();var i;var n;var r=BX.findChild(e.RESULT,{tag:"table",class:"title-search-result"},true);if(r){n=BX.findChild(r,{tag:"th"},true)}if(n){var l=BX.pos(r);l.width=l.right-l.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(l.width-a.width>s.width)e.RESULT.style.width=s.width+a.width-1+"px";l=BX.pos(r);i=BX.pos(e.RESULT);if(i.right>l.right){e.RESULT.style.width=l.right-l.left+"px"}}var o;if(r)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;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 r=-1;for(i=0;i<n;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==n&&e.currentRow!=i)e.currentRow=r;s.rows[e.currentRow].className="title-search-selected";return true;case 38:if(e.RESULT.style.display=="none")e.RESULT.style.display="block";var l=-1;for(i=n-1;i>=0;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<0&&e.currentRow!=i)e.currentRow=l;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){if(!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}return false};this.onTimeout=function(){e.onChange(function(){setTimeout(e.onTimeout,500)})};this.onChange=function(t){if(e.running)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
7s.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});return}else{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)e.ShowResult()};this.onKeyDown=function(t){if(!t)t=window.event;if(e.RESULT.style.display=="block"){if(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.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)})}
8/* End */
9;
10; /* Start:"a:4:{s:4:"full";s:93:"/local/templates/duim/components/arturgolubev/search.title/.default/script.js?175619963614090";s:6:"source";s:77:"/local/templates/duim/components/arturgolubev/search.title/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
11function JCTitleSearchAG(arParams)
12{
13	var _this = this;
14
15	if(!arParams.POPUP_HISTORY){
16		arParams.POPUP_HISTORY = 'N';
17	}
18
19	this.arParams = {
20		'AJAX_PAGE': arParams.AJAX_PAGE,
21		'CONTAINER_ID': arParams.CONTAINER_ID,
22		'INPUT_ID': arParams.INPUT_ID,
23		'POPUP_HISTORY': arParams.POPUP_HISTORY,
24		'POPUP_HISTORY_TITLE': arParams.POPUP_HISTORY_TITLE,
25		'PAGE': arParams.PAGE,
26		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
27	};
28	if(arParams.WAIT_IMAGE)
29		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
30	
31	this.elements = {
32		'clear': null,
33		'preloader': null,
34	};
35
36	if(arParams.PRELODER_ID){
37		this.elements.preloader = BX(arParams.PRELODER_ID);
38	}
39	if(arParams.CLEAR_ID){
40		this.elements.clear = BX(arParams.CLEAR_ID);
41	}
42	if(arParams.VOICE_ID){
43		this.elements.voice = BX(arParams.VOICE_ID);
44	}
45	
46	if(arParams.MIN_QUERY_LEN <= 0)
47		arParams.MIN_QUERY_LEN = 1;
48
49	this.cache = [];
50	this.cache_key = null;
51
52	this.startText = '';
53	this.running = false;
54	
55	this.currentRow = -1;
56	this.RESULT = null;
57	this.CONTAINER = null;
58	this.INPUT = null;
59	this.WAIT = null;
60
61	this.ShowResult = function(result)
62	{
63		if(BX.type.isString(result))
64		{
65			_this.RESULT.innerHTML = result;
66		}
67
68		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
69		var pos = _this.adjustResultNode();
70
71		//adjust left column to be an outline
72		var res_pos;
73		var th;
74		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
75		if(tbl)
76		{
77			th = BX.findChild(tbl, {'tag':'th'}, true);
78		}
79
80		if(th)
81		{
82			var tbl_pos = BX.pos(tbl);
83			tbl_pos.width = tbl_pos.right - tbl_pos.left;
84
85			var th_pos = BX.pos(th);
86			th_pos.width = th_pos.right - th_pos.left;
87			th.style.width = th_pos.width + 'px';
88
89			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
90
91			//Move table to left by width of the first column
92			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
93
94			//Shrink table when it's too wide
95			if((tbl_pos.width - th_pos.width) > pos.width)
96				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
97
98			//Check if table is too wide and shrink result div to it's width
99			tbl_pos = BX.pos(tbl);
100			res_pos = BX.pos(_this.RESULT);
101			if(res_pos.right > tbl_pos.right)
102			{
103				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
104			}
105		}
106
107		var fade;
108		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
109		if(fade && th)
110		{
111			res_pos = BX.pos(_this.RESULT);
112			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
113			fade.style.width = 18 + 'px';
114			fade.style.top = 0 + 'px';
115			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
116			fade.style.display = 'block';
117		}
118	};
119
120	this.onKeyPress = function(keyCode)
121	{
122		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
123		if(!tbl)
124			return false;
125
126		var i;
127		var cnt = tbl.rows.length;
128
129		switch (keyCode)
130		{
131		case 27: // escape key - close search div
132			_this.RESULT.style.display = 'none';
133			_this.currentRow = -1;
134			_this.UnSelectAll();
135		return true;
136
137		case 40: // down key - navigate down on search results
138			if(_this.RESULT.style.display == 'none')
139				_this.RESULT.style.display = 'block';
140
141			var first = -1;
142			for(i = 0; i < cnt; i++)
143			{
144				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
145				{
146					if(first == -1)
147						first = i;
148
149					if(_this.currentRow < i)
150					{
151						_this.currentRow = i;
152						break;
153					}
154					else if(tbl.rows[i].className == 'title-search-selected')
155					{
156						tbl.rows[i].className = '';
157					}
158				}
159			}
160
161			if(i == cnt && _this.currentRow != i)
162				_this.currentRow = first;
163
164			tbl.rows[_this.currentRow].className = 'title-search-selected';
165		return true;
166
167		case 38: // up key - navigate up on search results
168			if(_this.RESULT.style.display == 'none')
169				_this.RESULT.style.display = 'block';
170
171			var last = -1;
172			for(i = cnt-1; i >= 0; i--)
173			{
174				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
175				{
176					if(last == -1)
177						last = i;
178
179					if(_this.currentRow > i)
180					{
181						_this.currentRow = i;
182						break;
183					}
184					else if(tbl.rows[i].className == 'title-search-selected')
185					{
186						tbl.rows[i].className = '';
187					}
188				}
189			}
190
191			if(i < 0 && _this.currentRow != i)
192				_this.currentRow = last;
193
194			tbl.rows[_this.currentRow].className = 'title-search-selected';
195		return true;
196
197		case 13: // enter key - choose current search result
198			if(_this.RESULT.style.display == 'block')
199			{
200				for(i = 0; i < cnt; i++)
201				{
202					if(_this.currentRow == i)
203					{
204						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
205						{
206							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
207							if(a)
208							{
209								window.location = a.href;
210								return true;
211							}
212						}
213					}
214				}
215			}
216		return false;
217		}
218
219		return false;
220	};
221
222	this.onTimeout = function()
223	{
224		_this.onChange(function(){
225			setTimeout(_this.onTimeout, 500);
226		});
227	};
228	
229	this.onChange = function(callback)
230	{
231		if (_this.running)
232			return;
233
234		_this.checkButtonsVisible();
235
236		_this.running = true;
237
238		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
239		{
240			_this.oldValue = _this.INPUT.value;
241			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
242			{
243				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
244				if(_this.cache[_this.cache_key] == null)
245				{
246					if(_this.WAIT)
247					{
248						var pos = BX.pos(_this.INPUT);
249						var height = (pos.bottom - pos.top)-2;
250						_this.WAIT.style.top = (pos.top+1) + 'px';
251						_this.WAIT.style.height = height + 'px';
252						_this.WAIT.style.width = height + 'px';
253						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
254						_this.WAIT.style.display = 'block';
255					}
256					
257					if(_this.elements.preloader){
258						BX.show(_this.elements.preloader);
259					}
260					
261					// console.log('ajax call ' + _this.INPUT.value);
262					
263					BX.ajax.post(
264						_this.arParams.AJAX_PAGE,
265						{
266							'ajax_call':'y',
267							'INPUT_ID':_this.arParams.INPUT_ID,
268							'q':_this.INPUT.value,
269							'l':_this.arParams.MIN_QUERY_LEN
270						},
271						function(result)
272						{
273							_this.cache[_this.cache_key] = result;
274							_this.ShowResult(result);
275							_this.currentRow = -1;
276							_this.EnableMouseEvents();
277							if(_this.WAIT)
278								_this.WAIT.style.display = 'none';
279							
280							if(_this.elements.preloader){
281								BX.hide(_this.elements.preloader);
282							}
283							
284							if (!!callback)
285								callback();
286							_this.running = false;
287							
288							if(_this.INPUT.value != _this.oldValue)
289							{
290								_this.onChange();
291							}
292						}
293					);
294					return;
295				}
296				else
297				{
298					_this.ShowResult(_this.cache[_this.cache_key]);
299					_this.currentRow = -1;
300					_this.EnableMouseEvents();
301				}
302			}
303			else
304			{
305				_this.RESULT.style.display = 'none';
306				_this.currentRow = -1;
307				_this.UnSelectAll();
308			}
309		}
310		if (!!callback)
311			callback();
312		_this.running = false;
313	};
314
315	this.onScroll = function ()
316	{
317		if(BX.type.isElementNode(_this.RESULT)
318			&& _this.RESULT.style.display !== "none"
319			&& _this.RESULT.innerHTML !== ''
320		)
321		{
322			_this.adjustResultNode();
323		}
324	};
325
326	this.UnSelectAll = function()
327	{
328		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
329		if(tbl)
330		{
331			var cnt = tbl.rows.length;
332			for(var i = 0; i < cnt; i++)
333				tbl.rows[i].className = '';
334		}
335	};
336
337	this.EnableMouseEvents = function()
338	{
339		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
340		if(tbl)
341		{
342			var cnt = tbl.rows.length;
343			for(var i = 0; i < cnt; i++)
344				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
345				{
346					tbl.rows[i].id = 'row_' + i;
347					tbl.rows[i].onmouseover = function (e) {
348						if(_this.currentRow != this.id.substr(4))
349						{
350							_this.UnSelectAll();
351							this.className = 'title-search-selected';
352							_this.currentRow = this.id.substr(4);
353						}
354					};
355					tbl.rows[i].onmouseout = function (e) {
356						this.className = '';
357						_this.currentRow = -1;
358					};
359				}
360		}
361	};
362
363	this.onFocusLost = function(hide)
364	{
365		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
366	};
367
368	this.onFocusGain = function()
369	{
370		if(_this.RESULT.innerHTML.length && _this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
371			_this.ShowResult();
372		else if(_this.arParams.POPUP_HISTORY == 'Y'){
373			_this.ShowResult(_this.getHistoryHtml());
374		}
375	};
376
377	this.onKeyDown = function(e)
378	{
379		if(!e)
380			e = window.event;
381
382		if (_this.RESULT.style.display == 'block')
383		{
384			if(_this.onKeyPress(e.keyCode))
385				return BX.PreventDefault(e);
386		}
387	};
388
389	this.adjustResultNode = function()
390	{
391		if(!(BX.type.isElementNode(_this.RESULT)
392			&& BX.type.isElementNode(_this.CONTAINER))
393		)
394		{
395			return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
396		}
397
398		var pos = BX.pos(_this.CONTAINER);
399
400		_this.RESULT.style.position = 'absolute';
401		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
402		_this.RESULT.style.left = pos.left + 'px';
403		_this.RESULT.style.width = pos.width + 'px';
404
405		return pos;
406	};
407
408	this._onContainerLayoutChange = function()
409	{
410		if(BX.type.isElementNode(_this.RESULT)
411			&& _this.RESULT.style.display !== "none"
412			&& _this.RESULT.innerHTML !== ''
413		)
414		{
415			_this.adjustResultNode();
416		}
417	};
418
419	// voice input
420	this.initVoiceInput = function(){
421		if(_this.elements.voice){
422			window.SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
423			if (window.SpeechRecognition) {
424				_this.elements.voice.classList.add('voice-show');
425
426				_this.voiceRecorderActive = 0;
427
428				_this.voiceRecorder = new SpeechRecognition();
429				_this.voiceRecorder.interimResults = true;
430				_this.voiceRecorder.lang = 'ru-RU';
431
432				_this.voiceRecorder.addEventListener("start", function(){
433					_this.voiceRecorderActive = 1;
434					_this.elements.voice.classList.add('active');
435				});
436
437				_this.voiceRecorder.addEventListener("end", function(){
438					_this.voiceRecorderActive = 0;
439					_this.elements.voice.classList.remove('active');
440				});
441
442				_this.voiceRecorder.addEventListener("result", function(e){
443					_this.INPUT.value = e.results[0][0].transcript;
444					if(e.results[0].isFinal){
445						_this.onChange();
446					}
447				});
448
449				_this.voiceRecorder.addEventListener("error", function(e){
450					_this.voiceRecorderActive = 0;
451					_this.elements.voice.classList.remove('active');
452
453					// e.error == 'no-speech'
454				});
455				
456				_this.elements.voice.addEventListener('click', function(){
457					if(!_this.voiceRecorderActive){
458						_this.voiceRecorder.start();
459					}else{
460						_this.voiceRecorder.stop();
461					}
462				});
463			}
464		}
465	};
466
467	// clear
468	this.initClear = function(){
469		if(this.elements.clear){
470			this.elements.clear.addEventListener('click', function(){
471				_this.INPUT.value = '';
472				_this.onChange();
473			});
474		}
475	};
476	this.checkButtonsVisible = function(){
477		if(_this.elements.clear){
478			if(_this.INPUT.value){
479				_this.elements.clear.style.display = 'block';
480			}else{
481				_this.elements.clear.style.display = 'none';
482			}
483		}
484
485		if(_this.elements.voice && window.SpeechRecognition){
486			if(_this.INPUT.value){
487				_this.elements.voice.style.display = 'none';
488			}else{
489				_this.elements.voice.style.display = 'block';
490			}
491		}
492	};
493
494	// history 
495	this.getCookie = function(name) {
496		const value = `; ${document.cookie}`;
497		const parts = value.split(`; ${name}=`);
498		if (parts.length === 2) return parts.pop().split(';').shift();
499	};
500
501	this.getHistoryHtml = function(){
502		var html = '', history = _this.getCookie('BITRIX_SM_AG_SMSE_H');
503
504		if(history){
505			history = decodeURI(history).replace('+', ' ');
506
507			var arHistory = history.split('|');
508			if(arHistory.length){
509				html = html + '<div class="bx_smart_searche bx_searche"><div class="bx-searchtitle-popup-history">';
510					html = html + '<div class="bx-searchtitle-popup-history-title">'+_this.arParams.POPUP_HISTORY_TITLE+'</div>';
511					arHistory.reverse().forEach(function(item){
512						item = decodeURIComponent(item);
513
514						html = html + '<div class="bx-searchtitle-popup-history-item"><a class="js_search_href" href="'+_this.arParams.PAGE+'?q='+item+'">'+item+'</a></div>';
515					});
516				html = html + '</div></div>';
517			}
518		}
519
520		return html;
521	};
522
523	// init
524	this.Init = function()
525	{
526		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
527		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
528
529		this.RESULT = document.body.appendChild(document.createElement("DIV"));
530		this.RESULT.className = 'title-search-result';
531		
532		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
533		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
534		BX.bind(this.INPUT, 'blur', function(e) {
535			if(!!e.relatedTarget){
536				if(!BX.hasClass(BX(e.relatedTarget), 'js_search_href')){
537					_this.onFocusLost();
538				}
539			}else{
540				_this.onFocusLost();
541			}
542		});
543		this.INPUT.onkeydown = this.onKeyDown;
544		
545		this.startText = this.oldValue = this.INPUT.value;
546
547		if(this.arParams.WAIT_IMAGE)
548		{
549			this.WAIT = document.body.appendChild(document.createElement("DIV"));
550			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
551			if(!BX.browser.IsIE())
552				this.WAIT.style.backgroundRepeat = 'none';
553			this.WAIT.style.display = 'none';
554			this.WAIT.style.position = 'absolute';
555			this.WAIT.style.zIndex = '1100';
556		}
557
558		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
559		BX.bind(this.INPUT, 'paste', function(e) {setTimeout(function(){_this.onChange();}, 200);});
560
561		this.initClear();
562		this.initVoiceInput();
563
564		/* var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed);
565		if(BX.type.isElementNode(fixedParent)){
566			BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this));
567		} */
568		
569		BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this));
570		BX.bind(window, 'resize', BX.throttle(this.onScroll, 100, this));
571	};
572	BX.ready(function (){_this.Init(arParams)});
573}
574
575/* End */
576;; /* /local/templates/duim/components/bitrix/sale.basket.basket.line/duim/script.min.js?15882298093876*/
577; /* /bitrix/components/arturgolubev/search.title/script.min.js?17479879056313*/
578; /* /local/templates/duim/components/arturgolubev/search.title/.default/script.js?175619963614090*/
579
580//# sourceMappingURL=template_832a08241ef76214e0f5269f1c4557b0.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.