PageSourceSearch

https://www.akvapark.lt/themes/aqua/js/app.js?m=1605787072

js akvapark.lt collected 2026-10-02 07:21:46 UTC 24,909 bytes, 793 lines download raw bytes

1var AQUA = window.AQUA || {};
2window.AQUA = AQUA;
3
4
5$(function() {
6
7    AQUA.documentReady = {
8        _window: $(window),
9        indexSwiper: null,
10        init: function() {
11            AQUA.windowLoad.init();
12            this.initFancybox();
13            this.initSwiperIndex();
14            this.initSwiperInner();
15            this.initSwiperGallery();
16            this.initRoomGallery();
17            this.shrinkSlider();
18            this.initHoverListeners();
19            this.initClickListeners();
20            this.initDatepickerToggles();
21            this.initModals();
22            this.initHeadroom();
23            this.initCollapse();
24        },
25        initSwiperIndex: function() {
26
27            var self = this;
28            var $mainSwipeWrap = $('.swiper-index-hero');
29            var $mainSwiperActions = $('.index-nav-link');
30
31            if ($mainSwipeWrap.length) {
32
33                self.indexSwiper = new Swiper($mainSwipeWrap, {
34                    slidesPerView: 1,
35                    centeredSlides: true,
36                    slideToClickedSlide: true,
37                    observeParents: true,
38                    speed: 1200,
39                    effect: 'fade',
40                    autoplay: true,
41                    allowTouchMove: false,
42                    simulateTouch: false,
43                    shortSwipes: false,
44                    longSwipes: false,
45                    followFinger: false,
46                    allowTouchMove: false,
47                    breakpoints: {
48                        320: {
49                            autoplay: {
50                                delay: 5000
51                            },
52                        },
53                        768: {
54                            autoplay: {
55                                delay: 12000
56                            },
57                        },
58                    }
59
60                });
61
62                if (self._window.width() >= 767) {
63                    $mainSwiperActions.mouseenter(function() {
64                        var $self = $(this);
65                        self.indexSwiper.slideTo($self.index());
66                    });
67                }
68
69            }
70
71        },
72        initSwiperInner: function() {
73            var $offerSwipeWrap = $('.swiper-offers');
74            var offerSwiperObj = new Swiper($offerSwipeWrap, {
75                slidesPerView: 1,
76                loop: true,
77                centeredSlides: true,
78                slideToClickedSlide: true,
79                grabCursor: false,
80                speed: 1500,
81                pagination: {
82                    el: '.swiper-offers-pagination',
83                    type: 'fraction'
84                },
85                effect: 'fade',
86                fadeEffect: {
87                    crossFade: true
88                },
89                autoplay: {
90                    delay: 5000,
91                    disableOnInteraction: false
92                },
93                breakpoints: {
94                    320: {
95                        autoHeight: true
96                    },
97                    768: {
98                        autoHeight: false
99                    },
100                },
101            });
102
103            $('.swiper-offers-button-prev').on('click', function(e) {
104                e.preventDefault();
105                offerSwiperObj.slidePrev();
106            });
107
108            $('.swiper-offers-button-next').on('click', function(e) {
109                e.preventDefault();
110                offerSwiperObj.slideNext();
111            });
112        },
113        initSwiperGallery: function() {
114            var $gallerySwipeWrap = $('.swiper-gallery');
115            var gallerySwiperObj = new Swiper($gallerySwipeWrap, {
116                slidesPerView: 1.8,
117                slidesPerGroup: 1,
118                spaceBetween: 40,
119                loop: true,
120                centeredSlides: true,
121                centeredSlidesBounds: true,
122                speed: 800,
123                grabCursor: false,
124                autoplay: {
125                    delay: 8000,
126                    disableOnInteraction: true
127                },
128                on: {
129                    init: function() {
130                        $().fancybox({
131                            selector : '.swiper-slide:not(.swiper-slide-duplicate) [data-fancybox="gallery"]',
132                        });
133                    }
134                },
135                breakpoints: {
136                    320: {
137                        slidesPerView: 1.2,
138                        slidesPerGroup: 1,
139                        spaceBetween: 10,
140                    },
141                    640: {
142                        slidesPerView: 2,
143                    },
144                    1024: {
145                        slidesPerView: 1.8,
146                        slidesPerGroup: 1,
147                        spaceBetween: 40,
148                    }
149                }
150
151            });
152
153            $('.swiper-gallery-button-prev').on('click', function(e) {
154                e.preventDefault();
155                gallerySwiperObj.slidePrev();
156            });
157
158            $('.swiper-gallery-button-next').on('click', function(e) {
159                e.preventDefault();
160                gallerySwiperObj.slideNext();
161            });
162        },
163        initRoomGallery: function() {
164            var $gallerySwipeWrap = $('.swiper-room-gallery');
165
166            $gallerySwipeWrap.each(function() {
167
168                var $self = $(this);
169                var items = $self.find('.swiper-slide').length;
170
171                var gallerySwiperObj = new Swiper($self, {
172                    slidesPerView: 1,
173                    loop: items >= 2 ? true : false,
174                    centeredSlides: true,
175                    slideToClickedSlide: true,
176                    speed: 1500,
177                    pagination: {
178                        el: $self.find('.swiper-room-gallery-pagination'),
179                        type: 'fraction'
180                    },
181                    effect: 'fade',
182                    grabCursor: false,
183                    on: {
184                        init: function() {
185
186                            $().fancybox({
187                                selector : '.swiper-slide:not(.swiper-slide-duplicate) [data-fancybox="gallery-'+$self.data('fancyid')+'"]',
188                                hash: false
189                            });
190                        }
191                    },
192                });
193
194                $self.find('.swiper-room-gallery-button-prev').on('click', function(e) {
195                    e.preventDefault();
196                    gallerySwiperObj.slidePrev();
197                });
198
199                $self.find('.swiper-room-gallery-button-next').on('click', function(e) {
200                    e.preventDefault();
201                    gallerySwiperObj.slideNext();
202                });
203
204            });
205
206
207        },
208        shrinkSlider: function() {
209
210            var self = this;
211            var $shrinkChild = $('#hero-shrink-child');
212            var $shrinkParent = $('#hero-shrink-parent');
213
214
215            if (self._window.width() >= 767) {
216
217                $shrinkParent.height(window.innerHeight);
218                $shrinkChild.css({
219                    'width': window.innerWidth,
220                    'height': window.innerHeight,
221                    'position': 'fixed',
222                    'top': 0
223                });
224            } else {
225
226                console.log(1);
227                $shrinkParent.css({
228                    'min-height': window.innerHeight
229                });
230                $shrinkChild.removeAttr('style');
231            }
232
233        },
234        pageAnimations: function() {
235
236            $('[data-waypoints="true"]').each(function() {
237                var $self = $(this);
238                $self.waypoint({
239                    triggerOnce: true,
240                    handler: function() {
241                        $self.addClass('waypoint-first');
242                        setTimeout(function() {
243                            $self.addClass('waypoint-second');
244                        }, 150);
245                    },
246                    offset: '99%'
247                });
248            });
249
250
251            var $offersWaypoint = $('#offers-waypoint');
252            $offersWaypoint.waypoint({
253                triggerOnce: true,
254                handler: function() {
255                    $offersWaypoint.addClass('waypoint-first');
256                    setTimeout(function() {
257                        $offersWaypoint.addClass('waypoint-second');
258                    }, 300);
259                },
260                offset: '40%'
261            });
262
263        },
264        initHoverListeners: function() {
265
266            var self = this;
267            var $listeners = $('.listen-enter');
268            var $listenersParent = $listeners.parent();
269            if (self._window.width() >= 767) {
270                $listeners.mouseenter(function() {
271                    $listenersParent.addClass('add-hover');
272                }).mouseleave(function() {
273                    $listenersParent.removeClass('add-hover');
274                });
275            }
276
277        },
278        initClickListeners: function() {
279
280            var self = this;
281            var $mobileMenu = $('.header-menu-box-mobile-trigger');
282
283            $mobileMenu.click(function() {
284                var $self = $(this);
285                $self.toggleClass('is-active');
286            });
287
288        },
289        initDatepickerToggles: function() {
290
291            var $buttons = $('.form-datepicker-trigger');
292
293            $buttons.on('click', function(e) {
294                var $self = $(this);
295                $self.parent().find('.datepicker').datepicker('show');
296                e.preventDefault();
297            });
298
299        },
300        initModals: function() {
301
302
303            var self = this;
304
305            var $modalframe = $('#video-id');
306            $('#modal-video-play').on('shown.bs.modal', function(e) {
307
308                var $clicker = $(e.relatedTarget);
309                var youtubeUrlRaw = $clicker.attr('data-youtube-url') ? $clicker.attr('data-youtube-url') : '';
310                var youtubeUrl = 'https://www.youtube.com/embed/';
311                var autoplay = $clicker.data('autoplay') ? true : false;
312                var youtubeID;
313
314
315                youtubeID = _getYoutubeId(youtubeUrlRaw);
316
317                if (youtubeID) {
318                    youtubeUrl += youtubeID;
319                }
320
321                if (autoplay) {
322                    youtubeUrl += '?rel=0&autoplay=1';
323                }
324
325                $modalframe.attr('src', youtubeUrl);
326            }).on('hide.bs.modal', function(e) {
327                $modalframe.attr('src', '');
328            });
329
330
331            $('.modal-gallery-photo').on('shown.bs.modal', function(e) {
332                //self.initModalsSwiper();
333                $('.select-gallery-id').trigger('change');
334                self._removeElementPreloader($('.modal-gallery-photo-bottom'));
335            });
336
337
338        },
339        initModalsSwiper: function() {
340            var galleryThumbs = new Swiper('.swiper-modal-gallery-thumbs', {
341                spaceBetween: 10,
342                slidesPerView: 'auto',
343                loop: false,
344                watchSlidesVisibility: true,
345                watchSlidesProgress: true,
346                autoplay: 0,
347                navigation: {
348                    nextEl: '.swiper-mgt-next',
349                    prevEl: '.swiper-mgt-prev',
350                },
351                breakpoints: {
352
353                }
354
355            });
356            var galleryTop = new Swiper('.swiper-modal-gallery', {
357                loop: true,
358                effect: 'fade',
359                keyboard: {
360                    enabled: true,
361                },
362                autoplay: {
363                    delay: 8000,
364                    disableOnInteraction: false
365                },
366                navigation: {
367                    nextEl: '.swiper-mg-next',
368                    prevEl: '.swiper-mg-prev',
369                },
370                thumbs: {
371                    swiper: galleryThumbs,
372                },
373            });
374
375            var $galleryModal = $('.modal-gallery-photo');
376
377            $galleryModal.mouseenter(function() {
378                $galleryModal.removeClass('hide-thumbs');
379            }).mouseleave(function() {
380                // setTimeout(function() {
381                //     $galleryModal.addClass('hide-thumbs');
382                // }, 10000);
383            });
384
385
386        },
387        initHeadroom: function() {
388            var options = {
389                offset: window.innerHeight,
390            };
391            var header = document.getElementById('app-header');
392            var headroom = new Headroom(header, options);
393            headroom.init();
394        },
395        initFancybox: function() {
396
397            var $fancyBoxGallery = $('[data-fancybox="gallery"]');
398
399            $fancyBoxGallery.fancybox({
400                toolbar: false,
401                hash: false,
402                backFocus: false,
403                animationEffect: 'fade',
404                clickOutside: 'close',
405                wheel: false,
406                thumbs: {
407                    autoStart: true,
408                    hideOnClose: true,
409                    parentEl: '.fancybox-container',
410                    axis: 'x'
411                },
412                clickContent: function(current, event) {
413                    return false;
414                },
415                mobile: {
416                    dblclickContent: function(current, event) {
417                        return false;
418                    },
419                    dblclickSlide: function(current, event) {
420                        return false;
421                    }
422                },
423                buttons: [
424                    "close"
425                ],
426            });
427
428        },
429        initCollapse: function() {
430
431            var $root = $('html, body');
432
433            $('.expand-item .collapse').on('shown.bs.collapse', function() {
434                var $self = $(this);
435
436                $root.stop().animate({
437                    scrollTop: $self.offset().top - 152
438                }, 500, function() {});
439
440            });
441
442
443            $root.bind('scroll mousedown DOMMouseScroll mousewheel keyup touchstart', function(e) {
444                if (e.which > 0 || e.type === 'mousedown' || e.type === 'mousewheel' || e.type === 'touchstart') {
445                    $root.stop();
446                }
447            });
448
449
450        },
451        initInfoBar: function() {
452          var $target = $('#info-bar-init');
453          //give it a breath and show it up
454          setTimeout(function() {
455            if($target.length) {
456              $target.addClass('active');
457            }
458          }, 2000);
459        },
460        initInfoModals: function() {
461          //give it a breath and show it up
462          setTimeout(function() {
463            if($('#modal-info').length) {
464              $('#modal-info').modal('show');
465            }
466          }, 1000);
467        },
468        _removeElementPreloader: function(target) {
469            if (target) {
470                setTimeout(function() {
471                    $(target).removeAttr('elm-preload');
472                }, 200);
473            }
474        }
475    };
476    AQUA.documentResize = {
477        init: function() {
478            if (AQUA.documentReady.indexSwiper) {
479                AQUA.documentReady.shrinkSlider();
480                AQUA.documentReady.indexSwiper.update();
481            }
482        },
483    };
484    AQUA.windowLoad = {
485        init: function() {
486            this.initCookies();
487            AQUA.documentReady.pageAnimations();
488            $('#app-page-loader').addClass('loaded');
489            $('#main').removeClass('app-loading');
490        },
491        initCookies: function() {
492
493            var CHECK_COOKIE = _checkCookie('cookiebar');
494            if (CHECK_COOKIE) {
495                $('#cookiebar').hide();
496            } else {
497                $('#cookiebar').fadeIn();
498            }
499            $('#cookieaccept').click(function(e) {
500                _setCookie('cookiebar', true, 30);
501                $('#cookiebar').fadeOut();
502                e.preventDefault();
503            });
504
505
506            var INFO_COOKIE = _checkCookie('infobar');
507            if (!INFO_COOKIE) {
508              AQUA.documentReady.initInfoBar();
509            }
510            $('#info-bar-close').click(function(e) {
511                _setCookie('infobar', true);
512                $('#info-bar-init').removeClass('active');
513                e.preventDefault();
514            });
515
516            var INFO_MODAL = _checkCookie('infomodal');
517            if (!INFO_MODAL) {
518              AQUA.documentReady.initInfoModals();
519            }
520            $('#modal-info').on('hidden.bs.modal', function (e) {
521              _setCookie('infomodal', true);
522            });
523
524
525            function _setCookie(cname, cvalue, exdays) {
526                var d = new Date();
527                d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
528                var expires = 'expires=' + d.toUTCString();
529                document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
530            }
531
532            function _getCookie(cname) {
533                var name = cname + '=';
534                var ca = document.cookie.split(';');
535                for (var i = 0; i < ca.length; i++) {
536                    var c = ca[i];
537                    while (c.charAt(0) == ' ') {
538                        c = c.substring(1);
539                    }
540                    if (c.indexOf(name) == 0) {
541                        return c.substring(name.length, c.length);
542                    }
543                }
544                return '';
545            }
546
547            function _checkCookie(cookieName) {
548                var cookie = _getCookie(cookieName);
549                if (cookie != '') {
550                    return true;
551                } else {
552                    return false;
553                }
554            }
555        }
556    };
557
558
559    var resizeTimeout;
560
561    var $_window = $(window),
562        $_html = $('html'),
563        $_body = $('body');
564
565    var MAIN_BREAIKPOINTS = {
566        xsmall: 479,
567        small: 767,
568        medium: 1025,
569        large: 1239,
570        menu: 1023,
571        filters: 1140
572    };
573
574    //dom ready
575    AQUA.documentReady.init();
576
577
578    var cachedWidth = $_window.width();
579    $_window.resize(function() {
580        var newWidth = $(window).width();
581        if (newWidth !== cachedWidth) {
582            _resizer();
583            cachedWidth = newWidth;
584        }
585    });
586
587    $_window.on('load', function() {
588        //AQUA.windowLoad.init();
589    });
590
591    var MENU_HOLDER = document.getElementById('menu-toggle');
592    var MENU_CLOSE = document.getElementById('menu-close');
593    var MENU_BURGER = document.getElementById('menu-burger');
594
595    //DOM ready functions
596
597    //form focus behaviour
598    runFocus();
599
600    //Function adding os/browsere classes to body.
601    addBrowsers();
602
603    //enable main menu funcionality
604    mainMenuCollapse();
605
606    //enable main search functionality
607    //mainSearchCollapse();
608
609    //enable all tables wrapping to div
610    runWyswigTables();
611
612    //initialize object fit polyfill.
613    //objectFitInit();
614
615    //initialize smoozie scrolling
616    runScroll();
617
618    // Private functions
619    function _resizer(win_w) {
620        window.clearTimeout(resizeTimeout);
621        resizeTimeout = setTimeout(function() {
622            AQUA.documentResize.init();
623        }, 200);
624    }
625
626    function _smoothScroll(target, offset) {
627        var topOffset = offset ? offset : 0;
628        $('html, body').animate({
629            'scrollTop': $(target).offset().top - topOffset
630        }, 1200, 'swing', function() {});
631    }
632
633    function _getYoutubeId(url) {
634        var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
635        var match = url.match(regExp);
636        return (match && match[7].length == 11) ? match[7] : false;
637    }
638
639    function objectFitInit() {
640        var $objectFillImages = $('.img-objectfill');
641        objectFitImages($objectFillImages);
642    }
643
644    function _toggleClassMenu() {
645        if (!MENU_HOLDER.classList.contains('menu--visible')) {
646            MENU_HOLDER.classList.add('menu--visible');
647            setTimeout(function() {
648                _onTransitionStart();
649            }, 500);
650        } else {
651            MENU_HOLDER.classList.add('menu--closing');
652            MENU_HOLDER.classList.remove('menu--visible');
653            MENU_BURGER.classList.remove('is-active');
654            $_html.removeClass('menu-open');
655            _onTransitionEnd();
656            _onMenuClose();
657        }
658    }
659
660    function _onTransitionStart() {
661        MENU_HOLDER.classList.add('menu--animatable');
662    }
663
664    function _onTransitionEnd() {
665        MENU_HOLDER.classList.remove('menu--animatable');
666    }
667
668    function _onMenuClose() {
669        setTimeout(function() {
670            MENU_HOLDER.classList.remove('menu--closing');
671        }, 500);
672    }
673
674    function mainMenuCollapse() {
675
676        //main menu
677        $(MENU_BURGER).click(function() {
678            $(this).toggleClass('is-active');
679            $_html.addClass('menu-open');
680        });
681
682        MENU_BURGER.addEventListener('click', _toggleClassMenu, false);
683        MENU_CLOSE.addEventListener('click', _toggleClassMenu, false);
684
685        var $mainMenuLinks = $('.menu-holder-menu .has-child');
686        var $mainMenuChild = $('.menu-holder-child');
687
688        $mainMenuLinks.click(function(e) {
689
690            var $self = $(this);
691            var $child = $self.next('ul');
692
693            if (!$child.hasClass('menu-holder-child-active')) {
694                $mainMenuChild.removeClass('menu-holder-child-active');
695                $child.addClass('menu-holder-child-active');
696            } else {
697                $child.removeClass('menu-holder-child-active');
698            }
699
700            e.preventDefault();
701        });
702
703    }
704
705    function addBrowsers() {
706        var result = browserDetect();
707        $_html.addClass('browser-' + result.name + ' os-' + result.os.replace(/ /g, '-') + ' is-mobile-' + result.mobile + ' version-' + result.versionNumber);
708    }
709
710    function runWyswigTables() {
711        var $tables = $('.simple-content table');
712
713        if ($tables.length) {
714            $tables.each(function() {
715                var tableIsPrice = $(this).hasClass('prices-table') ? 'table-price-wrap' : 'table-simple-wrap';
716                $(this).wrap('<div class="table-responsive ' + tableIsPrice + '"></div>');
717            });
718        }
719
720        var $pricesTables = $('.prices-table');
721        if ($pricesTables.length && $_window.width() <= 767) {
722            $pricesTables.each(function() {
723                var tableHeaderH = 0;
724                var $tableHeader = $(this).find('th');
725                var $tableBordered = $(this).find('.prices-row-bordered');
726                if ($tableBordered.length) {
727                    $tableBordered.each(function() {
728                        tableHeaderH += $(this).innerHeight();
729                    });
730                    $tableHeader.css({
731                        'min-height': tableHeaderH
732                    });
733                }
734            });
735        }
736
737    }
738
739    function runScroll() {
740        $('.scroll').click(function(e) {
741            var $self = $(this);
742            var target;
743            var offset = 40;
744
745            if ($self.data('offset')) {
746                offset = $self.data('offset');
747            }
748            if ($self.data('offset') && $_window.width() <= 767) {
749                offset = $self.data('mobile-offset');
750            }
751            if ($self.attr('href')) {
752                target = $self.attr('href').split('#'); //some cms add backslash so remove it
753                target = '#' + target[1];
754                if ($(target).length) {
755                    _smoothScroll(target, offset);
756                } else {
757                    window.location.replace($self.attr('href'));
758                }
759            }
760
761            e.preventDefault();
762        });
763    }
764
765    function runFocus() {
766        $('.form-control').focus(function() {
767            $(this).parents('.form-group').addClass('form-focus');
768        }).blur(function() {
769            $(this).parents('.form-group').removeClass('form-focus');
770            if ($.trim(this.value) == '') {
771                $(this).parents('.form-group').removeClass('form-filled');
772            } else {
773                $(this).parents('.form-group').addClass('form-filled');
774            }
775        });
776    }
777
778    function getUrlParameter(sParam) {
779        var sPageURL = decodeURIComponent(window.location.search.substring(1)),
780            sURLVariables = sPageURL.split('&'),
781            sParameterName,
782            i;
783
784        for (i = 0; i < sURLVariables.length; i++) {
785            sParameterName = sURLVariables[i].split('=');
786
787            if (sParameterName[0] === sParam) {
788                return sParameterName[1] === undefined ? true : sParameterName[1];
789            }
790        }
791    }
792
793});

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.