PageSourceSearch

https://psp.ru/local/templates/psp/script.js

js psp.ru collected 2026-10-06 20:27:33 UTC 10,359 bytes, 325 lines download raw bytes

1$(function() {
2	$('.toggle-sidebar').on('click', function() {
3		$('.sidebar-area').toggleClass('active');
4		$('.page-area').toggleClass('toggled');
5		$('.sidebar-overlay').toggleClass('active');
6
7		var ovWidth = window.innerWidth - $('.sidebar-area').width();
8		$('.sidebar-overlay').css('width', ovWidth);
9	});
10
11	$('.sidebar-overlay, .hide-sidebar').on('click', function() {
12		if ($('.sidebar-area').hasClass('active')) {
13			$('.sidebar-area').toggleClass('active');
14			$('.page-area').toggleClass('toggled');
15			$('.sidebar-overlay').toggleClass('active');
16			$('.sidebar-overlay').css('width', 0);
17	        $('.sidebar-layer').removeClass('active');
18		}
19	});
20
21	$('.sidebar-area .parent>a.item').on('click', function(e) {
22		e.preventDefault();
23		$(this).parents('li').find('.collapse').collapse('toggle');
24	});
25});
26
27function ifaceInit(context) {
28	if (context) {
29		$parent_node = $(context);
30	}
31	else $parent_node = $('body');
32
33	// bind add2basket
34	$parent_node.find("a[href*='action=ADD2BASKET']").off('click', ajaxBuy).on('click', ajaxBuy);
35
36	// selectpicker
37	if (!$('html').hasClass('bx-ie8')) $parent_node.find('.page-area select:not(.noselect):visible').selectpicker();
38
39	// spinner
40	$parent_node.find('input[type=number]').each(function() {
41		var min = $(this).prop('min')?$(this).prop('min'):0;
42		var max = $(this).prop('max')?$(this).prop('max'):10000;
43		$(this).TouchSpin({
44			verticalbuttons: true,
45			min: min,
46			max: max,
47			verticalupclass: 'fa fa-chevron-up',
48			verticaldownclass: 'fa fa-chevron-down'
49		});
50		$(this).prop('type', 'text')
51	});
52
53	// icheck
54	$parent_node.find('input[type=checkbox]:visible, input[type=radio]:visible').not(".no-style")
55		.iCheck({
56			checkboxClass: 'icheckbox icheckbox-fa',
57			radioClass: 'icheckbox iradio-fa',
58			insert: '<i class="icon"></i>'
59		});
60	$parent_node.find('input[type=checkbox]:visible, input[type=radio]:visible').not(".no-style")
61		.on('ifCreated ifClicked ifChanged ifChecked ifUnchecked ifDisabled ifEnabled ifDestroyed check', function(event){
62			if(event.type === "ifClicked"){
63				$(this).trigger('click');  
64				$('input').iCheck('update');
65			}
66			if(event.type === "ifChanged"){
67				if ($(this).prop("checked")) {
68					$(this).trigger('change');  
69					$('input').iCheck('update');
70				}
71			}
72		})
73}
74
75function jcarouselInit() {
76	$('[data-jcarousel]').each(function() {
77		var $jcarousel = $(this);
78		function jcarouselResponsiveElements(event) {
79			if (event.type == 'jcarousel:reloadend' && $('html').hasClass('bx-ie8')) $(this).off('jcarousel:reloadend', jcarouselResponsiveElements);
80
81			$jcarousel_list = $jcarousel.jcarousel('list');
82			$jcarousel_list.css('width', 'auto');
83			$jcarousel.jcarousel('items').css('width', '');
84
85			if ($jcarousel.hasClass('JOYWIN-4COLS')) {
86				var $item = $jcarousel.jcarousel('items').first();
87				var box = $item.outerWidth(true) - $item.width();
88				new_width = Math.floor($jcarousel.width() / 4) - box - 1;
89			} else {
90				new_width = $jcarousel.jcarousel('items').width();
91				new_width = new_width - 1;
92			}
93
94			$jcarousel.jcarousel('items').width(new_width);
95			$jcarousel_list.css('width', '20000em');
96		}
97
98        $jcarousel
99            .on('jcarousel:reloadend jcarousel:create', jcarouselResponsiveElements)
100            .on('jcarousel:createend', function () {
101				count = Math.round($jcarousel.width() / $jcarousel.jcarousel('items').outerWidth());
102				$jcarousel.find('.navigation .right')
103					.jcarouselControl({
104						carousel: $jcarousel,
105						target: '+='+count
106					});
107				$jcarousel.find('.navigation .left')
108					.jcarouselControl({
109						carousel: $jcarousel,
110						target: '-='+count
111					});
112				$jcarousel.find('.navigation .carousel-indicators')
113					.on('jcarouselpagination:active', 'li', function() { $(this).addClass('active'); })
114					.on('jcarouselpagination:inactive', 'li', function() { $(this).removeClass('active'); })
115					.jcarouselPagination({
116						carousel: $jcarousel,
117						perPage: count,
118						item: function(page, carouselItems) {
119							return '<li class="bg-primary" href="#' + page + '"></li>';
120						}
121					});
122
123				if ($jcarousel.jcarousel('items').length > count)
124					$jcarousel.find('.navigation').show();
125				else
126					$jcarousel.find('.navigation').hide();
127			})
128            .on('jcarousel:reloadend', function (event) {
129				count = Math.round($jcarousel.width() / $jcarousel.jcarousel('items').outerWidth());
130				$jcarousel.find('.navigation .carousel-indicators').jcarouselPagination('reload', { 'perPage': count });
131				$jcarousel.find('.navigation .right').jcarouselControl('reload', { target: '+='+count });
132			})
133            .jcarousel($jcarousel.data());
134	});
135}
136
137function ajaxBuy(e) {
138	var params = {};
139	if (this.tagName == 'A') {
140		params = {
141			url: $(this).attr('href') + '&ajax_buy=y',
142			type: "GET"
143		}
144		e.preventDefault();
145	}
146	else if(this.tagName == 'FORM') {
147		if (!$(this).find('input[type=file]').val()) {
148			var url = $(this).attr('action') || window.location.pathname;
149			//url += (url.indexOf("?") != -1) ? '&ajax_buy=y' : '?ajax_buy=y';
150			params = {
151				url:  url,
152				type: "GET",
153				data: $(this).serialize() + '&ajax_buy=y'
154			}
155			e.preventDefault();
156		}
157		else 
158			return true;
159	}
160	else {
161		return 1;
162	}
163
164	$.ajax(params).done(function(data) {
165		cart_array = data.split('<!--cut-->');
166
167		$("#cart").replaceWith(cart_array[0]);
168
169		$('#buy-modal .modal-body').html(cart_array[1]);
170		$('#buy-modal').modal();
171	});
172}
173
174$(document).ready(function() {
175	$('.catalog-list.catalog-section').not('.carousel').css('min-height', function() {
176		return $(this).height();
177	});
178
179	ifaceInit();
180	jcarouselInit();
181        
182        jqmPopup('callback', 'include/ajax/form.php?form_id=2');
183        jqmPopup('service', 'include/ajax/form.php?form_id=3');
184        
185        $("body").on('change', ".form-group.agreement [type='checkbox']", function () {
186
187            if ($(this).is(":checked"))
188                $(this).parents('form').find('[type="submit"], [name="web_form_apply"]').removeAttr('disabled');
189            else
190                $(this).parents('form').find('[type="submit"], [name="web_form_apply"]').attr('disabled', 'disabled');
191        });
192
193	var lastNodeInsert;
194	BX.addCustomEvent('onAjaxInsertToNode', function(param) {
195		lastNodeInsert = param['node'];
196	});
197
198	BX.addCustomEvent('onAjaxSuccess', function() {
199		ifaceInit(lastNodeInsert);
200		lastNodeInsert = '';
201	});
202
203	$(".detail-buy-form").submit(ajaxBuy);
204
205	$('textarea[maxlength]').each(function() {
206		$(this).maxlength({
207			max: $(this).prop('maxlength'),
208			feedbackText: '{c}/{m}',
209			feedbackTarget: $(this).next('.maxlength-feedback'),
210		});
211	});
212
213	$('.catalog-menu-wrap [data-toggle="description"]').hover(function() {
214		var selector = $(this).data('target');
215		if (selector) {
216			$(selector).siblings().hide();
217			$(selector).show();
218		}
219	});
220
221	$('[data-tab]').click(function() {
222            var selector = $(this).data('tab');
223            if (selector) { $(selector).tab('show'); }
224	});
225
226	$('.modal.in').modal({ 'show': true });
227});
228
229// last visit cookie
230//$.cookie(BX.message('COOKIE_PREFIX') + '_LAST_VISIT', ((new Date).getTime() / 1000), { expires: 365, path: '/' });
231
232function listAjaxPaging(options) {
233	list_id    		= options.list_id;
234	cur_page        = options.cur_page;
235	max_page        = options.max_page;
236	page_url        = options.page_url;
237	$list			= options.list;
238	scroll_wait     = false;
239
240	return function(){
241		scroll_top = $(document).scrollTop();//высота прокрученной области
242		page_height = $(document).height();//высота всей страницы
243		wind_height = $(window).height();
243//высота окна браузера
244		//если непрокрученной области больше чем высота окна обраузера, то подгружаем след. объекты
245		if(((page_height - scroll_top) < wind_height*4) && !scroll_wait && cur_page<max_page){
246			scroll_wait = true;
247			next_page=page_url+(++cur_page);
248
249			$list.parent().addClass('loading');
250			$.get(next_page,function(data) {
251				$list.append($(data).find('#'+list_id).html());
252				$list.parent().removeClass('loading');
253				scroll_wait = false;                                 
254			});
255		}
256	};
257}
258
259// siteheart
260/*(function(){
261var widget_id = 741929;
262_shcp =[{widget_id : widget_id}];
263var lang =(navigator.language || navigator.systemLanguage 
264|| navigator.userLanguage ||"en")
265.substr(0,2).toLowerCase();
266var url ="widget.siteheart.com/widget/sh/"+ widget_id +"/"+ lang +"/widget.js";
267var hcc = document.createElement("script");
268hcc.type ="text/javascript";
269hcc.async =true;
270hcc.src =("https:"== document.location.protocol ?"https":"http")
271+"://"+ url;
272var s = document.getElementsByTagName("script")[0];
273s.parentNode.insertBefore(hcc, s.nextSibling);
274})();*/
275
276
277//яндекс цели
278window.onload=function(){
279	$('#ORDER_PROP_3').on('change',yaCounter32375950.reachGoal('cel3'));
280	$('#COUNTRYORDER_PROP_27').on('change',yaCounter32375950.reachGoal('cel4'));
281}
282// выравнивание каталога на главной странице
283$(function() {
284	var itemHeight = $('#catalogItemCustomHeight').data('height');
285	var itemSelector = $('#catalogItemCustomHeight').data('selector');
286	console.log(itemHeight, itemSelector);
287	console.log($(itemSelector));
288	$.each($(itemSelector), function(i, elem) {
289		$(elem).css('height', parseInt(itemHeight));
290	});
291});
292
293$(function() {
294	$('.open-main-menu').on('click', function() {
295		$('.catalog-menu-bg.navbar.navbar-default').slideToggle();
296	});
297});
298
299function alignLatalogItems() {
300	// console.log('HERERERE');
301	setTimeout(function() {
302	    var maxAdvHeight = 0;
303	    $.each($('.catalog-section .catalog-item:not(.catalog-section.no-latalong .catalog-item)'), function(i, product) {
304            $(product).css('height', 'initial');
305	    });
306
307	    $.each($('.catalog-section .catalog-item:not(.catalog-section.no-latalong .catalog-item)'), function(i, product) {
308            if (maxAdvHeight < $(product).height()) {	
309                    maxAdvHeight = $(product).height();
310            }
311	    });
312
313	    $.each($('.catalog-section .catalog-item:not(.catalog-section.no-latalong .catalog-item)'), function(i, product) {
314            $(product).css('height', (maxAdvHeight + 15) + 'px');
315	    });
316	}, 1);
317}
318
319$(function() {
320	alignLatalogItems();
321});
322
323$(window).on("orientationchange", function(event) {
324  alignLatalogItems();
325});

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.