PageSourceSearch

https://grafskiypark.com/local/templates/GCgraf/js/graf.js?167949580521245

js grafskiypark.com collected 2026-10-04 07:59:44 UTC 21,245 bytes, 842 lines download raw bytes

1(function($) {
2	var GRAF = (function() {
3
4		var $sel = {};
5		$sel.window = $(window);
6		$sel.html = $("html");
7		$sel.body = $("body", $sel.html);
8
9		var lang = false;
10
11		return {
12			init: function() {
13				var self = this;
14
15				if(location.href.indexOf("/en/") != -1) {
16					self.lang = "en";
17				} else {
18					self.lang = "ru";
19				}
20			},
21
22			common: {
23				go: function(topPos, speed, callback) {
24					var curTopPos = $sel.window.scrollTop(),
25						diffTopPos = Math.abs(topPos - curTopPos);
26					$sel.body.add($sel.html).animate({
27						"scrollTop": topPos
28					}, speed, function() {
29						if(callback) {
30							callback();
31						}
32					})
33				}
34			},
35
36			goTop: function() {
37				var $top = $(".footer-top", $sel.body);
38
39				if(!$top.length) {
40					return false;
41				}
42
43				$top.on("click", function(e) {
44					$("html, body").animate({
45						"scrollTop": 0
46					}, 800);
47					e.preventDefault();
48				});
49
50				function checkPos() {
51					var sTop = $sel.window.scrollTop(),
52						wh = $sel.window.height();
53					if(sTop > wh) {
54						$top.addClass("visible");
55					} else {
56						$top.removeClass("visible")
57					}
58				}
59
60				checkPos();
61				$sel.window.on("scroll", checkPos);
62
63			},
64
65			goEl: function() {
66				var self = this;
67					$goEl = $("[data-goto]");
68
69				$goEl.on("click", function(event) {
70					var $nameEl = $sel.body.find($(this).data("goto"));
71
72					if ($nameEl.length === 0) {
73						return;
74					} else {
75						var posEl = $nameEl.offset().top;
76						GRAF.common.go(posEl-150, 1000);
77					}
78					event.preventDefault();
79				});
80
81			},
82			
83			popup: {
84				init: function($container) {
85					if(!$container) {
86						var $container = $sel.body;
87					}
88					$(".popup", $container).each(function() {
89						(function($p) {
90							$p.magnificPopup({
91								type: $p.data("type") ? $p.data("type") : "",
92								mainClass: "mfp-fade",
93								//closeMarkup: '<button title="Закрыть" type="button" class="mfp-close gallery-popup-close">&#215;</button>',
94								removalDelay: 300,
95								tClose: "Закрыть (ESC)",
96								tLoading: "Загрузка...",
97								callbacks: {
98									ajaxContentAdded: function() {
99										GRAF.page.form.init($(this.container));
100									}
101								}
102							});
103						})($(this));
104					});
105				}
106			},
107
108			scrollAnimation: {
109				blocks: [],
110
111				init: function() {
112					var self = this;
113
114
115					if(!$sel.html.hasClass("device-mobile")) {
116						$sel.window.on("scroll", function() {
117							self.check();
118						});
119						setTimeout(function() {
120							self.prepare();
121							self.check();
122						}, 500);
123					}
124
125
126
127				},
128
129				prepare: function() {
130					var self = this;
131					$(".wow:not(.animated)").each(function() {
132						var $item = $(this),
133							itemAnimation = $item.data("animationtype"),
134							itemAnimationDuration = $item.data("animationduration");
135
136						if (!itemAnimationDuration) {
137							itemAnimationDuration = 0;
138						}
139
140						self.blocks.push({
141							"html": $item,
142							"top": $item.offset().top,
143							"typeAnimation": itemAnimation,
144							"animation-duration" : itemAnimationDuration
145						});
146
147						//$item.addClass("before-" + itemAnimation);
148						$item.css("animation-duration", itemAnimationDuration);
149
150					});
151
152					//console.log(self.blocks);
153				},
154
155				check: function() {
156					var self = this,
157						block = false,
158						blockTop = false,
159						top = $sel.window.scrollTop(),
160						buffer = parseInt($sel.window.height()) / 1.6 + 90;
161					//console.log($sel.body.scrollTop());
162					for(var i = 0, len = self.blocks.length; i < len; i++) {
163						block = self.blocks[i],
164						blockTop = parseInt(block.top, 10);
165						if(block.html.hasClass("animated")) {
166							continue;
167						}
168						if(top + buffer >= blockTop) {
169							block.html.addClass("animated");
170						}
171
172					}
173				},
174			},
175
176			animation: {
177				init: function() {
178					$(".header-logo").addClass("start-animation");
179				}
180			},
181
182			header: {
183				init: function() {
184					var self = this;
185
186					self.scroll.init();
187					self.menu.init();
188				},
189				scroll: {
190					init: function() {
191						$sel.window.on("scroll", function() {
192							var hh = $(".page-header").outerHeight(),
193								sTop = ($sel.html.hasClass("device-mobile") ? $sel.body.scrollTop() : $sel.window.scrollTop());
194							if(sTop > hh) {
195								$sel.body.addClass("fixed-header");
196								setTimeout(function() {
197									$sel.body.addClass("fixed-header--show");
198								}, 100);
199							} else {
200								$sel.body.removeClass("fixed-header--show");
201								$sel.body.removeClass("fixed-header");
202							}
203						});
204					}
205				},
206				menu: {
207					isOpen: false,
208					$panel: null,
209					$burger: null,
210					init: function() {
211						var self = this;
212
213						self.$panel = $(".header-panel", $sel.body);
214						self.$burger = $(".header-burger", $sel.body);
215
216						self.$burger.on("click", function() {
217							if(self.isOpen) {
218								self.hide();
219							} else {
220								self.show();
221							}
222						});
223
224						/*$sel.window.on("scroll", function() {
225							if(self.isOpen) {
226								self.hide();
227							}
228						});*/
229					},
230					show: function() {
231						var self = this;
232
233						self.$panel.css("display", "block");
234						$sel.html.addClass("menu-open-html");
235						setTimeout(function() {
236							$sel.body.addClass("menu-open");
237							self.isOpen = true;
238						}, 100);
239						self.$burger.addClass("active");
240					},
241					hide: function() {
242						var self = this;
243
244						$sel.body.removeClass("menu-open");
245						$sel.html.removeClass("menu-open-html");
246						setTimeout(function() {
247							self.$panel.css("display", "none");
248							self.isOpen = false;
249						}, 350);
250						self.$burger.removeClass("active");
251					}
252				}
253			},
254
255			maps: {
256				init: function() {
257			    	$(".map", $sel.body).each(function() {
258			            var $map = $(this),
259			            	lng = parseFloat($map.data("lng"), 10) || 0,
260			            	lat = parseFloat($map.data("lat"), 10) || 0,
261			            	zoom = parseInt($map.data("zoom"));
262
263			            var options = {
264							center: new google.maps.LatLng(lat, lng),
265							zoom: zoom,
266							mapTypeControl: false,
267							panControl: false,
268							zoomControl: true,
269							zoomControlOptions: {
270								style: google.maps.ZoomControlStyle.LARGE,
271								position: google.maps.ControlPosition.TOP_RIGHT
272							},
273							scaleControl: true,
274							streetViewControl: true,
275							streetViewControlOptions: {
276								position: google.maps.ControlPosition.TOP_RIGHT
277							},
278							mapTypeId: google.maps.MapTypeId.ROADMAP,
279							styles: [
280								{"featureType": "landscape", "stylers": [
281				                    {"saturation": -100},
282				                    {"lightness": 0},
283				                    {"visibility": "on"}
284				                ]},
285				                {"featureType": "poi", "stylers": [
286				                    {"saturation": -300},
287				                    {"lightness": -10},
288				                    {"visibility": "simplified"}
289				                ]},
290				                {"featureType": "road.highway", "stylers": [
291				                    {"saturation": -100},
292				                    {"visibility": "simplified"}
293				                ]},
294				                {"featureType": "road.arterial", "stylers": [
295				                    {"saturation": -100},
296				                    {"lightness": 0},
297				                    {"visibility": "on"}
298				                ]},
299				                {"featureType": "road.local", "stylers": [
300				                    {"saturation": -100},
301				                    {"lightness": 0},
302				                    {"visibility": "on"}
303				                ]},
304				                {"featureType": "transit", "stylers": [
305				                    {"saturation": -100},
306				                    {"visibility": "simplified"}
307				                ]},
308				                {"featureType": "administrative.province", "stylers": [
309				                    {"visibility": "off"}
310				                ]},
311				                {"featureType": "water", "elementType": "labels", "stylers": [
312				                    {"visibility": "on"},
313				                    {"lightness": -25},
314				                    {"saturation": -100}
315				                ]},
316				                {"featureType": "water", "elementType": "geometry", "stylers": [
317				                    {"hue": "#ffff00"},
318				                    {"lightness": -25},
319				                    {"saturation": -97}
320				                ]}
321				            ]
322				        };
323
324			            var api = new google.maps.Map($map[0], options);
325			            var point = new google.maps.Marker({
326			            	position: new google.maps.LatLng(lat, lng),
327			            	map: api,
328			                icon: $map.data("icon")
329			            });
330
331			        });
332			    }
333			},
334
335			sliders: {
336				promo: {
337					init: function() {
338						$(".promo-items", $sel.body).on("fotorama:ready", function(e, fotorama) {
339							$(".promo-nav-item--prev", $sel.body).on("click", function() {
340								fotorama.show("<");
341							});
342							$(".promo-nav-item--next", $sel.body).on("click", function() {
343								fotorama.show(">");
344							});
345							$(".promo-nav-counter-all", $sel.body).text(fotorama.size);
346							$(".promo-nav-counter-current", $sel.body).text(fotorama.activeIndex + 1);
347
348							/*if($sel.window.width() < 800) {
349								fotorama.setOptions({
350									ratio: 1
351								});
352							}*/
353
354						}).fotorama().on("fotorama:show", function(e, fotorama) {
355							$(".promo-nav-counter-current", $sel.body).text(fotorama.activeIndex + 1);
356						});
357					}
358				},
359
360				restaurant: {
361					init: function() {
362						$(".restaurant-items", $sel.body).on("fotorama:ready", function(e, fotorama) {
363							(function(f) {
364								$(".restaurant-nav-item--prev", $sel.body).on("click", function() {
365									f.show("<");
366								});
367								$(".restaurant-nav-item--next", $sel.body).on("click", function() {
368									f.show(">");
369								});
370							})(fotorama);
371						}).fotorama();
372					}
373				},
374
375				food: {
376					init: function() {
377						$(".food-items-slider").on("init", function(e, slick) {
378							var $slider = $(this);
379							$(".food-nav-item--prev").on("click", function() {
380								$slider.slick("slickPrev")
381							});
382							$(".food-nav-item--next").on("click", function() {
383								$slider.slick("slickNext")
384							});
385							console.log(e);
386							//$(".food-nav-counter-all").;
387						}).slick({
388							slidesToShow: 4,
389							slidesToScroll: 3,
390							speed: 500,
391							dots: false,
392							arrows: false,
393							centerMode: true,
394							autoplay: true,
395							autoplaySpeed: 2000
396						});
397					}
398				},
399
400				big: {
401					init: function() {
402						$(".slider-items", $sel.body).on("fotorama:ready", function(e, fotorama) {
403							(function(f) {
404								$(".slider-items-arr--left", $sel.body).on("click", function() {
405									f.show("<");
406								});
407								$(".slider-items-arr--right", $sel.body).on("click", function() {
408									f.show(">");
409								});
410
411								if($sel.window.width() < 800) {
412									fotorama.setOptions({
413										ratio: 2/1,
414										glimpse: 0
415									});
416								}
417
418							})(fotorama);
419						}).fotorama();
420					}
421				},
422
423				serviceSlider: {
424					init: function() {
425						var sliders = $(".service-slider-list", $sel.body);
426
427						sliders.each(function() {
428							(function(elSlider) {
429								var itemSlider = $(".service-slider-item", elSlider),
430									navContainer = elSlider.parent(".service-slider").find(".service-slider-nav"),
431									numberSlide = navContainer.find(".service-slider-nav-counter-current"),
432									countAllSlide = navContainer.find(".service-slider-nav-counter-all");
433
434								elSlider.on("init", function(event, slick){
435									countAllSlide.text(slick.slideCount);
436								});
437
438								elSlider.slick({
439									arrows: true,
440									appendArrows: navContainer,
441									prevArrow: $(".service-slider-nav-item--prev", navContainer),
442									nextArrow: $(".service-slider-nav-item--next", navContainer),
443									infinite: true,
444									speed: 700,
445									slidesToShow: 1,
446									autoplay: true,
447									autoplaySpeed: 5000
448								});
449
450								itemSlider.on("mousedown", function() {
451									item = $(this);
452									item.css("cursor", "-webkit-grab");
453								})
454
455								itemSlider.on("mouseup", function() {
456									item = $(this);
457									item.css("cursor", "pointer");
458								})
459
460								elSlider.on("afterChange", function(event, slick, currentSlide, nextSlide){
461									var i = (currentSlide ? currentSlide : 0) + 1;
462									numberSlide.text(i);
463									countAllSlide.text(slick.slideCount);
464								});
465
466
467							})($(this));
468						})
469					}
470				},
471
472				menuSlider: {
473					init: function() {
474						var menuSlider = $(".menu-slider-list", $sel.body),
475							itemSlider = $(".menu-slider-item", menuSlider),
476							navContainer = menuSlider.parent(".menu-slider").find(".menu-slider-nav"),
477							numberSlide = navContainer.find(".menu-slider-nav-counter-current"),
478							countAllSlide = navContainer.find(".menu-slider-nav-counter-all");
479
480						menuSlider.on("init", function(event, slick){
481							countAllSlide.text(slick.slideCount);
482						});
483
484						menuSlider.slick({
485							arrows: true,
486							appendArrows: navContainer,
487							prevArrow: $(".menu-slider-nav-item--prev", navContainer),
488							nextArrow: $(".menu-slider-nav-item--next", navContainer),
489							infinite: true,
490							slidesToShow: 4,
491							slidesToScroll: 2,
492							speed: 700,
493							autoplay: true,
494							autoplaySpeed: 5000,
495							responsive: [
496								{
497									breakpoint: 1320,
498									settings: {
499										slidesToShow: 3,
500										slidesToScroll: 2
501									}
502								}, {
503									breakpoint: 1000,
504									settings: {
505										slidesToShow: 2,
506										slidesToScroll: 1
507									}
508								}, {
509									breakpoint: 768,
510									settings: {
511										slidesToShow: 1,
512										slidesToScroll: 1
513									}
514								}
515							]
516						});
517
518						itemSlider.on("mousedown", function() {
519							item = $(this);
520							item.css("cursor", "-webkit-grab");
521						})
522
523						itemSlider.on("mouseup", function() {
524							item = $(this);
525							item.css("cursor", "pointer");
526						})
527
528						menuSlider.on("afterChange", function(event, slick, currentSlide, nextSlide){
529							var i = (currentSlide ? currentSlide : 0) + 1;
530							numberSlide.text(i);
531							countAllSlide.text(slick.slideCount);
532						});
533
534					}
535				},
536
537				init: function() {
538					var self = this;
539
540					self.big.init();
541					self.promo.init();
542					self.restaurant.init();
543					self.food.init();
544					self.serviceSlider.init();
545					self.menuSlider.init();
546				}
547			},
548
549			icons: {
550				$items: null,
551				init: function() {
552					var self = this;
553
554					self.build();
555					self.check();
556					$sel.window.on("scroll", function() {
557						self.check();
558						self.move();
559					});
560				},
561				build: function() {
562					var self = this;
563
564					self.$items = $(".back-icon-item", $sel.body);
565					self.$items.each(function() {
566						var $item = $(this);
567						$item.data({
568							"top": parseInt($item.position().top)
569						});
570					});
571				},
572				check: function() {
573					var self = this;
574						sTop = $sel.window.scrollTop(),
575						wh = $sel.window.height();
576
577					self.$items.each(function() {
578						var $item = $(this);
579						if((sTop + wh * 0.6) > $item.data("top")) {
580							$item.addClass("show");
581						}
582					});
583
584				},
585				move: function() {
586					var self = this;
587
588					self.$items.each(function() {
589						var $item = $(this);
590
591					});
592				}
593			},
594
595			page: {
596
597				ajaxLoader: function() {
598					$sel.body.on("click", ".load-more", function(event) {
599						var $linkAddress = $(this),
600							href = $linkAddress.attr("href"),
601							$container = $($linkAddress.data("container"));
602
603						$linkAddress.addClass("loading");
604
605						(function(href, $container) {
606							$.ajax({
607								url: href,
608								success: function(data) {
609									var $data = $(data).addClass("load-events-item");
610										$container.append($data);
611									setTimeout(function() {
612										GRAF.common.go($container.find(".load-events-item").offset().top-90, 600);
613										$container.find(".load-events-item").removeClass("load-events-item");
614										$linkAddress.removeClass("loading");
615									}, 600);
616									GRAF.reload();
617								}
618							})
619						})(href, $container);
620						event.preventDefault();
621					})
622
623				},
624
625				accordion: {
626
627					init: function() {
628						var self = this,
629							$accordion = $(".accordion"),
630							$accordionItem = $(".accordion-header", $accordion);
631
632						$accordionItem.on("click", function() {
633							var $el = $(this).parent(),
634								$elHide = $accordion.find(".accordion-item.active");
635
636							if (!$el.hasClass("active")) {
637								self.show($el);
638								self.hide($elHide);
639							} else {
640								self.hide($el);
641							}
642						});
643
644					},
645
646					show: function(el) {
647						el.addClass("active");
648						setTimeout(function() {
649							el.addClass("show-content");
650							setTimeout(function() {
651								GRAF.common.go(el.offset().top-90, 500);
652							}, 100);
653						}, 300);
654					},
655
656					hide: function(el) {
657						el.removeClass("show-content");
658						setTimeout(function() {
659							el.removeClass("active");
660						}, 300);
661					}
662
663				},
664
665				form: {
666
667					init: function() {
668						var self = this;
669
670						self.validate($(".form"));
671					},
672
673					validate: function($form) {
674
675						$form.each(function() {
676							(function($form) {
677								var $formFields = $form.find("[data-error]"),
678									formParams = {
679										rules: {
680										},
681										messages: {
682										}
683									};
684
685								$.validator.addMethod("mobileRU", function(phone_number, element) {
686									phone_number = phone_number.replace(/\(|\)|\s+|-/g, "");
687									return this.optional(element) || phone_number.length > 5 && phone_number.match(/^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{6,10}$/);
688								}, "Error");
689
690								$formFields.each(function() {
691									var $field = $(this),
692										fieldPattern = $field.data("pattern"),
693										fieldError = $field.data("error");
694									if(fieldError) {
695										formParams.messages[$field.attr("name")] = $field.data("error");
696									} else {
697										formParams.messages[$field.attr("name")] = "Ошибка заполнения";
698									}
699									if(fieldPattern) {
700										formParams.rules[$field.attr("name")] = {};
701										formParams.rules[$field.attr("name")][fieldPattern] = true;
702									}
703								});
704
705								$("[data-number]", $form).each(function() {
706									var $item = $(this);
707									$item.mask($item.data("number"));
708								});
709
710								if($form.data("success")) {
711									formParams.submitHandler = function(form) {
712										event.preventDefault();
713
714									};
715								}
716								$form.validate(formParams);
717
718							})($(this))
719						});
720
721					}
722
723				},
724
725				transformIcons: function() {
726					var self = this,
727						counter = $(window).scrollTop();
728
729					$sel.window.scroll(function() {
730						var top  = $(window).scrollTop(),
731							$icon = $(".bcg-icon");
732
733						if (top >= counter) {
734
735							var randomTransition = Math.floor(Math.random() * 50) + 1;
736
737							$icon.each(function() {
738								(function(i) {
739									i.css("transform", "translateY(-"+randomTransition+"px)");
740								})($(this));
741							});
742							counter = top;
743
744						} else {
745							var randomTransition = Math.floor(Math.random() * 50) + 1;
746
747							$icon.each(function() {
748								(function(i) {
749									i.css("transform", "translateY("+randomTransition+"px)");
750								})($(this));
751							});
752							counter = top;
753
754						}
755
756
757						if($(window).scrollTop() == 0) {
758							$icon.each(function() {
759								(function(i) {
760									i.css("transform", "translateY(0px)");
761								})($(this));
762							});
763							return;
764					   	}
765					});
766				}
767
768			},
769
770			toggleElements: function() {
771				var self = this,
772					$toggle = $(".toggle");
773
774				$toggle.each(function() {
775					(function(el) {
776						el.on("click", function(e) {
777							var toggleEl = $(this),
778								toggleId = toggleEl.attr("id"),
779								$container = $sel.body.find("[data-toggle='"+toggleId+"']");
780
781							if (toggleEl.hasClass("active")) {
782								toggleEl.removeClass("active-animation");
783								toggleEl.text((self.lang == "ru" ? "Подробнее" : "Learn more"));
784								$container.removeClass("active-animation");
785								setTimeout(function() {
786									toggleEl.removeClass("active");
787									$container.removeClass("active");
788								}, 300);
789							} else {
790								toggleEl.addClass("active");
791								toggleEl.text((self.lang == "ru" ? "Скрыть" : "Shortly"));
792								$container.addClass("active");
793								setTimeout(function() {
794									toggleEl.addClass("active-animation");
795									$container.addClass("active-animation");
796								}, 300);
797							}
798							e.preventDefault();
799						})
800					})($(this));
801
802				});
803			},
804		};
805
806	})();
807
808	window.GRAF = GRAF;
809
810	GRAF.init();
811
812	GRAF.goEl();
813
814	GRAF.scrollAnimation.init();
815	GRAF.animation.init();
816	GRAF.header.init();
817
818	window.initMap = function() {
819		GRAF.maps.init();
820	}
821
822	GRAF.sliders.init();
823
824	GRAF.icons.init();
825
826	GRAF.page.form.init();
827	GRAF.page.accordion.init();
828	GRAF.page.ajaxLoader();
829	GRAF.page.transformIcons();
830
831	GRAF.toggleElements();
832
833	GRAF.goTop();
834
835	GRAF.reload = function() {
836		GRAF.maps.init();
837		GRAF.sliders.init();
838	}
839	
840	GRAF.popup.init();
841
842})(jQuery);

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.