PageSourceSearch

http://malyar.kz/local/templates/aspro_max/components/bitrix/catal…/catalog_block/script.js?17114458354847

js malyar.kz collected 2026-09-28 22:58:26 UTC 4,847 bytes, 165 lines download raw bytes

1if(!funcDefined("sliceItemBlock")){
2	sliceItemBlock = function(){}
3}
4if(!funcDefined("sliceItemBlockSlide")){
5	sliceItemBlockSlide = function(options){}
6}
7
8(function (window) {
9if (!window.JCCatalogSectionOnlyElement)
10{
11
12	window.JCCatalogSectionOnlyElement = function (arParams)
13	{
14		if (typeof arParams === 'object')
15		{
16			this.params = arParams;
17
18			this.obProduct = null;
19			this.set_quantity = 1;
20
21			this.currentPriceMode = '';
22			this.currentPrices = [];
23			this.currentPriceSelected = 0;
24			this.currentQuantityRanges = [];
25			this.currentQuantityRangeSelected = 0;
26
27			if (this.params.MESS)
28			{
29				this.mess = this.params.MESS;
30			}
31
32			this.init();
33		}
34	}
35	window.JCCatalogSectionOnlyElement.prototype = {
36		init: function()
37		{
38			var i = 0,
39				j = 0,
40				treeItems = null;
41
42			this.obProduct = BX(this.params.ID);
43
44			if(!!this.obProduct)
45			{
46				$(this.obProduct).find('.counter_wrapp .counter_block input').data('product', 'ob'+this.obProduct.id+'el');
47				this.currentPriceMode = this.params.ITEM_PRICE_MODE;
48				this.currentPrices = this.params.ITEM_PRICES;
49				this.currentQuantityRanges = this.params.ITEM_QUANTITY_RANGES;
50			}
51
52		},
53
54		setPriceAction: function()
55		{
56			this.set_quantity = this.params.MIN_QUANTITY_BUY;			
57			if($(this.obProduct).find('input[name=quantity]').length)
58				this.set_quantity = $(this.obProduct).find('input[name=quantity]').val();
59			
60			this.checkPriceRange(this.set_quantity);
61
62			$(this.obProduct).find('.not_matrix').hide();
63			$(this.obProduct).find('.with_matrix .price_value_block').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].PRICE, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_PRICE));
64
65			if($(this.obProduct).find('.with_matrix .discount'))
66			{
67				$(this.obProduct).find('.with_matrix .discount').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].BASE_PRICE, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_BASE_PRICE));
68			}
69
70			if(this.params.SHOW_DISCOUNT_PERCENT_NUMBER == 'Y')
71			{
72				if(this.currentPrices[this.currentPriceSelected].PERCENT > 0 && this.currentPrices[this.currentPriceSelected].PERCENT < 100)
73				{
74					if(!$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').length)
75						$('<div class="value"></div>').insertBefore($(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .text'));
76
77					$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').html('-<span>'+this.currentPrices[this.currentPriceSelected].PERCENT+'</span>%');
78				}
79				else
80				{
81					if($(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').length)
82						$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').remove();
83				}
84			}
85			$(this.obProduct).find('.with_matrix .sale_block .text .values_wrapper').html(getCurrentPrice(this.currentPrices[this.currentPriceSelected].DISCOUNT, this.currentPrices[this.currentPriceSelected].CURRENCY, this.currentPrices[this.currentPriceSelected].PRINT_DISCOUNT));
86			
87			if('NOT_SHOW' in this.params && this.params.NOT_SHOW != 'Y')
88				$(this.obProduct).find('.with_matrix').show();			
89
90			if(arMaxOptions['THEME']['SHOW_TOTAL_SUMM'] == 'Y')
91			{
92				if(typeof this.currentPrices[this.currentPriceSelected] !== 'undefined')
93					setPriceItem($(this.obProduct), this.set_quantity, this.currentPrices[this.currentPriceSelected].PRICE);
94			}
95		},
96
97		checkPriceRange: function(quantity)
98		{
99			if (typeof quantity === 'undefined'|| this.currentPriceMode != 'Q')
100				return;
101
102			var range, found = false;
103			
104			for (var i in this.currentQuantityRanges)
105			{
106				if (this.currentQuantityRanges.hasOwnProperty(i))
107				{
108					range = this.currentQuantityRanges[i];
109
110					if (
111						parseInt(quantity) >= parseInt(range.SORT_FROM)
112						&& (
113							range.SORT_TO == 'INF'
114							|| parseInt(quantity) <= parseInt(range.SORT_TO)
115						)
116					)
117					{
118						found = true;
119						this.currentQuantityRangeSelected = range.HASH;
120						break;
121					}
122				}
123			}
124
125			if (!found && (range = this.getMinPriceRange()))
126			{
127				this.currentQuantityRangeSelected = range.HASH;
128			}
129
130			for (var k in this.currentPrices)
131			{
132				if (this.currentPrices.hasOwnProperty(k))
133				{
134					if (this.currentPrices[k].QUANTITY_HASH == this.currentQuantityRangeSelected)
135					{
136						this.currentPriceSelected = k;
137						break;
138					}
139				}
140			}
141		},
142
143		getMinPriceRange: function()
144		{
145			var range;
146
147			for (var i in this.currentQuantityRanges)
148			{
149				if (this.currentQuantityRanges.hasOwnProperty(i))
150				{
151					if (
152						!range
153						|| parseInt(this.currentQuantityRanges[i].SORT_FROM) < parseInt(range.SORT_FROM)
154					)
155					{
156						range = this.currentQuantityRanges[i];
157					}
158				}
159			}
160
161			return range;
162		}
163	}
164}
165})(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.