PageSourceSearch

https://nightwolves.ru/bitrix/templates/main/components/bitrix/cat…/script.js?173693037631978

js nightwolves.ru collected 2026-10-02 07:32:58 UTC 31,978 bytes, 1,352 lines download raw bytes

1(function (window) {
2
3if (!!window.JCCatalogSection)
4{
5	return;
6}
7
8var BasketButton = function(params)
9{
10	BasketButton.superclass.constructor.apply(this, arguments);
11	this.nameNode = BX.create('span', {
12		props : { className : 'bx_medium bx_bt_button', id : this.id },
13		text: params.text
14	});
15	this.buttonNode = BX.create('span', {
16		attrs: { className: params.ownerClass },
17		style: { marginBottom: '0', borderBottom: '0 none transparent' },
18		children: [this.nameNode],
19		events : this.contextEvents
20	});
21	if (BX.browser.IsIE())
22	{
23		this.buttonNode.setAttribute("hideFocus", "hidefocus");
24	}
25};
26BX.extend(BasketButton, BX.PopupWindowButton);
27
28window.JCCatalogSection = function (arParams)
29{
30	this.productType = 0;
31	this.showQuantity = true;
32	this.showAbsent = true;
33	this.secondPict = false;
34	this.showOldPrice = false;
35	this.showPercent = false;
36	this.showSkuProps = false;
37	this.visual = {
38		ID: '',
39		PICT_ID: '',
40		SECOND_PICT_ID: '',
41		QUANTITY_ID: '',
42		QUANTITY_UP_ID: '',
43		QUANTITY_DOWN_ID: '',
44		PRICE_ID: '',
45		DSC_PERC: '',
46		SECOND_DSC_PERC: '',
47		DISPLAY_PROP_DIV: '',
48		BASKET_PROP_DIV: ''
49	};
50	this.product = {
51		checkQuantity: false,
52		maxQuantity: 0,
53		stepQuantity: 1,
54		isDblQuantity: false,
55		canBuy: true,
56		canSubscription: true,
57		name: '',
58		pict: {},
59		id: 0,
60		addUrl: '',
61		buyUrl: ''
62	};
63	this.basketData = {
64		useProps: false,
65		emptyProps: false,
66		quantity: 'quantity',
67		props: 'prop',
68		basketUrl: '',
69		sku_props: '',
70		sku_props_var: 'basket_props'
71	};
72
73	this.defaultPict = {
74		pict: null,
75		secondPict: null
76	};
77
78	this.checkQuantity = false;
79	this.maxQuantity = 0;
80	this.stepQuantity = 1;
81	this.isDblQuantity = false;
82	this.canBuy = true;
83	this.canSubscription = true;
84	this.precision = 6;
85	this.precisionFactor = Math.pow(10,this.precision);
86
87	this.offers = [];
88	this.offerNum = 0;
89	this.treeProps = [];
90	this.obTreeRows = [];
91	this.showCount = [];
92	this.showStart = [];
93	this.selectedValues = {};
94
95	this.obProduct = null;
96	this.obQuantity = null;
97	this.obQuantityUp = null;
98	this.obQuantityDown = null;
99	this.obPict = null;
100	this.obSecondPict = null;
101	this.obPrice = null;
102	this.obTree = null;
103	this.obBuyBtn = null;
104	this.obDscPerc = null;
105	this.obSecondDscPerc = null;
106	this.obSkuProps = null;
107	this.obMeasure = null;
108
109	this.obPopupWin = null;
110	this.basketUrl = '';
111	this.basketParams = {};
112
113	this.treeRowShowSize = 5;
114	this.treeEnableArrow = { display: '', cursor: 'pointer', opacity: 1 };
115	this.treeDisableArrow = { display: '', cursor: 'default', opacity:0.2 };
116
117	this.lastElement = false;
118	this.containerHeight = 0;
119
120	this.errorCode = 0;
121
122	if ('object' === typeof arParams)
123	{
124		this.productType = parseInt(arParams.PRODUCT_TYPE, 10);
125		this.showQuantity = arParams.SHOW_QUANTITY;
126		this.showAbsent = arParams.SHOW_ABSENT;
127		this.secondPict = !!arParams.SECOND_PICT;
128		this.showOldPrice = !!arParams.SHOW_OLD_PRICE;
129		this.showPercent = !!arParams.SHOW_DISCOUNT_PERCENT;
130		this.showSkuProps = !!arParams.SHOW_SKU_PROPS;
131
132		this.visual = arParams.VISUAL;
133		switch (this.productType)
134		{
135			case 1://product
136			case 2://set
137				if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT))
138				{
139					if (this.showQuantity)
140					{
141						this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY;
142						this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT;
143						if (this.product.checkQuantity)
144						{
145							this.product.maxQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) : parseInt(arParams.PRODUCT.MAX_QUANTITY, 10));
146						}
147						this.product.stepQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) : parseInt(arParams.PRODUCT.STEP_QUANTITY, 10));
148
149						this.checkQuantity = this.product.checkQuantity;
150						this.isDblQuantity = this.product.isDblQuantity;
151						this.maxQuantity = this.product.maxQuantity;
152						this.stepQuantity = this.product.stepQuantity;
153						if (this.isDblQuantity)
154						{
155							this.stepQuantity = Math.round(this.stepQuantity*this.precisionFactor)/this.precisionFactor;
156						}
157					}
158					this.product.canBuy = arParams.PRODUCT.CAN_BUY;
159					this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION;
160
161					this.canBuy = this.product.canBuy;
162					this.canSubscription = this.product.canSubscription;
163
164					this.product.name = arParams.PRODUCT.NAME;
165					this.product.pict = arParams.PRODUCT.PICT;
166					this.product.id = arParams.PRODUCT.ID;
167					if (!!arParams.PRODUCT.ADD_URL)
168					{
169						this.product.addUrl = arParams.PRODUCT.ADD_URL;
170					}
171					if (!!arParams.PRODUCT.BUY_URL)
172					{
173						this.product.buyUrl = arParams.PRODUCT.BUY_URL;
174					}
175					if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET))
176					{
177						this.basketData.useProps = !!arParams.BASKET.ADD_PROPS;
178						this.basketData.emptyProps = !!arParams.BASKET.EMPTY_PROPS;
179					}
180				}
181				else
182				{
183					this.errorCode = -1;
184				}
185				break;
186			case 3://sku
187				if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS))
188				{
189					if (!!arParams.PRODUCT && 'object' === typeof(arParams.PRODUCT))
190					{
191						this.product.name = arParams.PRODUCT.NAME;
192						this.product.id = arParams.PRODUCT.ID;
193					}
194					this.offers = arParams.OFFERS;
195					this.offerNum = 0;
196					if (!!arParams.OFFER_SELECTED)
197					{
198						this.offerNum = parseInt(arParams.OFFER_SELECTED, 10);
199					}
200					if (isNaN(this.offerNum))
201					{
202						this.offerNum = 0;
203					}
204					if (!!arParams.TREE_PROPS)
205					{
206						this.treeProps = arParams.TREE_PROPS;
207					}
208					if (!!arParams.DEFAULT_PICTURE)
209					{
210						this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE;
211						this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND;
212					}
213				}
214				else
215				{
216					this.errorCode = -1;
217				}
218				break;
219			default:
220				this.errorCode = -1;
221		}
222		if (!!arParams.BASKET && 'object' === typeof(arParams.BASKET))
223		{
224			if (!!arParams.BASKET.QUANTITY)
225			{
226				this.basketData.quantity = arParams.BASKET.QUANTITY;
227			}
228			if (!!arParams.BASKET.PROPS)
229			{
230				this.basketData.props = arParams.BASKET.PROPS;
231			}
232			if (!!arParams.BASKET.BASKET_URL)
233			{
234				this.basketData.basketUrl = arParams.BASKET.BASKET_URL;
235			}
236			if (3 === this.productType)
237			{
238				if (!!arParams.BASKET.SKU_PROPS)
239				{
240					this.basketData.sku_props = arParams.BASKET.SKU_PROPS;
241				}
242			}
243		}
244		this.lastElement = (!!arParams.LAST_ELEMENT && 'Y' === arParams.LAST_ELEMENT);
245	}
246	if (0 === this.errorCode)
247	{
248		BX.ready(BX.delegate(this.Init,this));
249	}
250};
251
252window.JCCatalogSection.prototype.Init = function()
253{
254	var i = 0,
255		strPrefix = '',
256		TreeItems = null;
257
258	this.obProduct = BX(this.visual.ID);
259	if (!this.obProduct)
260	{
261		this.errorCode = -1;
262	}
263	this.obPict = BX(this.visual.PICT_ID);
264	if (!this.obPict)
265	{
266		this.errorCode = -2;
267	}
268	if (this.secondPict && !!this.visual.SECOND_PICT_ID)
269	{
270		this.obSecondPict = BX(this.visual.SECOND_PICT_ID);
271	}
272	this.obPrice = BX(this.visual.PRICE_ID);
273	if (!this.obPrice)
274	{
275		this.errorCode = -16;
276	}
277	if (this.showQuantity && !!this.visual.QUANTITY_ID)
278	{
279		this.obQuantity = BX(this.visual.QUANTITY_ID);
280		if (!!this.visual.QUANTITY_UP_ID)
281		{
282			this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID);
283		}
284		if (!!this.visual.QUANTITY_DOWN_ID)
285		{
286			this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID);
287		}
288	}
289	if (3 === this.productType)
290	{
291		if (!!this.visual.TREE_ID)
292		{
293			this.obTree = BX(this.visual.TREE_ID);
294			if (!this.obTree)
295			{
296				this.errorCode = -256;
297			}
298			strPrefix = this.visual.TREE_ITEM_ID;
299			for (i = 0; i < this.treeProps.length; i++)
300			{
301				this.obTreeRows[i] = {
302					LEFT: BX(strPrefix+this.treeProps[i].ID+'_left'),
303					RIGHT: BX(strPrefix+this.treeProps[i].ID+'_right'),
304					LIST: BX(strPrefix+this.treeProps[i].ID+'_list'),
305					CONT: BX(strPrefix+this.treeProps[i].ID+'_cont')
306				};
307				if (!this.obTreeRows[i].LEFT || !this.obTreeRows[i].RIGHT || !this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT)
308				{
309					this.errorCode = -512;
310					break;
311				}
312			}
313		}
314		if (!!this.visual.QUANTITY_MEASURE)
315		{
316			this.obMeasure = BX(this.visual.QUANTITY_MEASURE);
317		}
318	}
319	if (!!this.visual.BUY_ID)
320	{
321		this.obBuyBtn = BX(this.visual.BUY_ID);
322	}
323
324	if (this.showPercent)
325	{
326		if (!!this.visual.DSC_PERC)
327		{
328			this.obDscPerc = BX(this.visual.DSC_PERC);
329		}
330		if (this.secondPict && !!this.visual.SECOND_DSC_PERC)
331		{
332			this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC);
333		}
334	}
335
336	if (this.showSkuProps)
337	{
338		if (!!this.visual.DISPLAY_PROP_DIV)
339		{
340			this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV);
341		}
342	}
343
344	if (0 === this.errorCode)
345	{
346		if (this.showQuantity)
347		{
348			if (!!this.obQuantityUp)
349			{
350				BX.bind(this.obQuantityUp, 'click', BX.delegate(this.QuantityUp, this));
351			}
352			if (!!this.obQuantityDown)
353			{
354				BX.bind(this.obQuantityDown, 'click', BX.delegate(this.QuantityDown, this));
355			}
356			if (!!this.obQuantity)
357			{
358				BX.bind(this.obQuantity, 'change', BX.delegate(this.QuantityChange, this));
359			}
360		}
361		switch (this.productType)
362		{
363			case 1://product
364				break;
365			case 3://sku
366				TreeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true);
367				if (!!TreeItems && 0 < TreeItems.length)
368				{
369					for (i = 0; i < TreeItems.length; i++)
370					{
371						BX.bind(TreeItems[i], 'click', BX.delegate(this.SelectOfferProp, this));
372					}
373				}
374				for (i = 0; i < this.obTreeRows.length; i++)
375				{
376					BX.bind(this.obTreeRows[i].LEFT, 'click', BX.delegate(this.RowLeft, this));
377					BX.bind(this.obTreeRows[i].RIGHT, 'click', BX.delegate(this.RowRight, this));
378				}
379				this.SetCurrent();
380				break;
381		}
382		if (!!this.obBuyBtn)
383		{
384			BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Basket, this));
385		}
386		if (this.lastElement)
387		{
388			this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10);
389			if (isNaN(this.containerHeight))
390			{
391				this.containerHeight = 0;
392			}
393			this.setHeight();
394			BX.bind(window, 'resize', BX.delegate(this.checkHeight, this));
395			BX.bind(this.obProduct.parentNode, 'mouseover', BX.delegate(this.setHeight, this));
396			BX.bind(this.obProduct.parentNode, 'mouseout', BX.delegate(this.clearHeight, this));
397		}
398	}
399};
400
401window.JCCatalogSection.prototype.checkHeight = function()
402{
403	this.containerHeight = parseInt(this.obProduct.parentNode.offsetHeight, 10);
404	if (isNaN(this.containerHeight))
405	{
406		this.containerHeight = 0;
407	}
408};
409
410window.JCCatalogSection.prototype.setHeight = function()
411{
412	if (0 < this.containerHeight)
413	{
414		BX.adjust(this.obProduct.parentNode, {style: { height: this.containerHeight+'px'}});
415	}
416};
417
418window.JCCatalogSection.prototype.clearHeight = function()
419{
420	BX.adjust(this.obProduct.parentNode, {style: { height: 'auto'}});
421};
422
423window.JCCatalogSection.prototype.QuantityUp = function()
424{
425	var curValue = 0,
426		boolSet = true;
427
428	if (0 === this.errorCode && this.showQuantity && this.canBuy)
429	{
430		curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
431		if (!isNaN(curValue))
432		{
433			curValue += this.stepQuantity;
434			if (this.checkQuantity)
435			{
436				if (curValue > this.maxQuantity)
437				{
438					boolSet = false;
439				}
440			}
441			if (boolSet)
442			{
443				if (this.isDblQuantity)
444				{
445					curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
446				}
447				this.obQuantity.value = curValue;
448			}
449		}
450	}
451};
452
453window.JCCatalogSection.prototype.QuantityDown = function()
454{
455	var curValue = 0,
456		boolSet = true;
457
458	if (0 === this.errorCode && this.showQuantity && this.canBuy)
459	{
460		curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value): parseInt(this.obQuantity.value, 10));
461		if (!isNaN(curValue))
462		{
463			curValue -= this.stepQuantity;
464			if (curValue < this.stepQuantity)
465			{
466				boolSet = false;
467			}
468			if (boolSet)
469			{
470				if (this.isDblQuantity)
471				{
472					curValue = Math.round(curValue*this.precisionFactor)/this.precisionFactor;
473				}
474				this.obQuantity.value = curValue;
475			}
476		}
477	}
478};
479
480window.JCCatalogSection.prototype.QuantityChange = function()
481{
482	var curValue = 0,
483		boolSet = true;
484
485	if (0 === this.errorCode && this.showQuantity)
486	{
487		if (this.canBuy)
488		{
489			curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
490			if (!isNaN(curValue))
491			{
492				if (this.checkQuantity)
493				{
494					if (curValue > this.maxQuantity)
495					{
496						boolSet = false;
497						curValue = this.maxQuantity;
498					}
499					else if (curValue < this.stepQuantity)
500					{
501						boolSet = false;
502						curValue = this.stepQuantity;
503					}
504				}
505				if (!boolSet)
506				{
507					this.obQuantity.value = curValue;
508				}
509			}
510			else
511			{
512				this.obQuantity.value = this.stepQuantity;
513			}
514		}
515		else
516		{
517			this.obQuantity.value = this.stepQuantity;
518		}
519	}
520};
521
522window.JCCatalogSection.prototype.QuantitySet = function(index)
523{
524	if (0 === this.errorCode)
525	{
526		this.canBuy = this.offers[index].CAN_BUY;
527		if (this.canBuy)
528		{
529			BX.addClass(this.obBuyBtn, 'bx_bt_button');
530			BX.removeClass(this.obBuyBtn, 'bx_bt_button_type_2');
531			this.obBuyBtn.innerHTML = BX.message('MESS_BTN_BUY');
532		}
533		else
534		{
535			BX.addClass(this.obBuyBtn, 'bx_bt_button_type_2');
536			BX.removeClass(this.obBuyBtn, 'bx_bt_button');
537			this.obBuyBtn.innerHTML = BX.message('MESS_NOT_AVAILABLE');
538		}
539		if (this.showQuantity)
540		{
541			this.isDblQuantity = this.offers[index].QUANTITY_FLOAT;
542			this.checkQuantity = this.offers[index].CHECK_QUANTITY;
543			if (this.isDblQuantity)
544			{
545				this.maxQuantity = parseFloat(this.offers[index].MAX_QUANTITY);
546				this.stepQuantity = Math.round(parseFloat(this.offers[index].STEP_QUANTITY)*this.precisionFactor)/this.precisionFactor;
547			}
548			else
549			{
550				this.maxQuantity = parseInt(this.offers[index].MAX_QUANTITY, 10);
551				this.stepQuantity = parseInt(this.offers[index].STEP_QUANTITY, 10);
552			}
553
554			this.obQuantity.value = this.stepQuantity;
555			this.obQuantity.disabled = !this.canBuy;
556			if (!!this.obMeasure)
557			{
558				if (!!this.offers[index].MEASURE)
559				{
560					BX.adjust(this.obMeasure, { html : this.offers[index].MEASURE});
561				}
562				else
563				{
564					BX.adjust(this.obMeasure, { html : ''});
565				}
566			}
567		}
568	}
569};
570
571window.JCCatalogSection.prototype.SelectOfferProp = function()
572{
573	var i = 0,
574		value = '',
575		strTreeValue = '',
576		arTreeItem = [],
577		RowItems = null,
578		target = BX.proxy_context;
579
580	if (!!target && target.hasAttribute('data-treevalue'))
581	{
582		strTreeValue = target.getAttribute('data-treevalue');
583		arTreeItem = strTreeValue.split('_');
584		if (this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1]))
585		{
586			RowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false);
587			if (!!RowItems && 0 < RowItems.length)
588			{
589				for (i = 0; i < RowItems.length; i++)
590				{
591					value = RowItems[i].getAttribute('data-onevalue');
592					if (value === arTreeItem[1])
593					{
594						BX.addClass(RowItems[i], 'bx_active');
595					}
596					else
597					{
598						BX.removeClass(RowItems[i], 'bx_active');
599					}
600				}
601			}
602		}
603	}
604};
605
606window.JCCatalogSection.prototype.SearchOfferPropIndex = function(strPropID, strPropValue)
607{
608	var strName = '',
609		arShowValues = false,
610		i, j,
611		arCanBuyValues = [],
612		index = -1,
613		arFilter = {},
614		tmpFilter = [];
615
616	for (i = 0; i < this.treeProps.length; i++)
617	{
618		if (this.treeProps[i].ID === strPropID)
619		{
620			index = i;
621			break;
622		}
623	}
624
625	if (-1 < index)
626	{
627		for (i = 0; i < index; i++)
628		{
629			strName = 'PROP_'+this.treeProps[i].ID;
630			arFilter[strName] = this.selectedValues[strName];
631		}
632		strName = 'PROP_'+this.treeProps[index].ID;
633		arShowValues = this.GetRowValues(arFilter, strName);
634		if (!arShowValues)
635		{
636			return false;
637		}
638		if (!BX.util.in_array(strPropValue, arShowValues))
639		{
640			return false;
641		}
642		arFilter[strName] = strPropValue;
643		for (i = index+1; i < this.treeProps.length; i++)
644		{
645			strName = 'PROP_'+this.treeProps[i].ID;
646			arShowValues = this.GetRowValues(arFilter, strName);
647			if (!arShowValues)
648			{
649				return false;
650			}
651			if (this.showAbsent)
652			{
653				arCanBuyValues = [];
654				tmpFilter = [];
655				tmpFilter = BX.clone(arFilter, true);
656				for (j = 0; j < arShowValues.length; j++)
657				{
658					tmpFilter[strName] = arShowValues[j];
659					if (this.GetCanBuy(tmpFilter))
660					{
661						arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
662					}
663				}
664			}
665			else
666			{
667				arCanBuyValues = arShowValues;
668			}
669			if (!!this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues))
670			{
671				arFilter[strName] = this.selectedValues[strName];
672			}
673			else
674			{
675				arFilter[strName] = arCanBuyValues[0];
676			}
677			this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
678		}
679		this.selectedValues = arFilter;
680		this.ChangeInfo();
681	}
682	return true;
683};
684
685window.JCCatalogSection.prototype.RowLeft = function()
686{
687	var i = 0,
688		strTreeValue = '',
689		index = -1,
690		target = BX.proxy_context;
691
692	if (!!target && target.hasAttribute('data-treevalue'))
693	{
694		strTreeValue = target.getAttribute('data-treevalue');
695		for (i = 0; i < this.treeProps.length; i++)
696		{
697			if (this.treeProps[i].ID === strTreeValue)
698			{
699				index = i;
700				break;
701			}
702		}
703		if (-1 < index && this.treeRowShowSize < this.showCount[index])
704		{
705			if (0 > this.showStart[index])
706			{
707				this.showStart[index]++;
708				BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
709				BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeEnableArrow });
710			}
711
712			if (0 <= this.showStart[index])
713			{
714				BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeDisableArrow });
715			}
716		}
717	}
718};
719
720window.JCCatalogSection.prototype.RowRight = function()
721{
722	var i = 0,
723		strTreeValue = '',
724		index = -1,
725		target = BX.proxy_context;
726
727	if (!!target && target.hasAttribute('data-treevalue'))
728	{
729		strTreeValue = target.getAttribute('data-treevalue');
730		for (i = 0; i < this.treeProps.length; i++)
731		{
732			if (this.treeProps[i].ID === strTreeValue)
733			{
734				index = i;
735				break;
736			}
737		}
738		if (-1 < index && this.treeRowShowSize < this.showCount[index])
739		{
740			if ((this.treeRowShowSize - this.showStart[index]) < this.showCount[index])
741			{
742				this.showStart[index]--;
743				BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
744				BX.adjust(this.obTreeRows[index].LEFT, { style: this.treeEnableArrow });
745			}
746
747			if ((this.treeRowShowSize - this.showStart[index]) >= this.showCount[index])
748			{
749				BX.adjust(this.obTreeRows[index].RIGHT, { style: this.treeDisableArrow });
750			}
751		}
752	}
753};
754
755window.JCCatalogSection.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID)
756{
757	var i = 0,
758		showI = 0,
759		value = '',
760		countShow = 0,
761		strNewLen = '',
762		obData = {},
763		pictMode = false,
764		extShowMode = false,
765		isCurrent = false,
766		selectIndex = 0,
767		obLeft = this.treeEnableArrow,
768		obRight = this.treeEnableArrow,
769		currentShowStart = 0,
770		RowItems = null;
771
772	if (-1 < intNumber && intNumber < this.obTreeRows.length)
773	{
774		RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: 'li'}, false);
775		if (!!RowItems && 0 < RowItems.length)
776		{
777			pictMode = ('PICT' === this.treeProps[intNumber].SHOW_MODE);
778			countShow = showID.length;
779			extShowMode = this.treeRowShowSize < countShow;
780			strNewLen = (extShowMode ? (100/countShow)+'%' : '20%');
781			obData = {
782				props: { className: '' },
783				style: {
784					width: strNewLen
785				}
786			};
787			if (pictMode)
788			{
789				obData.style.paddingTop = strNewLen;
790			}
791			for (i = 0; i < RowItems.length; i++)
792			{
793				value = RowItems[i].getAttribute('data-onevalue');
794				isCurrent = (value === activeID);
795				if (BX.util.in_array(value, canBuyID))
796				{
797					obData.props.className = (isCurrent ? 'bx_active' : '');
798				}
799				else
800				{
801					obData.props.className = (isCurrent ? 'bx_active bx_missing' : 'bx_missing');
802				}
803				obData.style.display = 'none';
804				if (BX.util.in_array(value, showID))
805				{
806					obData.style.display = '';
807					if (isCurrent)
808					{
809						selectIndex = showI;
810					}
811					showI++;
812				}
813				BX.adjust(RowItems[i], obData);
814			}
815
816			obData = {
817				style: {
818					width: (extShowMode ? 20*countShow : 100)+'%',
819					marginLeft: '0%'
820				}
821			};
822			if (pictMode)
823			{
824				BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_scu full' : 'bx_item_detail_scu')}});
825			}
826			else
827			{
828				BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (extShowMode ? 'bx_item_detail_size full' : 'bx_item_detail_size')}});
829			}
830			if (extShowMode)
831			{
832				if (selectIndex +1 === countShow)
833				{
834					obRight = this.treeDisableArrow;
835				}
836				if (this.treeRowShowSize <= selectIndex)
837				{
838					currentShowStart = this.treeRowShowSize - selectIndex - 1;
839					obData.style.marginLeft = currentShowStart*20+'%';
840				}
841				if (0 === currentShowStart)
842				{
843					obLeft = this.treeDisableArrow;
844				}
845				BX.adjust(this.obTreeRows[intNumber].LEFT, {style: obLeft });
846				BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: obRight });
847			}
848			else
849			{
850				BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: 'none'}});
851				BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: 'none'}});
852			}
853			BX.adjust(this.obTreeRows[intNumber].LIST, obData);
854			this.showCount[intNumber] = countShow;
855			this.showStart[intNumber] = currentShowStart;
856		}
857	}
858};
859
860window.JCCatalogSection.prototype.GetRowValues = function(arFilter, index)
861{
862	var i = 0,
863		j,
864		arValues = [],
865		boolSearch = false,
866		boolOneSearch = true;
867
868	if (0 === arFilter.length)
869	{
870		for (i = 0; i < this.offers.length; i++)
871		{
872			if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
873			{
874				arValues[arValues.length] = this.offers[i].TREE[index];
875			}
876		}
877		boolSearch = true;
878	}
879	else
880	{
881		for (i = 0; i < this.offers.length; i++)
882		{
883			boolOneSearch = true;
884			for (j in arFilter)
885			{
886				if (arFilter[j] !== this.offers[i].TREE[j])
887				{
888					boolOneSearch = false;
889					break;
890				}
891			}
892			if (boolOneSearch)
893			{
894				if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
895				{
896					arValues[arValues.length] = this.offers[i].TREE[index];
897				}
898				boolSearch = true;
899			}
900		}
901	}
902	return (boolSearch ? arValues : false);
903};
904
905window.JCCatalogSection.prototype.GetCanBuy = function(arFilter)
906{
907	var i = 0,
908		j,
909		boolSearch = false,
910		boolOneSearch = true;
911
912	for (i = 0; i < this.offers.length; i++)
913	{
914		boolOneSearch = true;
915		for (j in arFilter)
916		{
917			if (arFilter[j] !== this.offers[i].TREE[j])
918			{
919				boolOneSearch = false;
920				break;
921			}
922		}
923		if (boolOneSearch)
924		{
925			if (this.offers[i].CAN_BUY)
926			{
927				boolSearch = true;
928				break;
929			}
930		}
931	}
932	return boolSearch;
933};
934
935window.JCCatalogSection.prototype.SetCurrent = function()
936{
937	var i = 0,
938		j = 0,
939		arCanBuyValues = [],
940		strName = '',
941		arShowValues = false,
942		arFilter = {},
943		tmpFilter = [],
944		current = this.offers[this.offerNum].TREE;
945
946	for (i = 0; i < this.treeProps.length; i++)
947	{
948		strName = 'PROP_'+this.treeProps[i].ID;
949		arShowValues = this.GetRowValues(arFilter, strName);
950		if (!arShowValues)
951		{
952			break;
953		}
954		if (BX.util.in_array(current[strName], arShowValues))
955		{
956			arFilter[strName] = current[strName];
957		}
958		else
959		{
960			arFilter[strName] = arShowValues[0];
961			this.offerNum = 0;
962		}
963		if (this.showAbsent)
964		{
965			arCanBuyValues = [];
966			tmpFilter = [];
967			tmpFilter = BX.clone(arFilter, true);
968			for (j = 0; j < arShowValues.length; j++)
969			{
970				tmpFilter[strName] = arShowValues[j];
971				if (this.GetCanBuy(tmpFilter))
972				{
973					arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
974				}
975			}
976		}
977		else
978		{
979			arCanBuyValues = arShowValues;
980		}
981		this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
982	}
983	this.selectedValues = arFilter;
984	this.ChangeInfo();
985};
986
987window.JCCatalogSection.prototype.ChangeInfo = function()
988{
989	var i = 0,
990		j,
991		index = -1,
992		obData = {},
993		boolOneSearch = true,
994		strPrice = '';
995
996	for (i = 0; i < this.offers.length; i++)
997	{
998		boolOneSearch = true;
999		for (j in this.selectedValues)
1000		{
1001			if (this.selectedValues[j] !== this.offers[i].TREE[j])
1002			{
1003				boolOneSearch = false;
1004				break;
1005			}
1006		}
1007		if (boolOneSearch)
1008		{
1009			index = i;
1010			break;
1011		}
1012	}
1013	if (-1 < index)
1014	{
1015		if (!!this.obPict)
1016		{
1017			if (!!this.offers[index].PREVIEW_PICTURE)
1018			{
1019				BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}});
1020			}
1021			else
1022			{
1023				BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}});
1024			}
1025		}
1026		if (this.secondPict && !!this.obSecondPict)
1027		{
1028			if (!!this.offers[index].PREVIEW_PICTURE_SECOND)
1029			{
1030				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE_SECOND.SRC+')'}});
1031			}
1032			else if (!!this.offers[index].PREVIEW_PICTURE.SRC)
1033			{
1034				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}});
1035			}
1036			else if (!!this.defaultPict.secondPict)
1037			{
1038				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.secondPict.SRC+')'}});
1039			}
1040			else
1041			{
1042				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}});
1043			}
1044		}
1045		if (this.showSkuProps && !!this.obSkuProps)
1046		{
1047			if (0 === this.offers[index].DISPLAY_PROPERTIES.length)
1048			{
1049				BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''});
1050			}
1051			else
1052			{
1053				BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES});
1054			}
1055		}
1056		if (!!this.obPrice)
1057		{
1058			strPrice = this.offers[index].PRICE.PRINT_DISCOUNT_VALUE;
1059			if (this.showOldPrice && (this.offers[index].PRICE.DISCOUNT_VALUE !== this.offers[index].PRICE.VALUE))
1060			{
1061				strPrice += ' <span>'+this.offers[index].PRICE.PRINT_VALUE+'</span>';
1062			}
1063			BX.adjust(this.obPrice, {html: strPrice});
1064			if (this.showPercent)
1065			{
1066				if (this.offers[index].PRICE.DISCOUNT_VALUE !== this.offers[index].PRICE.VALUE)
1067				{
1068					obData = {
1069						style: {
1070							display: ''
1071						},
1072						html: this.offers[index].PRICE.DISCOUNT_DIFF_PERCENT
1073					};
1074				}
1075				else
1076				{
1077					obData = {
1078						style: {
1079							display: 'none'
1080						},
1081						html: ''
1082					};
1083				}
1084				if (!!this.obDscPerc)
1085				{
1086					BX.adjust(this.obDscPerc, obData);
1087				}
1088				if (!!this.obSecondDscPerc)
1089				{
1090					BX.adjust(this.obSecondDscPerc, obData);
1091				}
1092			}
1093		}
1094		this.offerNum = index;
1095		this.QuantitySet(this.offerNum);
1096	}
1097};
1098
1099window.JCCatalogSection.prototype.InitBasketUrl = function()
1100{
1101	switch (this.productType)
1102	{
1103		case 1://product
1104		case 2://set
1105			this.basketUrl = this.product.addUrl;
1106			break;
1107		case 3://sku
1108			this.basketUrl = this.offers[this.offerNum].ADD_URL;
1109			break;
1110	}
1111	this.basketParams = {
1112		'ajax_basket': 'Y'
1113	};
1114	if (this.showQuantity)
1115	{
1116		this.basketParams[this.basketData.quantity] = this.obQuantity.value;
1117	}
1118	if (!!this.basketData.sku_props)
1119	{
1120		this.basketParams[this.basketData.sku_props_var] = this.basketData.sku_props;
1121	}
1122};
1123
1124window.JCCatalogSection.prototype.FillBasketProps = function()
1125{
1126	if (!this.visual.BASKET_PROP_DIV)
1127	{
1128		return;
1129	}
1130	var
1131		i = 0,
1132		propCollection = null,
1133		foundValues = false,
1134		obBasketProps = null;
1135
1136	if (this.basketData.useProps && !this.basketData.emptyProps)
1137	{
1138		if (!!this.obPopupWin && !!this.obPopupWin.contentContainer)
1139		{
1140			obBasketProps = this.obPopupWin.contentContainer;
1141		}
1142	}
1143	else
1144	{
1145		obBasketProps = BX(this.visual.BASKET_PROP_DIV);
1146	}
1147	if (!!obBasketProps)
1148	{
1149		propCollection = obBasketProps.getElementsByTagName('select');
1150		if (!!propCollection && !!propCollection.length)
1151		{
1152			for (i = 0; i < propCollection.length; i++)
1153			{
1154				if (!propCollection[i].disabled)
1155				{
1156					switch(propCollection[i].type.toLowerCase())
1157					{
1158						case 'select-one':
1159							this.basketParams[propCollection[i].name] = propCollection[i].value;
1160							foundValues = true;
1161							break;
1162						default:
1163							break;
1164					}
1165				}
1166			}
1167		}
1168		propCollection = obBasketProps.getElementsByTagName('input');
1169		if (!!propCollection && !!propCollection.length)
1170		{
1171			for (i = 0; i < propCollection.length; i++)
1172			{
1173				if (!propCollection[i].disabled)
1174				{
1175					switch(propCollection[i].type.toLowerCase())
1176					{
1177						case 'hidden':
1178							this.basketParams[propCollection[i].name] = propCollection[i].value;
1179							foundValues = true;
1180							break;
1181						case 'radio':
1182							if (propCollection[i].checked)
1183							{
1184								this.basketParams[propCollection[i].name] = propCollection[i].value;
1185								foundValues = true;
1186							}
1187							break;
1188						default:
1189							break;
1190					}
1191				}
1192			}
1193		}
1194	}
1195	if (!foundValues)
1196	{
1197		this.basketParams[this.basketData.props] = [];
1198		this.basketParams[this.basketData.props][0] = 0;
1199	}
1200};
1201
1202window.JCCatalogSection.prototype.SendToBasket = function()
1203{
1204	if (!this.canBuy)
1205	{
1206		return;
1207	}
1208	this.InitBasketUrl();
1209	this.FillBasketProps();
1210	BX.ajax.loadJSON(
1211		this.basketUrl,
1212		this.basketParams,
1213		BX.delegate(this.BasketResult, this)
1214	);
1215};
1216
1217window.JCCatalogSection.prototype.Basket = function()
1218{
1219	var contentBasketProps = '';
1220	if (!this.canBuy)
1221	{
1222		return;
1223	}
1224	switch (this.productType)
1225	{
1226	case 1://product
1227	case 2://set
1228		if (this.basketData.useProps && !this.basketData.emptyProps)
1229		{
1230			this.InitPopupWindow();
1231			this.obPopupWin.setTitleBar({
1232				content: BX.create('div', {
1233					style: { marginRight: '30px', whiteSpace: 'nowrap' },
1234					text: BX.message('TITLE_BASKET_PROPS')
1235				})
1236			});
1237			if (BX(this.visual.BASKET_PROP_DIV))
1238			{
1239				contentBasketProps = BX(this.visual.BASKET_PROP_DIV).innerHTML;
1240			}
1241			this.obPopupWin.setContent(contentBasketProps);
1242			this.obPopupWin.setButtons([
1243				new BasketButton({
1244					ownerClass: this.obProduct.parentNode.parentNode.className,
1245					text: BX.message('BTN_MESSAGE_SEND_PROPS'),
1246					events: {
1247						click: BX.delegate(this.SendToBasket, this)
1248					}
1249				})
1250			]);
1251			this.obPopupWin.show();
1252		}
1253		else
1254		{
1255			this.SendToBasket();
1256		}
1257		break;
1258	case 3://sku
1259		this.SendToBasket();
1260		break;
1261	}
1262};
1263
1264window.JCCatalogSection.prototype.BasketResult = function(arResult)
1265{
1266	var strContent = '',
1267		strName = '',
1268		strPict = '',
1269		successful = true,
1270		buttons = [];
1271
1272	if (!!this.obPopupWin)
1273	{
1274		this.obPopupWin.close();
1275	}
1276	if ('object' !== typeof arResult)
1277	{
1278		return false;
1279	}
1280	successful = ('OK' === arResult.STATUS);
1281	if (successful)
1282	{
1283		BX.onCustomEvent('OnBasketChange');
1284		strName = this.product.name;
1285		switch(this.productType)
1286		{
1287		case 1://
1288		case 2://
1289			strPict = this.product.pict.SRC;
1290			break;
1291		case 3:
1292			strPict = (!!this.offers[this.offerNum].PREVIEW_PICTURE ?
1293				this.offers[this.offerNum].PREVIEW_PICTURE.SRC :
1294				this.defaultPict.pict.SRC
1295			);
1296			break;
1297		}
1298		strContent = '<div style="width: 96%; margin: 10px 2%; text-align: center;"><img src="'+strPict+'" height="130"><p>'+strName+'</p></div>';
1299		buttons = [
1300			new BasketButton({
1301				ownerClass: this.obProduct.parentNode.parentNode.className,
1302				text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"),
1303				events: {
1304					click: BX.delegate(function(){
1305						location.href = (!!this.basketData.basketUrl ? this.basketData.basketUrl : BX.message('BASKET_URL'));
1306					}, this)
1307				}
1308			})
1309		];
1310	}
1311	else
1312	{
1313		strContent = (!!arResult.MESSAGE ? arResult.MESSAGE : BX.message('BASKET_UNKNOWN_ERROR'));
1314		buttons = [
1315			new BasketButton({
1316				ownerClass: this.obProduct.parentNode.parentNode.className,
1317				text: BX.message('BTN_MESSAGE_CLOSE'),
1318				events: {
1319					click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
1320				}
1321			})
1322		];
1323	}
1324	this.InitPopupWindow();
1325	this.obPopupWin.setTitleBar({
1326		content: BX.create('div', {
1327			style: { marginRight: '30px', whiteSpace: 'nowrap' },
1328			text: (successful ? BX.message('TITLE_SUCCESSFUL') : BX.message('TITLE_ERROR'))
1329		})
1330	});
1331	this.obPopupWin.setContent(strContent);
1332	this.obPopupWin.setButtons(buttons);
1333	this.obPopupWin.show();
1334};
1335
1336window.JCCatalogSection.prototype.InitPopupWindow = function()
1337{
1338	if (!!this.obPopupWin)
1339	{
1340		return;
1341	}
1342	this.obPopupWin = BX.PopupWindowManager.create('CatalogSectionBasket_'+this.visual.ID, null, {
1343		autoHide: false,
1344		offsetLeft: 0,
1345		offsetTop: 0,
1346		overlay : true,
1347		closeByEsc: true,
1348		titleBar: true,
1349		closeIcon: {top: '10px', right: '10px'}
1350	});
1351};
1352})(window);

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.