PageSourceSearch

https://softwareinc.ru/bitrix/templates/aspro-allcorp/js/general.js?178177167217748

js softwareinc.ru collected 2026-10-03 20:02:18 UTC 17,748 bytes, 573 lines download raw bytes

1(function($){
2	$.fn.equalizeHeights = function( outer ){
3		var maxHeight = this.map( function( i, e ){
4			$(e).css('height', 'inherit');
5			if( outer == true ){
6				return $(e).actual('outerHeight');
7			}else{
8				return $(e).actual('height');
9			}
10		}).get();
11		return this.height( Math.max.apply( this, maxHeight ) );
12	}
13
14	$.fn.sliceHeight = function( options ){
15		function _slice(el){
16			if( options.slice ){
17				for( var i = 0; i < el.length; i += options.slice ){
18					$(el.slice(i, i + options.slice)).equalizeHeights( options.outer );
19				}
20			}
21			if( options.lineheight ){
22				el.each(function() {
23					$(this).css("line-height", $(this).outerHeight() + "px");
24				});
25			}
26		}
27		
28		var options = $.extend({
29			slice: null,
30			outer: false,
31			lineheight: false
32		}, options);
33		var el = $(this);
34		_slice(el);
35		$(window).resize(function() {
36			_slice(el);
37		});
38	}
39})(jQuery);
40
41function onLoadjqm(hash){
42	var name = $(hash.t).data('name'), top = $(document).scrollTop() + (($(window).height() > hash.w.height()) ? ($(window).height() - hash.w.height()) / 2 : 0) + 'px';
43	$.each( $(hash.t).get(0).attributes, function( index, attr ){
44		if( /^data\-autoload\-(.+)$/.test( attr.nodeName ) ){
45			var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1];
46			var el = $('input[name="'+key.toUpperCase()+'"]');
47			el.val( $(hash.t).data('autoload-'+key) ).attr('readonly', 'readonly');
48			el.attr('title', el.val());
49		}
50	});
51	if($(hash.t).data('autohide')){
52		$(hash.w).data('autohide', $(hash.t).data('autohide'));
53	}
54	if(name == 'order_product'){
55		if($(hash.t).data('product')) {
56			$('input[name="PRODUCT"]').val($(hash.t).data('product')).attr('readonly', 'readonly').attr('title', $('input[name="PRODUCT"]').val());
57		}
58	}
59	if(name == 'question'){
60		if($(hash.t).data('product')) {
61			$('input[name="NEED_PRODUCT"]').val($(hash.t).data('product')).attr('readonly', 'readonly').attr('title', $('input[name="NEED_PRODUCT"]').val());
62		}
63	}
64	hash.w.addClass('show').css({'margin-left': '-' + hash.w.width() / 2+'px', 'top': top, 'opacity': 1});
65}
66
67function onHide(hash){
68	if($(hash.w).data('autohide')){
69		eval($(hash.w).data('autohide'));
70	}
71	hash.w.css('opacity', 0).hide();
72	hash.w.empty();
73	hash.o.remove();
74	hash.w.removeClass('show');
75}
76
77$.fn.jqmEx = function(){
78	$(this).each(function(){
79		var _this = $(this);
80		var name = _this.data('name');
81
82		if(name.length){
83			var script = arAllcorpOptions['SITE_DIR'] + "ajax/form.php";
84			var paramsStr = ''; var trigger = ''; var arTriggerAttrs = {};
85			$.each(_this.get(0).attributes, function(index, attr){
86				var attrName = attr.nodeName;
87				var attrValue = _this.attr(attrName);
88				trigger += '[' + attrName + '=\"' + attrValue + '\"]';
89				arTriggerAttrs[attrName] = attrValue;
90				if(/^data\-param\-(.+)$/.test(attrName)){
91					var key = attrName.match(/^data\-param\-(.+)$/)[1];
92					paramsStr += key + '=' + attrValue + '&';
93				}
94			});
95			
96			var triggerAttrs = JSON.stringify(arTriggerAttrs);
97			var encTriggerAttrs = encodeURIComponent(triggerAttrs);
98			script += '?' + paramsStr + 'data-trigger=' + encTriggerAttrs;
99								
100			if(!$('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').length){
101				if(_this.attr('disabled') != 'disabled'){
102					$('body').find('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').remove();
103					$('body').append('<div class="' + name + '_frame jqmWindow" style="width:500px" data-trigger="' + encTriggerAttrs + '"></div>');
104					$('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').jqm({trigger: trigger, onLoad: function(hash){onLoadjqm(hash);}, onHide: function(hash){onHide(hash);}, ajax:script});
105				}
106			}
107		}
108	})
109}
110
111function CheckTopMenuDotted(){
112	var menu = $('nav.mega-menu');
113	var menuMoreItem = menu.find('td.js-dropdown');
114	
115	if(menu.parents('.collapse').css('display') == 'none'){
116		return false;
117	}
118	
119	var block_w = menu.closest('div').width(); // width of closest block menu, without! padding and margin.
120	var	menu_w = menu.find('table').outerWidth(true); // width of menu with padding and margin.
121	var afterHide = false;
122	
123	while(menu_w > block_w) {
124		menuMoreItem.show();
125		menuItemOldSave = menu.find('td').not('.nosave').last();
126		menuItemNewSave = '<li class="' + (menuItemOldSave.hasClass('dropdown') ? 'dropdown-submenu ' : '') + (menuItemOldSave.hasClass('active') ? 'active ' : '') + '" data-hidewidth="' + menu_w + '">' + menuItemOldSave.find('.wrap').html() + '</li>';
127		menuItemOldSave.remove();
128		menuMoreItem.find('> .wrap > .dropdown-menu').prepend(menuItemNewSave);
129		menu_w = menu.find('table').outerWidth(true);
130		afterHide = true;
131	}
132
133	if(!afterHide) {
134		do {
135			var menuItemOldSaveCnt = menuMoreItem.find('.dropdown-menu').find('li').length;
136			menuItemOldSave = menuMoreItem.find('.dropdown-menu').find('li').first();
137			if(!menuItemOldSave.length) {
138				menuMoreItem.hide();
139				return false;
140			}
141			else {
142				var hideWidth = menuItemOldSave.attr('data-hidewidth');
143				if(hideWidth > block_w) {
144					return false;
145				}
146				else {
147					menuItemNewSave = '<td class="' + (menuItemOldSave.hasClass('dropdown-submenu') ? 'dropdown ' : '') + (menuItemOldSave.hasClass('active') ? 'active ' : '') + '" data-hidewidth="' + block_w + '"><div class="wrap">' + menuItemOldSave.html() + '</div></td>';
148					menuItemOldSave.remove();
149					$(menuItemNewSave).insertBefore(menu.find('td.js-dropdown'));
150					if(!menuItemOldSaveCnt) {
151						menuMoreItem.hide();
152						return false;
153					}
154				}
155			}
156			menu_w = menu.find('table').outerWidth(true);
157		}
158		while(menu_w <= block_w);
159	}
160	
161	return false;
162}
163
164function CheckTopVisibleMenu(that) {
165	var dropdownMenu = $(".dropdown-menu:visible").last();
166	if(dropdownMenu.length){
167		var isMenuType1 = arAllcorpOptions['THEME']['MENU'] = 'first';
168		dropdownMenu.find("a").css("white-space", "");
169		dropdownMenu.css("left", "");
170		dropdownMenu.css("right", "");
171		dropdownMenu.removeClass("toright");
172		if(isMenuType1){
173			dropdownMenu.css("margin-left", "");
174		}
175
176		var dropdownMenu_left = dropdownMenu.offset().left;
177		if(typeof(dropdownMenu_left) != "undefined"){
178			var menu = dropdownMenu.parents(".mega-menu");
179			var menu_width = menu.outerWidth();
180			var menu_left = menu.offset().left;
181			var menu_right = menu_left + menu_width;
182			var isToRight = dropdownMenu.parents(".toright").length > 0;
183			var parentsDropdownMenus = dropdownMenu.parents(".dropdown-menu");
184			var isHasParentDropdownMenu = parentsDropdownMenus.length > 0;
185			if(isHasParentDropdownMenu){
186				var parentDropdownMenu_width = parentsDropdownMenus.first().outerWidth();
187				var parentDropdownMenu_left = parentsDropdownMenus.first().offset().left;
188				var parentDropdownMenu_right = parentDropdownMenu_width + parentDropdownMenu_left;
189			}
190			var addleft = 0;
191
192			if(parentDropdownMenu_right + dropdownMenu.outerWidth() > menu_right){
193				dropdownMenu.find("a").css("white-space", "normal");
194			}
195			
196			if(isMenuType1 && !isHasParentDropdownMenu){
197				var punktMenu = dropdownMenu.parents("td");
198				if((dropdownMenu.outerWidth() < punktMenu.outerWidth()) || punktMenu.index() > 0){
199					//dropdownMenu.css("left", "50%");
200					//dropdownMenu.css("margin-left", "-" + Math.floor(dropdownMenu.outerWidth() / 2) + "px");
201					dropdownMenu_left = dropdownMenu.offset().left;
202				}
203			}
204			
205			var dropdownMenu_width = dropdownMenu.outerWidth();
206			var dropdownMenu_right = dropdownMenu_left + dropdownMenu_width;
207			
208			if(dropdownMenu_right > menu_right || isToRight){
209				addleft = menu_right - dropdownMenu_right;
210				if(isHasParentDropdownMenu || isToRight){
211					dropdownMenu.css("left", "auto");
212					dropdownMenu.css("right", "100%");
213					dropdownMenu.addClass("toright");
214				}
215				else{
216					var dropdownMenu_curLeft = parseInt(dropdownMenu.css("left"));
217					dropdownMenu.css("left", (dropdownMenu_curLeft + addleft) + "px");
218				}
219			}
220		}
221	}
222}
223
224$(window).resize(function(){
225	$('html.bx-no-touch .jqmWindow.show').css('top', $(document).scrollTop() + ( $(window).height() - $('.jqmWindow.show').height() ) / 2 + 'px');
226	CheckTopMenuDotted();
227	CheckTopVisibleMenu();
228});
229
230$(document).ready(function(){
231	CheckTopMenuDotted();
232	setTimeout(function() {$(window).resize();}, 350); // need to check resize flexslider & menu
233	
234	$.extend( $.validator.messages, {
235		required: BX.message("JS_REQUIRED"),
236		email: BX.message("JS_FORMAT"),
237		extension: BX.message("JS_FILE_EXT"),
238		equalTo: BX.message("JS_PASSWORD_COPY"),
239		minlength: BX.message("JS_PASSWORD_LENGTH"),
240		remote: BX.message("JS_ERROR"),
241		date: BX.message("JS_DATE_ERROR")
242	});
243	
244	$.validator.addMethod(
245		'regexp', function( value, element, regexp ){
246			var re = new RegExp( regexp );
247			return this.optional( element ) || re.test( value );
248		},
249		BX.message("JS_FORMAT")
250	);
251	
252	$.validator.addMethod(
253		'filesize', function( value, element, param ){
254			return this.optional( element ) || ( element.files[0].size <= param )
255		},
256		BX.message("JS_FILE_SIZE")
257	);
258	
259	$.validator.addMethod(
260          'captcha', function( value, element, params ){
261               return $.validator.methods.remote.call(this, value, element,{
262                    url: arAllcorpOptions['SITE_DIR'] + 'ajax/check-captcha.php',
263                    type: 'post',
264                    data:{
265                         captcha_word: value,
266                         captcha_sid: function(){
267                              return $(element).closest('.form-body').find('input[name="captcha_sid"]').val();
268                         }
269                    }
270               });
271          },
272		  BX.message("JS_ERROR")
273          
274     );
275	 
276	$.validator.addMethod(
277		"date", function( value, element, param ) {
278			var status = false;
279			if(!value || value.length <= 0){
280				status = false;
281			}
282			else{
283				var re = new RegExp("^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$");
284				var matches = re.exec(value);
285				if(matches){
286					var composedDate = new Date(matches[5], (matches[3] - 1), matches[1]);
287					status = ((composedDate.getMonth() == (matches[3] - 1)) && (composedDate.getDate() == matches[1]) && (composedDate.getFullYear() == matches[5]));
288				}
289			}
290			return status;
291		}
292	);
293	 
294	/*reload captcha*/
295	$('body').on( 'click', '.refresh', function(e){
296		e.preventDefault();
297		$.ajax({
298			url: arAllcorpOptions['SITE_DIR'] + "ajax/captcha.php"
299		}).done(function(text){
300			$('.captcha_sid').val(text);
301			$('.captcha_img').attr("src", "/bitrix/tools/captcha.php?captcha_sid=" + text);
302		});
303	});
304	
305	$.validator.addClassRules({
306		'phone':{
307			regexp: arAllcorpOptions['THEME']['VALIDATE_PHONE_MASK']
308		},
309		'confirm_password':{
310			equalTo: 'input[name="REGISTER\[PASSWORD\]"]',
311			minlength: 6
312		},
313		'password':{
314			minlength: 6
315		},
316		'inputfile':{
317			extension: arAllcorpOptions['THEME']['VALIDATE_FILE_EXT'],
318			filesize: 5000000
319		},
320		 'captcha':{
321			captcha: ''
322		}
323		,
324		 'date':{
325			date: ''
326		}
327	});
328	
329	$("input[type=file]").uniform({ fileButtonHtml: BX.message("JS_FILE_BUTTON_NAME"), fileDefaultHtml: BX.message("JS_FILE_DEFAULT") });
330	
331	/*check mobile device*/
332	
333	if(jQuery.browser.mobile){
334		$('*[data-event="jqm"]').live('click', function(e){
335			e.preventDefault();
336			var _this = $(this);
337			var name = _this.data('name');
338			
339			if(name.length){
340				var script = arAllcorpOptions['SITE_DIR'] + 'form/';
341				var paramsStr = ''; var arTriggerAttrs = {};
342				$.each(_this.get(0).attributes, function(index, attr){
343					var attrName = attr.nodeName;
344					var attrValue = _this.attr(attrName);
345					arTriggerAttrs[attrName] = attrValue;
346					if(/^data\-param\-(.+)$/.test(attrName)){
347						var key = attrName.match(/^data\-param\-(.+)$/)[1];
348						paramsStr += key + '=' + attrValue + '&';
349					}
350				});
351				
352				var triggerAttrs = JSON.stringify(arTriggerAttrs);
353				var encTriggerAttrs = encodeURIComponent(triggerAttrs);
354				script += '?name=' + name + '&' + paramsStr + 'data-trigger=' + encTriggerAttrs;
355				
356				location.href = script;
357			}
358		});
359		
360		$('.services.detail .galery .galery').each(function(){
361			var item = $(this).find('.item');
362			item.addClass('mobile');
363			item.find('a').removeClass('fancybox');
364		});
365		
366		$('.catalog.detail .slides li').each(function(){
367			$(this).find('a').removeClass('fancybox');
368		});
369		
370		$('.style-switcher').addClass('hidden');
371		$('.hint span').remove();
372	}
373/*
374else{	
375		$('*[data-event="jqm"]').live('click', function(e){
376			e.preventDefault();
377			$(this).jqmEx();
378			$(this).trigger('click');
379		});
380	}
381
382*/
383/*
384$(document).on('click', '*[data-event="jqm"]', function(e) {
385    e.preventDefault();
386
387    console.log('click');
388    console.log(typeof $.fn.jqmEx);
389
390    $(this).jqmEx();
391});
392*/
393
394
395 else {
396    $(document).on('click', '*[data-event="jqm"]', function(e) {
397        e.preventDefault();
398        var $this = $(this);
399        $this.jqmEx();
400        // Повторный клик через таймаут, если окно не открылось сразу
401        setTimeout(function() {
402            $this.trigger('click'); // теперь сработает после загрузки
403        }, 300);
404    });
405}
406
407	//$('a.fancybox:has(img)').fancybox();
408if ($.fn.fancybox) {
409    $('a.fancybox:has(img)').fancybox();
410}
411	
412	// Responsive Menu Events
413	var addActiveClass = false;
414	
415	$("#mainMenu li.dropdown > a, #mainMenu li.dropdown-submenu > a").on( "click", function(e){
416		e.preventDefault();
417		if( $(window).width() > 979 ) return;
418		
419		addActiveClass = $(this).parent().hasClass("resp-active");
420		
421		$("#mainMenu").find(".resp-active").removeClass("resp-active");
422		
423		if( !addActiveClass ){
424			$(this).parents("li").addClass("resp-active");
425		}
426	});
427	
428	$(document).on('click', '.mega-menu .dropdown-menu', function(e){
429		e.stopPropagation()
430	});
431	
432	$(document).on('click', '.mega-menu .dropdown-toggle.more-items', function(e){
433		e.preventDefault();
434	});
435	
436	$(".table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle").live("mouseenter", function() {
437		CheckTopVisibleMenu();
438	});
439	
440	$(".flexslider:not(.thmb)").each(function(){
441		var slider = $(this);
442		var options;
443		var defaults = {
444			animationLoop: false,
445			controlNav: false,
446			directionNav: true
447		}
448		var config = $.extend({}, defaults, options, slider.data("plugin-options"));
449				
450		slider.flexslider(config).addClass("flexslider-init");
451		
452		if( config.controlNav )
453			slider.addClass("flexslider-control-nav");
454		
455		if( config.directionNav )
456			slider.addClass("flexslider-direction-nav");
457	});
458	
459	/* toggle */
460	
461	var $this = this,
462		previewParClosedHeight = 25;
463	
464	$("section.toggle > label").prepend($("<i />").addClass("icon icon-plus"));
465	$("section.toggle > label").prepend($("<i />").addClass("icon icon-minus"));
466	$("section.toggle.active > p").addClass("preview-active");
467	$("section.toggle.active > div.toggle-content").slideDown(350, function() {});
468	
469	$("section.toggle > label").click(function(e){
470		var parentSection = $(this).parent(),
471			parentWrapper = $(this).parents("div.toogle"),
472			previewPar = false,
473			isAccordion = parentWrapper.hasClass("toogle-accordion");
474			
475		if(isAccordion && typeof(e.originalEvent) != "undefined") {
476			parentWrapper.find("section.toggle.active > label").trigger("click");
477		}
478		
479		parentSection.toggleClass("active");
480		
481		// Preview Paragraph
482		if( parentSection.find("> p").get(0) ){
483			previewPar = parentSection.find("> p");
484			var previewParCurrentHeight = previewPar.css("height");
485			previewPar.css("height", "auto");
486			var previewParAnimateHeight = previewPar.css("height");
487			previewPar.css("height", previewParCurrentHeight);
488		}
489		
490		// Content
491		var toggleContent = parentSection.find("> div.toggle-content");
492		
493		if( parentSection.hasClass("active") ){
494			$(previewPar).animate({
495				height: previewParAnimateHeight
496			}, 350, function() {
497				$(this).addClass("preview-active");
498			});
499			toggleContent.slideDown(350, function() {});
500		}else{
501			$(previewPar).animate({
502				height: previewParClosedHeight
503			}, 350, function() {
504				$(this).removeClass("preview-active");
505			});
506			toggleContent.slideUp(350, function() {});
507		}
508	});
509	
510	/* /toogle */
511	
512	/* accordion */
513	
514	$('.accordion-head').on('click', function(e){
515		e.preventDefault();
516		if( $(this).hasClass('accordion-open') ){
517			$(this).addClass('accordion-close').removeClass('accordion-open');
518		}else{
519			$(this).addClass('accordion-open').removeClass('accordion-close');
520		}
521	});
522	
523	/* /accordion */
524	
525	/* progress bar */
526	
527	$("[data-appear-progress-animation]").each(function(){
528		var $this = $(this);
529		$this.appear(function(){
530			var delay = ($this.attr("data-appear-animation-delay") ? $this.attr("data-appear-animation-delay") : 1);
531			if( delay > 1 )
532				$this.css("animation-delay", delay + "ms");
533			$this.addClass($this.attr("data-appear-animation"));
534
535			setTimeout(function(){
536				$this.animate({
537					width: $this.attr("data-appear-progress-animation")
538				}, 1500, "easeOutQuad", function() {
539					$this.find(".progress-bar-tooltip").animate({
540						opacity: 1
541					}, 500, "easeOutQuad");
542				});
543			}, delay);
544		}, {accX: 0, accY: -50});
545	});
546	
547	/* /progress bar */
548	
549	$("a[rel=tooltip]").tooltip();
550	$("span[data-toggle=tooltip]").tooltip();
551	
552	$("select.sort").live("change", function(){
553		location.href = $(this).val();
554	});
555
556	setTimeout(function(th){
557		$('.catalog.group.list .item').each(function(){
558			var th = $(this);
559			if((tmp = th.find('.image').outerHeight() - th.find('.text_info').outerHeight()) > 0){
560				th.find('.text_info .titles').height(th.find('.text_info .titles').outerHeight() + tmp);
561			}
562			
563		})
564	}, 50);
565
566	/*item galery*/
567	$('.thumbs .item a').live("click", function(e){
568		e.preventDefault();
569		$('.thumbs .item').removeClass('current');
570		$(this).closest('.item').toggleClass('current');
571		$('.slides li'+$(this).attr('href')).addClass("current").siblings().removeClass("current");
572	});
573});

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.