PageSourceSearch

https://www.flysaa.com/o/saa-airways-theme/airways-legacy/js/utils/carousel.js

js flysaa.com collected 2026-10-01 11:29:55 UTC 7,419 bytes, 204 lines download raw bytes

1'use strict';
2
3flysaa.carousel = {};
4
5// Library definition
6flysaa.carousel = (function () {
7
8    var init = function(id,hasLoop,hasNav,nItems,nItems992,nItems768,hasDots, hasAutoPlay, speed){
9        var $carouselList = jQuery(id),
10            classes       = $carouselList.attr('class'),
11            idElement    = $carouselList.attr('id');
12
13        $carouselList.wrap('<div class="'+classes+'" id="'+idElement+'"/>').contents().unwrap();
14        $carouselList = jQuery(id);
15        if (speed == undefined) speed=3000;
16        $carouselList.each(function(){
17            var $that = jQuery(this),
18                $play = $that.parents('.highlights').find('.playActiveBtn'),
19                $pause = $that.parents('.highlights').find('.pauseActiveBtn');
20            $that.slick({
21                slide: 'li',
22                infinite: hasLoop,
23                arrows:hasNav,
24                speed: 700,
25                slidesToShow: nItems,
26                centerMode: false,
27                variableWidth: false,
28                dots:hasDots,
29                lazyLoad: 'progressive',
30                prevArrow: $that.next('.carousel-options').find('.arrow-previous'),
31                nextArrow: $that.next('.carousel-options').find('.arrow-next'),
32                autoplay: hasAutoPlay,
33                autoplaySpeed: speed,
34                pauseOnHover: false,
35                responsive: [
36                    {
37                      breakpoint: 992,
38                      settings: {
39                        slidesToShow: nItems992,
40                        slidesToScroll: nItems992,
41                      }
42                    },
43                    {
44                      breakpoint: 768,
45                      settings: {
46                        slidesToShow: nItems768,
47                        slidesToScroll: nItems768
48                      }
49                    }
50                ]
51            });
52            if(jQuery.exists($pause)){
53                $pause.on('click', function() {
54                    var $pause = jQuery(this);
55                    $that.slick('slickPause');
56                    $pause.parents('.playPause').removeClass('pauseActive').addClass('playActive');
57                });
58            }
59            if(jQuery.exists($play)){
60                $play.on('click', function() {
61                    var $play = jQuery(this);
62                    $that.slick('slickPlay');
63                    $play.parents('.playPause').removeClass('playActive').addClass('pauseActive');
64                });
65            }
66            $('.slick-dots button').on('keydown', function(e) {
67               if (e.keyCode === 13) { //if press enter stop slider
68                   $pause.trigger('click');
69               }
70            });
71        });
72
73
74        jQuery('.arrow-next').click(function(e){
75            e.preventDefault();
76        });
77        jQuery('.arrow-previous').click(function(e){
78            e.preventDefault();
79        });
80      
81        preload();
82    };
83
84    var initv2 = function(id,hasLoop,hasNav,nItems,nItems992,nItems768,hasDots,hasAutoPlay,speed){
85        var $carouselList = jQuery(id),
86            classes       = $carouselList.attr('class'),
87            idElement    = $carouselList.attr('id');
88
89        $carouselList.wrap('<div class="'+classes+'" id="'+idElement+'"/>').contents().unwrap();
90        $carouselList = jQuery(id);
91        if (speed == undefined) speed=3000;
92        $carouselList.each(function(){
93            var $that = jQuery(this),
94                $play = $that.parents('.highlights').find('.playActiveBtn'),
95                $pause = $that.parents('.highlights').find('.pauseActiveBtn');
96            $that.slick({
97                slide: 'li',
98                infinite: hasLoop,
99                arrows: hasNav,
100                speed: 700,
101                fade: true,
102                cssEase: 'linear',
103                slidesToShow: nItems,
104                centerMode: false,
105                variableWidth: false,
106                dots:hasDots,
107                lazyLoad: 'progressive',
108                prevArrow: $that.prev(),
109                nextArrow: $that.next(),
110                autoplay: hasAutoPlay,
111                autoplaySpeed: speed,
112                pauseOnHover: false,
113                responsive: [
114                    {
115                      breakpoint: 992,
116                      settings: {
117                        slidesToShow: nItems992,
118                        slidesToScroll: nItems992,
119                      }
120                    },
121                    {
122                      breakpoint: 768,
123                      settings: {
124                        slidesToShow: nItems768,
125                        slidesToScroll: nItems768
126                      }
127                    }
128                ]
129            });
130            if(jQuery.exists($pause)){
131                $pause.on('click', function() {
132                    var $pause = jQuery(this);
133                    $that.slick('slickPause');
134                    $pause.parents('.playPause').removeClass('pauseActive').addClass('playActive');
135                });
136            }
137            if(jQuery.exists($play)){
138                $play.on('click', function() {
139                    var $play = jQuery(this);
140                    $that.slick('slickPlay');
141                    $play.parents('.playPause').removeClass('playActive').addClass('pauseActive');
142                });
143            }
144            $('.slick-dots button').on('keydown', function(e) {
145               if (e.keyCode === 13) { //if press enter stop slider
146                   $pause.trigger('click');
147               }
148            });
149        });
150
151        jQuery('.arrow-next').click(function(e){
152            e.preventDefault();
153        });
154        jQuery('.arrow-previous').click(function(e){
155            e.preventDefault();
156        });
157    };
158
159    //id,hasLoop,hasNav,nItems,nItems992,nItems768,hasDots,hasAutoPlay,speed
160    //'#carousel-home-container',true,true,1,1,1,false,false,2000
161    var initv2lazy = function(){
162        var $carouselList = jQuery('.highlights-autoplay-v2-lazy');
163        $carouselList.slick({
164            slide: 'li',
165            infinite: true,
166            arrows: true,
167            speed: 1000,
168            fade: true,
169            cssEase: 'linear',
170            slidesToShow: 1,
171            centerMode: false,
172            variableWidth: false,
173            dots:false,
174            lazyLoad: 'ondemand',
175            prevArrow: $carouselList.prev(),
176            nextArrow: $carouselList.prev().prev(),
177            autoplay: false,
178            autoplaySpeed: 2000
179        });
180        jQuery('.arrow-next').click(function(e){
181            e.preventDefault();
182        });
183        jQuery('.arrow-previous').click(function(e){
184            e.preventDefault();
185        });
186    };
187
188    var preload = function(){
189        var $elem = jQuery('#highlightsHome'),
190            $elemSlide = jQuery('#highlightsHome .slick-slide .highlights-image');
191        if(jQuery.exists($elem)){
192            setTimeout(function(){
193                $elemSlide.css('display','block');
194            }, 2000);
195        }
196    };
197
198    // Public API
199    return {
200        init: init,
201        initv2: initv2,
202        initv2lazy: initv2lazy
203    };
204}());

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.