PageSourceSearch

http://1skkm.ru/templates/1c-franchise/js/scripts.js

js 1skkm.ru collected 2026-10-07 03:00:30 UTC 9,177 bytes, 331 lines download raw bytes

1$('document').ready(function(){
2	// MENU MOBILE
3	$('#menu-mobile').click(function(e){
4		e.preventDefault();
5
6		if($(this).find('.hamburger').hasClass('menu-open')) {
7			$(this).find('.hamburger').removeClass('menu-open');
8		}else{
9			$(this).find('.hamburger').addClass('menu-open');
10		}
11		$('.menu-mobile').fadeToggle();
12	});
13	// END MENU MOBILE
14
15
16	// TABS
17	$('.tabs a').click(function() {
18		$(this).closest('.tabs').find('*').removeClass('active');
19		$(this).addClass('active').parent('li').addClass('active');
20
21		var tabName = $(this).attr('href');
22
23		var tabsWrapperId = '#' + $(this).closest('.tabs').attr('data-tabs');
24
25        $(tabsWrapperId).find('.tab-content:visible').fadeOut(100, function(){
26        	$(this).removeClass('active');
27    		$(tabName).fadeIn(100).addClass('active');
28			if ($(document).width() < 639) {
29	            window.scroll.scrollToObject('.tabs-content-wrap');
30	        }
31        });
32	});
33	// END TABS
34
35
36
37	// SCROLL
38	function Scroll(){
39		var self = this;
40		self.spincrementShow = true;
41
42
43		self.scrollToObject = function(objName){
44			var objPosition = $(objName).offset().top;
45
46			$('body,html').animate({
47				scrollTop: objPosition - 60
48			}, 1000);
49		};
50
51		self.scrollFunc = function(){
52			var scrolled = window.pageYOffset || document.documentElement.scrollTop;
53			var innerHeight = document.documentElement.clientHeight;
54			var bodyHeight = $('html').height();
55
56			if(scrolled >= 50){
57				$('.scroll-top').css('right','10px');
58			}else if(scrolled < 50){
59				$('.scroll-top').css('right','-100px');
60			};
61
62			// spincrement
63			if($('section').is('#counters')){
64				var countersPosition;
65				countersPosition = $('#counters').offset().top;
66				if(scrolled >= countersPosition - innerHeight && self.spincrementShow){
67					$(".spincrement").spincrement({
68						duration: 3000
69					});
70					self.spincrementShow = false;
71				}
72			}
73			// end spincrement
74		};
75
76
77		$('.scroll').click(function(){
78			var objLink = '';
79			objLink = $(this).attr('href');
80			if (objLink.indexOf('.') > 0) {
81				objLink = objLink.substring(1);
82			};
83
84			if( $('*').is( objLink ) ) self.scrollToObject(objLink);
85		});
86
87		$('.scroll-top').click(function(){
88			$('body,html').animate({
89				scrollTop: 0
90			}, 700);
91		})
92
93
94		// прематываем к H1 если не главная страница
95		if ($(document).width() < 576 && window.location.pathname != '/') {
96			var h = document.getElementsByTagName('h1')[0] ? document.getElementsByTagName('h1') : document.getElementsByTagName('h2');
97			if(h[0]) self.scrollToObject(h[0]);
98		}
99	}
100
101	window.scroll = new Scroll;
102
103	window.onscroll = function() {
104		window.scroll.scrollFunc();
105	};
106	// END SCROLL
107
108
109	// SPOILER
110	$('.spoiler-link').click(function(e){
111		e.preventDefault();
112		var spoilerName = $(this).attr('href');
113
114		if($(spoilerName).css('display') == 'block'){
115			$(spoilerName).fadeOut(500);
116			$(this).removeClass('spoiler-open');
117
118			if (spoilerName == '#footer-spoiler') {
119				if(spoilerName == '#footer-spoiler') $(this).text('Показать все меню'); //footer only
120				$(spoilerName).removeClass('d-none')
121			} else {
122				if(spoilerName == '#footer-spoiler') $(this).text('Подробнее...'); //footer only
123			}
124
125		} else {
126			if (spoilerName == '#footer-spoiler') $(spoilerName).removeClass('d-none');
127			$(spoilerName).fadeIn(500);
128			if(spoilerName == '#footer-spoiler') $(this).text('Скрыть'); //footer only
129			$(this).addClass('spoiler-open');
130		};
131	});
132	// END SPOILER
133
134
135	// CONTENT TABLE
136	$('.content table').each(function(){
137		if(!$(this).parent().hasClass('table-wrapper')) $(this).wrap('<div class="table-wrapper"></div>');
138	})
139	// END CONTENT TABLE
140
141
142	// GALLERY
143	$('.thumbnails').on('click', 'span', function(){
144		$('.thumbnails span').removeClass('active');
145		$(this).addClass('active');
146
147		// BIG LINK
148		var thisHref = $(this).prev().attr('href');
149		$('.big-card-img').attr('href', thisHref);
150
151		// BIG IMG SRC
152		var thisSrc = $(this).find('img').attr('data-src');
153		$('.big-card-img').find('img').attr('src', thisSrc);
154	});
155	// END GALLERY
156
157
158	// DROPDOWN
159	function Dropdown(){
160		var self = this;
161
162		self.dropdownOpen = function(dropdownName){
163			$('body').addClass('dropdown-is-open');
164			$(dropdownName).fadeIn(100);
165		};
166
167		self.dropdownClose = function(dropdownName){
168			$('body').removeClass('dropdown-is-open');
169			$('.dropdown-open').removeClass('active');
170			$('.dropdown').fadeOut(100);
171		};
172
173		$('.dropdown-open').click(function(e){
174			e.preventDefault();
175			var dropdownName = $(this).attr('href');
176
177			if($(dropdownName).css('display') == 'block'){
178				$(this).removeClass('active');
179				self.dropdownClose();
180			}else{
181				$(this).addClass('active');
182				self.dropdownOpen($(this).attr('href'));
183			}
184		});
185
186		$('.dropdown, .appearance-palette').click(function(e){
187			e.stopPropagation();
188		})
189
190		$('body.dropdown-is-open').live('click', function(e){
191			var target = e.target;
192
193			if( ($(e.target).hasClass('dropdown')) || ($(e.target).hasClass('appearance-palette'))) return;
194
195			while(target != document){
196				if ( $(target).hasClass('dropdown-open') || $(target).hasClass('ap-btn') ) return;
197				target = target.parentNode;
198			}
199
200			window.dropdown.dropdownClose();
201			window.appearancePalette.apClose();
202		});
203	}
204
205	window.dropdown = new Dropdown;
206	// END DROPDOWN
207
208	// MODAL
209	function Modal(){
210		var self = this;
211
212		self.modalOpen = function(modalName, btnThis, dataModalName, dataModalType){
213			// modalName - атрибут href
214			// btnThis - $(this) нажатой кнопки
215			// dataModalName используется для ЗАГОЛОВКА окна и для КНОПКИ SUBMIT
216			// dataModalType используется для проверки типа окна ЗАКАЗАТЬ/АРЕНДОВАТЬ
217
218			var windowPosition = $(modalName).offset().top;
219			// Поле с ценой в модальном окне
220			var $modalPrice = $(modalName).find('.modal-price');
221
222			if( dataModalName && dataModalType ){
223				var rentOrBuy = 'Покупка';
224				var price = 0;
225				// Текст перед ценой
226				var pricePrefix = $('.price-prefix').text();
227
228				if(dataModalType == 'rent'){
229					rentOrBuy = 'Аренда';
230					price = $('#card-rent-price').text();
231				}else if(dataModalType == 'order'){
232					rentOrBuy = 'Покупка';
233					price = $('#card-price').text();
234
235					// Опционные свойства пишем в textarea
236					if(window.optPropsString != '') $(modalName).find('textarea').text(window.optPropsString);
237				}
238
239				if(price == ''){
240					// ЕСЛИ НЕТ ЦЕНЫ
241					$modalPrice.parent().hide();
242				}else{
243					// ЕСЛИ ЕСТЬ ЦЕНА
244					// Блок с ценой
245					$modalPrice.parent().show();
246					$modalPrice.text(price);
247					// Текст перед ценой
248					$(modalName).find('.modal-price-prefix').text(pricePrefix);
249					// Скрытый инпут с ценой
250					$('#customer-price').val(price);
251				}
252
253				// Скрытый инпут Заказ или Покупка
254				$('#customer-rent-or-buy').val(rentOrBuy);
255
256				// Заголовок модального окна
257				$('#modal-order-title').text(dataModalName);
258
259				// Текст Кнопки в модальном окне
260				$(modalName).find('input:submit').val(dataModalName);
261
262				// Если на странице услуги есть список подуслуг
263				if( $('ul').is("#additional-services") ){
264					var subServiceName = btnThis.closest('li').find('.subservice-title').text();
265					var customerGood = $('h1').text();
266
267					// Меняем заголовок услуги в окне
268					$('#modal-order-customer-good').text(customerGood + ': ' + subServiceName);
269
270					// Название услуги в скрытом инпуте
271					$('#customer-good').val(customerGood + ': ' + subServiceName);
272				}
273			}
274
275			$('.mask').fadeIn();
276			$(modalName).css('position', 'absolute');
277			$(modalName).fadeIn(100).css('top', windowPosition + 100);
278			$('body').addClass('blur');
279		}
280
281		self.modalClose = function(){
282			$('.mask, .modal').fadeOut();
283			$('body').removeClass('blur');
284		}
285
286		$('.modal-open').click(function(e){
287			e.preventDefault();
288			var dataModalName = $(this).attr('data-modal-name');
289			var dataModalType = $(this).attr('data-modal-type');
290			self.modalOpen($(this).attr('href'), $(this), dataModalName, dataModalType);
291		});
292
293		$('.mask, .close, .modal-close').click(function(e){
294			e.preventDefault();
295			self.modalClose();
296		});
297
298	}
299
300	window.modal = new Modal;
301
302	window.addEventListener("keydown", function(e) {
303		if (e.keyCode == 27) {
304			window.modal.modalClose();
305			window.dropdown.dropdownClose();
306			window.appearancePalette.apClose();
307		}
308	}, true);
309	// END MODAL
310
311	// PAGING - JS SCROLL
312	$('.js-scroll').jscroll({
313		loadingHtml: '<img style="position: absolute; left: 50%;" src="/images/1c_franchise/loader.svg" alt="Loading" />',
314		padding: 100,
315		nextSelector: 'a.jscroll-next:last',
316		contentSelector: 'div.js-scroll',
317		autoTrigger: false
318	});
319
320	// END PAGING - JS SCROLL
321
322	$('.phone-mask').mask("+7 (999) 999-99-99");
323
324	$('.fancybox').fancybox({
325		transitionEffect : 'slide',
326		animationEffect : 'fade',
327	})
328});
329// END DOCUMENT READY
330
331

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.