PageSourceSearch

https://polimer-group.com/bitrix/templates/aspro_max/components/aspro/tabs.max/main/script.js

js polimer-group.com collected 2026-10-04 18:31:02 UTC 8,744 bytes, 287 lines download raw bytes

1$(document).ready(function(){
2	if(!('SelectOfferProp' in window) && typeof window.SelectOfferProp != 'function')
3	{
4		SelectOfferProp = function(){
5			// return false;
6			var _this = $(this),
7				obParams = {},
8				obSelect = {},
9				objUrl = parseUrlQuery(),
10				add_url = '',
11				container = _this.closest('.bx_catalog_item_scu');
12
13			/* request params */
14			obParams = {
15				'PARAMS': _this.closest('.js_wrapper_items').data('params'),
16				'ID': container.data('offer_id'),
17				'SITE_ID': container.data('site_id'),
18				'LINK_ID': container.data('id')+'_'+_this.closest('.tab').data('code'),
19				'IBLOCK_ID': container.data('offer_iblockid'),
20				'PROPERTY_ID': container.data('propertyid'),
21				'DEPTH': _this.closest('.item_wrapper').index(),
22				'VALUE': _this.data('onevalue'),
23				'CLASS': 'inner_content',
24				'PICTURE': _this.closest('.catalog_item_wrapp').find('.thumb img').attr('src'),
25				'ARTICLE_NAME': _this.closest('.catalog_item_wrapp').find('.article_block').data('name'),
26				'ARTICLE_VALUE': _this.closest('.catalog_item_wrapp').find('.article_block').data('value'),
27			}
28			/**/
29
30			if("clear_cache" in objUrl)
31			{
32				if(objUrl.clear_cache == "Y")
33					add_url += "?clear_cache=Y";
34			}
35
36			/* save selected values */
37			for (i = 0; i < obParams.DEPTH+1; i++)
38			{
39				strName = 'PROP_'+container.find('.item_wrapper:eq('+i+') > div').data('id');
40				obSelect[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
41				obParams[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
42			}
43
44			// obParams.SELECTED = JSON.stringify(obSelect);
45			/**/
46			
47			_this.siblings().removeClass('active');
48			_this.addClass('active');
49
50			if(_this.attr('title'))
51			{
52				_this.closest('.item_wrapper').find('.show_class span').text(_this.attr('title'))
53			}
54			else
55			{
56				var img_row = _this.find(' > i');
57				if(img_row.length && img_row.attr('title'))
58					_this.closest('.item_wrapper').find('.show_class span').text(img_row.attr('title'))
59			}
60
61			/* get sku */
62			$.ajax({
63				url: arMaxOptions['SITE_DIR']+'ajax/js_item_detail.php'+add_url,
64				type: 'POST',
65				data: obParams,
66			}).success(function(html){
67				var ob = BX.processHTML(html);BX.ajax.processScripts(ob.SCRIPT);
68			})
69		}
70		$(document).on('click', '.bx_catalog_item_scu li.item', SelectOfferProp)
71	}
72
73	window.tabsInitOnReady = function() {
74		$('.tabs_wrapper').scrollTab({
75			tabs_wrapper: '.tabs.ajax',
76			arrows_css: {
77				'top': '-1px',
78			},
79			width_grow: 3,
80			onResize: function(options) {
81				var top_wrapper = options.scrollTab.closest('.top_block');
82				if(top_wrapper.length) {
83					var tabs_wrapper = top_wrapper.find('.right_block_wrapper .tabs_wrapper');
84
85					if(window.matchMedia('(max-width: 767px)').matches){
86						tabs_wrapper.css({
87							'width': '100%',
88							'max-width': '',
89						});
90						return true;
91					}
92
93					var title = top_wrapper.find('h3');
94					var right_link = top_wrapper.find('.right_block_wrapper > a');
95					var all_width = top_wrapper[0].getBoundingClientRect().width;
96
97					if(title.length) {
98						all_width -= title.outerWidth(true);
99					}
100
101					if(right_link.length) {
102						all_width -= right_link.outerWidth(true);
103					}
104
105					all_width -= Number.parseInt(tabs_wrapper.css('margin-right'));
106
107					tabs_wrapper.css({
108						'max-width': all_width,
109						'width': '',
110					});
111				}
112				options.width = all_width;
113			}
114		});
115
116		var container = $('.content_wrapper_block.main');
117		if(container.length) {
118			var curTab = container.find('.tabs_content li.cur');
119			if(curTab.length) {
120				var bNav = curTab.find('.bottom_nav .module-pagination').length > 0;
121				if(bNav) {
122					container.removeClass('without-border');
123				} else {
124					container.addClass('without-border');
125				}
126			}
127		}
128	}
129	
130});
131
132if (!window.JCCatalogSectionOnlyElement)
133{
134
135	window.JCCatalogSectionOnlyElement = function (arParams)
136	{
137		if (typeof arParams === 'object')
138		{
139			this.params = arParams;
140
141			this.obProduct = null;
142			this.set_quantity = 1;
143
144			this.currentPriceMode = '';
145			this.currentPrices = [];
146			this.currentPriceSelected = 0;
147			this.currentQuantityRanges = [];
148			this.currentQuantityRangeSelected = 0;
149
150			if (this.params.MESS)
151			{
152				this.mess = this.params.MESS;
153			}
154
155			this.init();
156		}
157	}
158	window.JCCatalogSectionOnlyElement.prototype = {
159		init: function()
160		{
161			var i = 0,
162				j = 0,
163				treeItems = null;
164
165			this.obProduct = BX(this.params.ID);
166
167			if(!!this.obProduct)
168			{
169				$(this.obProduct).find('.counter_wrapp .counter_block input').data('product', 'ob'+this.obProduct.id+'el');
170				this.currentPriceMode = this.params.ITEM_PRICE_MODE;
171				this.currentPrices = this.params.ITEM_PRICES;
172				this.currentQuantityRanges = this.params.ITEM_QUANTITY_RANGES;
173			}
174
175		},
176
177		setPriceAction: function()
178		{
179			this.set_quantity = this.params.MIN_QUANTITY_BUY;			
180			if($(this.obProduct).find('input[name=quantity]').length)
181				this.set_quantity = $(this.obProduct).find('input[name=quantity]').val();
182			
183			this.checkPriceRange(this.set_quantity);
184
185			$(this.obProduct).find('.not_matrix').hide();
186			$(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));
187
188			if($(this.obProduct).find('.with_matrix .discount'))
189			{
190				$(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));
191			}
192
193			if(this.params.SHOW_DISCOUNT_PERCENT_NUMBER == 'Y')
194			{
195				if(this.currentPrices[this.currentPriceSelected].PERCENT > 0 && this.currentPrices[this.currentPriceSelected].PERCENT < 100)
196				{
197					if(!$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').length)
198						$('<div class="value"></div>').insertBefore($(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .text'));
199
200					$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').html('-<span>'+this.currentPrices[this.currentPriceSelected].PERCENT+'</span>%');
201				}
202				else
203				{
204					if($(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').length)
205						$(this.obProduct).find('.with_matrix .sale_block .sale_wrapper .value').remove();
206				}
207			}
208			$(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));
209			
210			if('NOT_SHOW' in this.params && this.params.NOT_SHOW != 'Y')
211				$(this.obProduct).find('.with_matrix').show();			
212
213			if(arMaxOptions['THEME']['SHOW_TOTAL_SUMM'] == 'Y')
214			{
215				if(typeof this.currentPrices[this.currentPriceSelected] !== 'undefined')
216					setPriceItem($(this.obProduct), this.set_quantity, this.currentPrices[this.currentPriceSelected].PRICE);
217			}
218		},
219
220		checkPriceRange: function(quantity)
221		{
222			if (typeof quantity === 'undefined'|| this.currentPriceMode != 'Q')
223				return;
224
225			var range, found = false;
226			
227			for (var i in this.currentQuantityRanges)
228			{
229				if (this.currentQuantityRanges.hasOwnProperty(i))
230				{
231					range = this.currentQuantityRanges[i];
232
233					if (
234						parseInt(quantity) >= parseInt(range.SORT_FROM)
235						&& (
236							range.SORT_TO == 'INF'
237							|| parseInt(quantity) <= parseInt(range.SORT_TO)
238						)
239					)
240					{
241						found = true;
242						this.currentQuantityRangeSelected = range.HASH;
243						break;
244					}
245				}
246			}
247
248			if (!found && (range = this.getMinPriceRange()))
249			{
250				this.currentQuantityRangeSelected = range.HASH;
251			}
252
253			for (var k in this.currentPrices)
254			{
255				if (this.currentPrices.hasOwnProperty(k))
256				{
257					if (this.currentPrices[k].QUANTITY_HASH == this.currentQuantityRangeSelected)
258					{
259						this.currentPriceSelected = k;
260						break;
261					}
262				}
263			}
264		},
265
266		getMinPriceRange: function()
267		{
268			var range;
269
270			for (var i in this.currentQuantityRanges)
271			{
272				if (this.currentQuantityRanges.hasOwnProperty(i))
273				{
274					if (
275						!range
276						|| parseInt(this.currentQuantityRanges[i].SORT_FROM) < parseInt(range.SORT_FROM)
277					)
278					{
279						range = this.currentQuantityRanges[i];
280					}
281				}
282			}
283
284			return range;
285		}
286	}
287}

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.