PageSourceSearch

https://auraf.ru/bitrix/templates/aura-flowers-new/components/bitr…/slider/script.js?171562863322217

js auraf.ru collected 2026-10-07 17:01:49 UTC 22,217 bytes, 898 lines download raw bytes

1JCCatalogSection = function (arParams)
2{
3	this.productType = 0;
4	this.showQuantity = true;
5	this.showAbsent = true;
6	this.secondPict = false;
7	this.showOldPrice = false;
8	this.showPercent = false;
9	this.showSkuProps = false;
10	this.visual = {
11		ID: '',
12		PICT_ID: '',
13		SECOND_PICT_ID: '',
14		QUANTITY_ID: '',
15		QUANTITY_UP_ID: '',
16		QUANTITY_DOWN_ID: '',
17		PRICE_ID: '',
18		DSC_PERC: '',
19		SECOND_DSC_PERC: '',
20		DISPLAY_PROP_DIV: ''
21	};
22	this.product = {
23		checkQuantity: false,
24		maxQuantity: 0,
25		stepQuantity: 1,
26		isDblQuantity: false,
27		canBuy: true,
28		canSubscription: true,
29		name: '',
30		pict: {},
31		id: 0
32	};
33	
34	this.defaultPict = {
35		pict: null,
36		secondPict: null
37	};
38	
39	this.ajaxPath = '';
40
41	this.checkQuantity = false;
42	this.maxQuantity = 0;
43	this.stepQuantity = 1;
44	this.isDblQuantity = false;
45	this.canBuy = true;
46	this.canSubscription = true;
47
48	this.offers = [];
49	this.offerNum = 0;
50	this.treeProps = [];
51	this.obTreeRows = [];
52	this.showCount = [];
53	this.showStart = [];
54	this.selectedValues = {};
55
56	this.obProduct = null;
57	this.obQuantity = null;
58	this.obQuantityUp = null;
59	this.obQuantityDown = null;
60	this.obPict = null;
61	this.obSecondPict = null;
62	this.obPrice = null;
63	this.obTree = null;
64	this.obBuyBtn = null;
65	this.obDscPerc = null;
66	this.obSecondDscPerc = null;
67	this.obSkuProps = null;
68	this.obMeasure = null;
69	
70	this.errorCode = 0;
71	
72	if ('object' == typeof(arParams))
73	{
74		this.productType = parseInt(arParams.PRODUCT_TYPE);
75		this.showQuantity = arParams.SHOW_QUANTITY;
76		this.showAbsent = arParams.SHOW_ABSENT;
77		if (!!arParams.SECOND_PICT)
78			this.secondPict = true;
79		if (!!arParams.SHOW_OLD_PRICE)
80			this.showOldPrice = true;
81		if (!!arParams.SHOW_DISCOUNT_PERCENT)
82			this.showPercent = true;
83		if (!!arParams.SHOW_SKU_PROPS)
84			this.showSkuProps = true;
85		this.visual = arParams.VISUAL;
86		this.ajaxPath = arParams.AJAX_PATH;
87		switch (this.productType)
88		{
89			case 1://product
90			case 2://set
91				if (!!arParams.PRODUCT && 'object' == typeof(arParams.PRODUCT))
92				{
93					if (this.showQuantity)
94					{
95						this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY;
96						this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT;
97						if (this.product.checkQuantity)
98							this.product.maxQuantity = (this.product.isDblQuantity
99									? parseFloat(arParams.PRODUCT.MAX_QUANTITY)
100									: parseInt(arParams.PRODUCT.MAX_QUANTITY)
101							);
102						this.product.stepQuantity = (this.product.isDblQuantity
103							? parseFloat(arParams.PRODUCT.STEP_QUANTITY)
104							: parseInt(arParams.PRODUCT.STEP_QUANTITY)
105						);
106						
107						this.checkQuantity = this.product.checkQuantity;
108						this.isDblQuantity = this.product.isDblQuantity;
109						this.maxQuantity = this.product.maxQuantity;
110						this.stepQuantity = this.product.stepQuantity;
111					}
112					this.product.canBuy = arParams.PRODUCT.CAN_BUY;
113					this.product.canSubscription = arParams.PRODUCT.SUBSCRIPTION;
114					
115					this.canBuy = this.product.canBuy;
116					this.canSubscription = this.product.canSubscription;
117					
118					this.product.name = arParams.PRODUCT.NAME;
119					this.product.pict = arParams.PRODUCT.PICT;
120					this.product.id = arParams.PRODUCT.ID;
121				}
122				else
123				{
124					this.errorCode = -1;
125				}
126				break;
127			case 3://sku
128				if (!!arParams.OFFERS && BX.type.isArray(arParams.OFFERS))
129				{
130					this.offers = arParams.OFFERS;
131					this.offerNum = 0;
132					if (!!arParams.OFFER_SELECTED)
133						this.offerNum = parseInt(arParams.OFFER_SELECTED);
134					if (isNaN(this.offerNum))
135						this.offerNum = 0;
136					if (!!arParams.TREE_PROPS)
137						this.treeProps = arParams.TREE_PROPS;
138					if (!!arParams.DEFAULT_PICTURE)
139					{
140						this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE;
141						this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND;
142					}
143				}
144				else
145				{
146					this.errorCode = -1;
147				}
148				break;
149			default:
150				this.errorCode = -1;
151		}
152	}
153	if (0 == this.errorCode)
154	{
155		BX.ready(BX.delegate(this.Init,this));
156	}
157};
158
159JCCatalogSection.prototype.Init = function()
160{
161	var i = 0;
162	this.obProduct = BX(this.visual.ID);
163	if (!this.obProduct)
164		this.errorCode = -1;
165	this.obPict = BX(this.visual.PICT_ID);
166	if (!this.obPict)
167		this.errorCode = -2;
168	if (this.secondPict && !!this.visual.SECOND_PICT_ID)
169	{
170		this.obSecondPict = BX(this.visual.SECOND_PICT_ID);
171	}
172	this.obPrice = BX(this.visual.PRICE_ID);
173	if (!this.obPrice)
174		this.errorCode = -16;
175	if (this.showQuantity && !!this.visual.QUANTITY_ID)
176	{
177		this.obQuantity = BX(this.visual.QUANTITY_ID);
178		if (!this.obQuantity)
179			this.errorCode = -32;
180		if (!!this.visual.QUANTITY_UP_ID)
181		{
182			this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID);
183			if (!this.obQuantityUp)
184				this.errorCode = -64;
185		}
186		if (!!this.visual.QUANTITY_DOWN_ID)
187		{
188			this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID);
189			if (!this.obQuantityDown)
190				this.errorCode = -128;
191		}
192	}
193	if (3 == this.productType)
194	{
195		if (!!this.visual.TREE_ID)
196		{
197			this.obTree = BX(this.visual.TREE_ID);
198			if (!this.obTree)
199				this.errorCode = -256;
200			var strPrefix = this.visual.TREE_ITEM_ID;
201			for (i = 0; i < this.treeProps.length; i++)
202			{
203				this.obTreeRows[i] = {
204					LEFT: BX(strPrefix+this.treeProps[i].ID+'_left'),
205					RIGHT: BX(strPrefix+this.treeProps[i].ID+'_right'),
206					LIST: BX(strPrefix+this.treeProps[i].ID+'_list'),
207					CONT: BX(strPrefix+this.treeProps[i].ID+'_cont')
208				};
209				if (!this.obTreeRows[i].LEFT || !this.obTreeRows[i].RIGHT || !this.obTreeRows[i].LIST || !this.obTreeRows[i].CONT)
210				{
211					this.errorCode = -512;
212					break;
213				}
214			}
215		}
216		if (!!this.visual.QUANTITY_MEASURE)
217		{
218			this.obMeasure = BX(this.visual.QUANTITY_MEASURE);
219		}
220	}
221	if (!!this.visual.BUY_ID)
222	{
223		this.obBuyBtn = BX(this.visual.BUY_ID);
224		if (!this.obBuyBtn)
225		{
226			
227		}
228	}
229	
230	if (this.showPercent)
231	{
232		if (!!this.visual.DSC_PERC)
233		{
234			this.obDscPerc = BX(this.visual.DSC_PERC);
235		}
236		if (this.secondPict && !!this.visual.SECOND_DSC_PERC)
237		{
238			this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC);
239		}
240	}
241	
242	if (this.showSkuProps)
243	{
244		if (!!this.visual.DISPLAY_PROP_DIV)
245		{
246			this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV);
247		}
248	}
249	
250	if (0 == this.errorCode)
251	{
252		if (this.showQuantity)
253		{
254			BX.bind(this.obQuantityUp, 'click', BX.delegate(this.QuantityUp, this));
255			BX.bind(this.obQuantityDown, 'click', BX.delegate(this.QuantityDown, this));
256			BX.bind(this.obQuantity, 'change', BX.delegate(this.QuantityChange, this));
257		}
258		switch (this.productType)
259		{
260			case 1://product
261				break;
262			case 3://sku
263				var TreeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true);
264				if (!!TreeItems && 0 < TreeItems.length)
265				{
266					for (i = 0; i < TreeItems.length; i++)
267					{
268						BX.bind(TreeItems[i], 'click', BX.delegate(function(e){this.SelectOfferProp(e); }, this));
269					}
270				}
271				for (i = 0; i < this.obTreeRows.length; i++)
272				{
273					BX.bind(this.obTreeRows[i].LEFT, 'click', BX.delegate(function(e){this.RowLeft(e); }, this));
274					BX.bind(this.obTreeRows[i].RIGHT, 'click', BX.delegate(function(e){this.RowRight(e); }, this));
275				}
276				this.SetCurrent();
277				break;
278		}
279		if (!!this.obBuyBtn)
280			BX.bind(this.obBuyBtn, 'click', BX.delegate(this.Basket, this));
281	}
282};
283
284JCCatalogSection.prototype.QuantityUp = function()
285{
286	var curValue = 0;
287	var boolSet = true;
288	if (0 == this.errorCode && this.showQuantity)
289	{
290		curValue = (
291			this.isDblQuantity
292			? parseFloat(this.obQuantity.value)
293			: parseInt(this.obQuantity.value)
294		);
295		if (!isNaN(curValue))
296		{
297			curValue += this.stepQuantity;
298			if (this.checkQuantity)
299			{
300				if (curValue > this.maxQuantity)
301					boolSet = false;
302			}
303			if (boolSet)
304			{
305				this.obQuantity.value = curValue;
306			}
307		}
308	}
309};
310
311JCCatalogSection.prototype.QuantityDown = function()
312{
313	var curValue = 0;
314	var boolSet = true;
315	if (0 == this.errorCode && this.showQuantity)
316	{
317		curValue = (
318			this.isDblQuantity
319			? parseFloat(this.obQuantity.value)
320			: parseInt(this.obQuantity.value)
321		);
322		if (!isNaN(curValue))
323		{
324			curValue -= this.stepQuantity;
325			if (curValue < this.stepQuantity)
326				boolSet = false;
327			if (boolSet)
328			{
329				this.obQuantity.value = curValue;
330			}
331		}
332	}
333};
334
335JCCatalogSection.prototype.QuantityChange = function()
336{
337	var curValue = 0;
338	var boolSet = true;
339	if (0 == this.errorCode && this.showQuantity)
340	{
341		curValue = (
342			this.isDblQuantity
343			? parseFloat(this.obQuantity.value)
344			: parseInt(this.obQuantity.value)
345		);
346		if (!isNaN(curValue))
347		{
348			if (this.checkQuantity)
349			{
350				if (curValue > this.maxQuantity)
351				{
352					boolSet = false;
353					curValue = this.maxQuantity;
354				}
355				else if (curValue < this.stepQuantity)
356				{
357					boolSet = false;
358					curValue = this.stepQuantity;
359				}
360			}
361			if (!boolSet)
362			{
363				this.obQuantity.value = curValue;
364				//
365			}
366		}
367		else
368		{
369			this.obQuantity.value = this.stepQuantity;
370			//
371		}
372	}
373};
374
375JCCatalogSection.prototype.QuantitySet = function(index)
376{
377	if (0 == this.errorCode)
378	{
379		this.canBuy = this.offers[index].CAN_BUY;
380		if (this.showQuantity)
381		{
382			this.isDblQuantity = this.offers[index].QUANTITY_FLOAT;
383			this.checkQuantity = this.offers[index].CHECK_QUANTITY;
384			this.maxQuantity = (this.isDblQuantity
385				? parseFloat(this.offers[index].MAX_QUANTITY)
386				: parseInt(this.offers[index].MAX_QUANTITY)
387			);
388			this.stepQuantity = (this.isDblQuantity
389				? parseFloat(this.offers[index].STEP_QUANTITY)
390				: parseInt(this.offers[index].STEP_QUANTITY)
391			);
392			this.obQuantity.value = this.stepQuantity;
393			if (!!this.obMeasure)
394			{
395				if (!!this.offers[index].MEASURE)
396				{
397					BX.adjust(this.obMeasure, { html : this.offers[index].MEASURE});
398				}
399				else
400				{
401					BX.adjust(this.obMeasure, { html : ''});
402				}
403			}
404		}
405	}
406};
407
408JCCatalogSection.prototype.SelectOfferProp = function(e)
409{
410	if (!e) e = window.event;
411	var target = BX.proxy_context;
412	if (!!target && target.hasAttribute('data-treevalue'))
413	{
414		var strTreeValue = target.getAttribute('data-treevalue');
415		var arTreeItem = strTreeValue.split('_');
416		if (this.SearchOfferPropIndex(arTreeItem[0], arTreeItem[1]))
417		{
418			var RowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false);
419			if (!!RowItems && 0 < RowItems.length)
420			{
421				for (i = 0; i < RowItems.length; i++)
422				{
423					value = RowItems[i].getAttribute('data-onevalue');
424					if (value == arTreeItem[1])
425						BX.addClass(RowItems[i], 'bx_active');
426					else
427						BX.removeClass(RowItems[i], 'bx_active');
428				}
429			}
430		}
431	}
432};
433
434JCCatalogSection.prototype.SearchOfferPropIndex = function(strPropID, strPropValue)
435{
436	var index = -1;
437	for (var i = 0; i < this.treeProps.length; i++)
438	{
439		if (this.treeProps[i].ID == strPropID)
440		{
441			index = i;
442			break;
443		}
444	}
445
446	if (-1 < index)
447	{
448		var arFilter = {};
449		for (i = 0; i < index; i++)
450		{
451			var strName = 'PROP_'+this.treeProps[i].ID;
452			arFilter[strName] = this.selectedValues[strName];
453		}
454		var strName = 'PROP_'+this.treeProps[index].ID;
455		var arShowValues = this.GetRowValues(arFilter, strName);
456		if (!arShowValues)
457			return false;
458		if (!BX.util.in_array(strPropValue, arShowValues))
459			return false;
460		arFilter[strName] = strPropValue;
461		for (i = index+1; i < this.treeProps.length; i++)
462		{
463			strName = 'PROP_'+this.treeProps[i].ID;
464			var arShowValues = this.GetRowValues(arFilter, strName);
465			if (!arShowValues)
466				return false;
467			if (this.showAbsent)
468			{
469				var arCanBuyValues = [];
470				var tmpFilter = []; 
471				tmpFilter = BX.clone(arFilter, true);
472				for (var j = 0; j < arShowValues.length; j++)
473				{
474					tmpFilter[strName] = arShowValues[j];
475					if (this.GetCanBuy(tmpFilter))
476						arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
477				}
478			}
479			else
480			{
481				var arCanBuyValues = arShowValues;
482			}
483			if (!!this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arC
483anBuyValues))
484				arFilter[strName] = this.selectedValues[strName];
485			else
486				arFilter[strName] = arCanBuyValues[0];
487			this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
488		}
489		this.selectedValues = arFilter;
490		this.ChangeInfo();
491	}
492	return true;
493};
494
495JCCatalogSection.prototype.RowLeft = function(e)
496{
497	if (!e) e = window.event;
498	var target = BX.proxy_context;
499	if (!!target && target.hasAttribute('data-treevalue'))
500	{
501		var strTreeValue = target.getAttribute('data-treevalue');
502		var index = -1;
503		for (var i = 0; i < this.treeProps.length; i++)
504		{
505			if (this.treeProps[i].ID == strTreeValue)
506			{
507				index = i;
508				break;
509			}
510		}
511		if (-1 < index && 5 < this.showCount[index])
512		{
513			if ((5 - this.showStart[index]) < this.showCount[index])
514			{
515				this.showStart[index]--;
516				BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
517			}
518		}
519	}
520};
521
522JCCatalogSection.prototype.RowRight = function(e)
523{
524	if (!e) e = window.event;
525	var target = BX.proxy_context;
526	if (!!target && target.hasAttribute('data-treevalue'))
527	{
528		var strTreeValue = target.getAttribute('data-treevalue');
529		var index = -1;
530		for (var i = 0; i < this.treeProps.length; i++)
531		{
532			if (this.treeProps[i].ID == strTreeValue)
533			{
534				index = i;
535				break;
536			}
537		}
538		if (-1 < index && 5 < this.showCount[index])
539		{
540			if (0 > this.showStart[index])
541			{
542				this.showStart[index]++;
543				BX.adjust(this.obTreeRows[index].LIST, { style: { marginLeft: this.showStart[index]*20+'%' }});
544			}
545		}
546	}
547};
548
549JCCatalogSection.prototype.UpdateRow = function(intNumber, activeID, showID, canBuyID)
550{
551	var i = 0;
552	var value;
553	var countShow = 0;
554	var strNewLen = '';
555	if (-1 < intNumber && intNumber < this.obTreeRows.length)
556	{
557		var RowItems = BX.findChildren(this.obTreeRows[intNumber].LIST, {tagName: 'li'}, false);
558		if (!!RowItems && 0 < RowItems.length)
559		{
560			countShow = showID.length;
561			strNewLen = (5 < countShow ? (100/countShow)+'%' : '20%');
562			obData = {
563				props: { className: '' },
564				style: {
565					width: strNewLen
566				}
567			};
568			if ('E' == this.treeProps[intNumber].TYPE)
569				obData.style.paddingTop = strNewLen;
570			for (i = 0; i < RowItems.length; i++)
571			{
572				value = RowItems[i].getAttribute('data-onevalue');
573				if (BX.util.in_array(value, canBuyID))
574				{
575					if (value == activeID)
576						obData.props.className = 'bx_active';
577					else
578						obData.props.className = '';
579				}
580				else
581				{
582					if (value == activeID)
583						obData.props.className = 'bx_active bx_missing';
584					else
585						obData.props.className = 'bx_missing';
586				}
587				if (BX.util.in_array(value, showID))
588					obData.style.display = '';
589				else
590					obData.style.display = 'none';
591				BX.adjust(RowItems[i], obData);					
592			}
593			obData = {
594				style: {
595					width: (5 < countShow ? 20*countShow : 100)+'%',
596					marginLeft: '0%'
597				} 
598			};
599			BX.adjust(this.obTreeRows[intNumber].LIST, obData);
600			if ('E' == this.treeProps[intNumber].TYPE)
601				BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (5 < countShow ? 'bx_item_detail_scu full' : 'bx_item_detail_scu')}});
602			else
603				BX.adjust(this.obTreeRows[intNumber].CONT, {props: {className: (5 < countShow ? 'bx_item_detail_size full' : 'bx_item_detail_size')}});
604			if (5 < countShow)
605			{
606				BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: ''}});
607				BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: ''}});
608			}
609			else
610			{
611				BX.adjust(this.obTreeRows[intNumber].LEFT, {style: {display: 'none'}});
612				BX.adjust(this.obTreeRows[intNumber].RIGHT, {style: {display: 'none'}});				
613			}
614			this.showCount[intNumber] = countShow;
615			this.showStart[intNumber] = 0;
616		}
617	}
618};
619
620JCCatalogSection.prototype.GetRowValues = function(arFilter, index)
621{
622	var arValues = [];
623	var boolSearch = false;
624	if (0 == arFilter.length)
625	{
626		for (var i = 0; i < this.offers.length; i++)
627		{
628			if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
629				arValues[arValues.length] = this.offers[i].TREE[index];
630		}
631		boolSearch = true;
632	}
633	else
634	{
635		for (var i = 0; i < this.offers.length; i++)
636		{
637			var boolOneSearch = true;
638			for (var j in arFilter)
639			{
640				if (arFilter[j] != this.offers[i].TREE[j])
641				{
642					boolOneSearch = false;
643					break;
644				}
645			}
646			if (boolOneSearch)
647			{
648				if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
649					arValues[arValues.length] = this.offers[i].TREE[index];
650				boolSearch = true;
651			}
652		}
653	}
654	return (boolSearch ? arValues : false);
655};
656
657JCCatalogSection.prototype.GetCanBuy = function(arFilter)
658{
659	var boolSearch = false;
660	for (var i = 0; i < this.offers.length; i++)
661	{
662		var boolOneSearch = true;
663		for (var j in arFilter)
664		{
665			if (arFilter[j] != this.offers[i].TREE[j])
666			{
667				boolOneSearch = false;
668				break;
669			}
670		}
671		if (boolOneSearch)
672		{
673			if (this.offers[i].CAN_BUY)
674			{
675				boolSearch = true;
676				break;
677			}
678		}
679	}
680	return boolSearch;
681};
682
683JCCatalogSection.prototype.SetCurrent = function()
684{
685	var arFilter = {};
686	var current = this.offers[this.offerNum].TREE;
687	for (var i = 0; i < this.treeProps.length; i++)
688	{
689		var strName = 'PROP_'+this.treeProps[i].ID;
690		var arShowValues = this.GetRowValues(arFilter, strName);
691		if (!arShowValues)
692			break;
693		if (BX.util.in_array(current[strName], arShowValues))
694		{
695			arFilter[strName] = current[strName];
696		}
697		else
698		{
699			arFilter[strName] = arShowValues[0];
700			this.offerNum = 0;
701		}
702		if (this.showAbsent)
703		{
704			var arCanBuyValues = [];
705			var tmpFilter = []; 
706			tmpFilter = BX.clone(arFilter, true);
707			for (var j = 0; j < arShowValues.length; j++)
708			{
709				tmpFilter[strName] = arShowValues[j];
710				if (this.GetCanBuy(tmpFilter))
711					arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
712			}
713		}
714		else
715		{
716			var arCanBuyValues = arShowValues;
717		}
718		this.UpdateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
719	}
720	this.selectedValues = arFilter;
721	this.ChangeInfo();
722};
723
724JCCatalogSection.prototype.ChangeInfo = function()
725{
726	var index = -1;
727	for (var i = 0; i < this.offers.length; i++)
728	{
729		var boolOneSearch = true;
730		for (var j in this.selectedValues)
731		{
732			if (this.selectedValues[j] != this.offers[i].TREE[j])
733			{
734				boolOneSearch = false;
735				break;
736			}
737		}
738		if (boolOneSearch)
739		{
740			index = i;
741			break;
742		}
743	}
744	if (-1 < index)
745	{
746		if (!!this.obPict)
747		{	
748			if (!!this.offers[index].PREVIEW_PICTURE)
749				BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}});
750			else
751				BX.adjust(this.obPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}});
752		}
753		if (this.secondPict && !!this.obSecondPict)
754		{
755			if (!!this.offers[index].PREVIEW_PICTURE_SECOND)
756				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE_SECOND.SRC+')'}});
757			else if (!!this.offers[index].PREVIEW_PICTURE.SRC)
758				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.offers[index].PREVIEW_PICTURE.SRC+')'}});
759			else if (!!this.defaultPict.secondPict)
760				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.secondPict.SRC+')'}});
761			else
762				BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url('+this.defaultPict.pict.SRC+')'}});
763		}
764		if (this.showSkuProps && !!this.obSkuProps)
765		{
766			if (0 == this.offers[index].DISPLAY_PROPERTIES.length)
767			{
768				BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''});
769			}
770			else
771			{
772				BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES});
773			}
774		}
775		if (!!this.obPrice)
776		{
777			var strPrice = this.offers[index].PRICE.PRINT_DISCOUNT_VALUE;
778			if (this.showOldPrice && (this.offers[index].PRICE.DISCOUNT_VALUE != this.offers[index].PRICE.VALUE))
779				strPrice += ' <span>'+this.offers[index].PRICE.PRINT_VALUE+'</span>';
780			BX.adjust(this.obPrice, {html: strPrice});
781			if (this.showPercent)
782			{
783				if (this.offers[index].PRICE.DISCOUNT_VALUE != this.offers[index].PRICE.VALUE)
784				{
785					var obData = {
786						style: {
787							display: ''
788						},
789						html: this.offers[index].PRICE.DISCOUNT_DIFF_PERCENT
790					};
791				}
792				else
793				{
794					var obData = {
795						style: {
796							display: 'none'
797						},
798						html: ''
799					};
800				}
801				if (!!this.obDscPerc)
802					BX.adjust(this.obDscPerc, obData);
803				if (!!this.obSecondDscPerc)
804					BX.adjust(this.obSecondDscPerc, obData);
805			}
806		}
807		this.offerNum = index;
808		if (this.showQuantity)
809		{
810			this.QuantitySet(this.offerNum);
811		}
812	}
813};
814
815JCCatalogSection.prototype.Basket = function()
816{
817	if (!this.canBuy)
818		return;
819	var ajaxParams = {
820		sessid: BX.bitrix_sessid(),
821		action: 'ADD2BASKET',
822		ajax_basket: 'Y'
823	};
824	switch (this.productType)
825	{
826	case 1://product
827	case 2://set
828		ajaxParams.id = this.product.id;
829		if (this.showQuantity)
830			ajaxParams.quantity = this.obQuantity.value;
831		break;
832	case 3://sku
833		ajaxParams.id = this.offers[this.offerNum].ID;
834		if (this.showQuantity)
835			ajaxParams.quantity = this.obQuantity.value;
836		break;
837	default:
838		return;
839	}
840	BX.ajax.loadJSON(
841		this.ajaxPath,
842		ajaxParams,
843		BX.delegate(this.ShowBasketPopup, this)
844	);
845};
846
847JCCatalogSection.prototype.ShowBasketPopup = function(arResult)
848{
849	var strContent = '';
850	if ('object' == typeof(arResult))
851	{
852		if ('OK' == arResult.STATUS)
853		{
854			strName = '';
855			strPict = '';
856			switch(this.productType)
857			{
858			case 1://
859			case 2://
860				strName = this.product.name;
861				strPict = this.product.pict.SRC;
862				break;
863			case 3:
864				strName = this.offers[this.offerNum].NAME;
865				strPict = this.offers[this.offerNum].PREVIEW_PICTURE.SRC;
866				break;
867			}
868			strContent = '<p>'+BX.message('ADD_TO_BASKET_OK')+'</p>';
869			strContent += '<img src="'+strPict+'" height="130"><p>
869'+strName+'</p>';
870		}
871		else
872		{
873			
874		}
875	}
876	else
877	{
878		
879	}
880
881    var popup = BX.PopupWindowManager.create('CatalogSectionBasket'+this.visual.ID, null, {
882        autoHide: false,
883        //    zIndex: 0,
884        offsetLeft: 0,
885        offsetTop: 0,
886        overlay : true,
887        draggable: {restrict:true},
888        closeByEsc: true,
889        closeIcon: { right : "12px", top : "10px"},
890        content: '' +
891            '<div style="width:300px;text-align: center;padding-top:5px; margin-bottom: 10px;">' +
892            strContent+
893            '<a class="bx_bt_blue bx_medium" href="'+BX.message("setButtonBuyUrl")+'"><span class="bx_icon_cart"></span><span>'+BX.message("setButtonBuyName")+'</span></a>'+
894            '</div>'
895	    });
896
897    popup.show();
898};

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.