PageSourceSearch

https://dom.com.cy/local/templates/main/js/script.js

js dom.com.cy collected 2026-09-24 09:16:32 UTC 5,635 bytes, 191 lines download raw bytes

1$(document).on("scroll", lazyload);
2$(window).on("resize", lazyload);
3$(window).on("load", lazyload);
4
5$(function() {
6	$(document).on("scroll", function() {
7		if ($(window).width() < 860)
8		{
9			$("header").toggleClass("fixed", $(window).scrollTop() > 1 ? true : false);
10		}
11	});
12	
13	checkFormFields();
14	$(document).on('copy input keyup', 'input, textarea, select', function() {
15		if ($(this).closest('.form-custom').length > 0)
16		{
17			if ($(this).closest(".form-custom-group").hasClass('error'))
18				$(this).closest(".form-custom-group").removeClass('error');
19
20				checkFormField(this);
21		}
22	});
23	
24	
25	$.each($('body').find('.js-select2'), function(i, el) {
26		initSelect2(el);
27	});
28	$(document).on('change', '.js-select2', function() {
29		$(".select2-search__field").val("");
30	});
31	$(document).on('focus', '.select2-search__field', function() {
32		if ($(window).width() <= 860)
33			$('.select2-search__field').blur();
34	});
35	$(document).on('click', '.select2-results .select2-close', function() {
36		select2Close();
37	});
38	$(document).on('click', '.select2-container.select2-container--open', function(e) {
39		if (e.target === e.currentTarget)
40		{
41			select2Close();
42		}
43	});
44	function select2Close()
45	{
46		$('.select2-container.select2-container--open').find('.select2-dropdown').css("transform", "translateY(100%)");
47		//$('.select2-container.select2-container--open').remove();
48		setTimeout(function() {$('.js-select2').select2('close');}, 250);
49	}
50	
51	
52	$(document).on('input copy change', 'input, textarea', function() {
53		if ($(this).closest('.form-group').length && $(this).closest('.form-group').hasClass('error'))
54			$(this).closest('.form-group').removeClass('error');
55	});
56		
57	
58	$(document).on(
59		'click', 
60		'div.js-menu-toggle', 
61		function() 
62		{
63			$.fancybox.open(
64				$('div.js-menu-mobile'), 
65				{
66					afterClose: function()
67					{
68						$('div.js-mobile-menu-block').hide();
69						$('div.js-menu-mobile').show();
70					},
71					afterLoad: function()
72					{
73						$('div.js-mobile-menu-block').show();
74					},
75					touch: false
76				}
77			);
78		}
79	);
80	
81	
82	
83	
84	$(document).on('blur', '.range-custom input', function() {
85		var elRangeBlock = $(this).closest('.range-custom');
86		var min = parseInt($(this).attr('data-min'));
87		var max = parseInt($(this).attr('data-max'));
88		var value = parseInt($(this).val());
89		if (value < min)
90			$(this).val(min);
91		else if (value > max)
92			$(this).val(max);
93		else if ($(this).val() != value && $(this).val() != "")
94			$(this).val(max);
95		
96		var elRange = elRangeBlock.find('.range');
97		if (elRange.length)
98		{
99			if (elRangeBlock.find('input').length > 1)
100			{
101				elRange.slider("values", [parseInt(elRangeBlock.find('.range-input:nth-child(1) input').val()), parseInt(elRangeBlock.find('.range-input:nth-child(2) input').val())]);
102			}
103			else
104			{
105				elRange.slider("value", parseInt(elRangeBlock.find('input').val()));
106			}
107			
108		}
109	});
110	$(document).on('change', '.range-custom select', function() {
111		var elRangeBlock = $(this).closest('.range-custom');
112		var elRange = elRangeBlock.find('.range');
113		elRange.slider("value", this.selectedIndex);
114	});
115	getPhoneMask('form.js-custom-form input[name=UF_PHONE]');
116
117	// Auto scroll to objects in catalog
118	if ($(window).width() <= 860 && $(".catalog-section-topline").length > 0 && (/\/catalog\/(sale|rent)\/[^\/]+/.test(window.location.pathname))) {
119		$('html, body').animate({
120			scrollTop: $(".catalog-section-topline").offset().top - 68
121		}, 1000);
122	}
123	
124	setTimeout(
125		function() 
126		{
127			if ($(window).width() > 768)
128			{
129				$('.widget-button-wrapper').addClass('widget-button-visible');
130			}
131		}, 
132		6000		
133	);
134	$(document).on(
135		'click',
136		'.widget-button-block .widget-button-inner-item', 
137		function() 
138		{
139			$('.widget-button-shadow, .widget-button-social').removeClass('widget-button-hide').addClass('widget-button-show');
140			$('.widget-button-wrapper').addClass('widget-button-bottom');
141		}
142	);
143	$(document).on(
144		'click', 
145		'.widget-button-block .widget-button-close, .widget-button-shadow.widget-button-show, .widget-button-social-item', 
146		function() 
147		{
148			$('.widget-button-shadow, .widget-button-social').removeClass('widget-button-show').addClass('widget-button-hide');
149			$('.widget-button-wrapper').removeClass('widget-button-bottom');
150		}
151	);	
152});
153
154// Observer for fancybox close button. Close select2 when close button is clicked.
155const observer = new MutationObserver((mutations) => {
156	mutations.forEach((mutation) => {
157		if (mutation.addedNodes.length) {
158			mutation.addedNodes.forEach((node) => {
159				if (node.classList && node.classList.contains('fancybox-close-small')) {
160					$(node).on('click', function() {
161						closeSelect2();
162					});
163				}
164			});
165		}
166	});
167});
168
169observer.observe(document.body, {
170	childList: true,
171	subtree: true
172});
173
174$(function(){
175	const baseRatio = window.devicePixelRatio;
176	function checkZoom() {
177		const currentRatio = window.devicePixelRatio;
178		if (currentRatio !== baseRatio) {
179			// Если масштаб изменился, сбрасываем паддинг на 0
180			$('.element-property-wrap.map').css('padding-bottom', '0px');
181		} else {
182			// Если вернулись к исходному масштабу, возвращаем исходный паддинг
183			$('.element-property-wrap.map').css('padding-bottom', '64px');
184		}
185	}
186	// Проверяем при изменении размера окна
187	$(window).on('resize', function() {
188		checkZoom();
189	});
190	checkZoom();
191});

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.