PageSourceSearch

https://www.mrapple.se/wp-content/themes/delirium/js/jquery.featuredSlider.js?ver=20140127

js mrapple.se collected 2026-09-25 12:32:20 UTC 4,423 bytes, 141 lines download raw bytes

1jQuery(document).ready(function($) {
2    featured_slider = JSON.parse(featured_slider);
3
4    var prevWidth;
5    var prevSlide;
6    var breakpoint = 1030;
7
8    $(window).on('resize', function() {
9        initCarouFredSel();
10    });
11
12    function initCarouFredSel() {
13        var windowWidth = $(window).width();
14
15        if (prevWidth) {
16            if (prevWidth < breakpoint && windowWidth < breakpoint) return;
17            if (prevWidth > breakpoint && windowWidth > breakpoint) return;
18        }
19
20        var defaultOptions = {
21            width: '100%',
22            items: {
23                visible: 3,
24                start: -1,
25                height: "50%"
26            },
27            scroll: {
28                items: 1,
29                duration: 600,
30                timeoutDuration: featured_slider.slideshow_speed,
31                onBefore: beforeSliding
32            },
33            swipe: {
34                onTouch: true
35            },
36            prev: '#prev',
37            next: '#next',
38            pagination: {
39                container: '#pager',
40                deviation:1
41            },
42            auto: {
43                play: featured_slider.autoplay
44            },
45            onCreate: function() {
46                beforeSliding();
47                $('#carousel-wrap').addClass('carousel--loaded');
48            }
49        };
50
51        var smallScreenOptions = $.extend(true, {}, defaultOptions);;
52        smallScreenOptions.responsive = true;
53        smallScreenOptions.items.visible = 1;
54        smallScreenOptions.items.start = 0;
55        smallScreenOptions.pagination.deviation = 0;
56
57        if (windowWidth > breakpoint) {
58            $('#carousel').carouFredSel(defaultOptions);
59            $('#carousel').trigger('slideTo', -1);
60        } else {
61            $('#carousel').carouFredSel(smallScreenOptions);
62            $('#carousel').trigger('slideTo', 0);
63        }
64
65        prevWidth = windowWidth;
66    }
67
68    function beforeSliding(data) {
69        var $carousel = $('#carousel');
70        var $items;
71        $carousel.children().removeClass('active');
72        $carousel.find('.video_cover').empty();
73
74        if (data) {
75            $items = data.items.visible;
76        } else {
77            $items = $carousel.triggerHandler('currentVisible');
78        }
79
80        var slide;
81        if ($items.length == 3) {
82            slide = $items.get(1);
83        } else {
84            slide = $items.get(0);
85        }
86
87        $(slide).addClass('active');
88        var videoCover = $(slide).find('.video_cover');
89        var embedCode = videoCover.data('embed');
90
91        if (embedCode) {
92            videoCover.html(embedCode);
93
94            /* Enable Video API if autoplay is enabled */
95            if (featured_slider.autoplay) {
96                var youtubeSelectors = [
97                    "iframe[src*='youtube.com']",
98                    "iframe[src*='youtube-nocookie.com']",
99                ];
100
101                var vimeoSelectors = [
102                    "iframe[src*='player.vimeo.com']"
103                ];
104
105                var $ytVideo = videoCover.find(youtubeSelectors.join(','));
106                var $vimeoVideo = videoCover.find(vimeoSelectors.join(','));
107
108                if ($ytVideo.length) {
109                    var src = $ytVideo.prop('src');
110                    if (src.indexOf("?") > -1) {
111                        $ytVideo.prop('src', src + '&enablejsapi=1');
112                    } else {
113                        $ytVideo.prop('src', src + '?enablejsapi=1');
114                    }
115
116                    new YT.Player($ytVideo.get(0), {
117                        events: {
118                            'onStateChange' : onYoutubeStateChange
119                        }
120                    })
121                }
122
123                if ($vimeoVideo.length) {
124                    var src = $vimeoVideo.prop('src');
125                    if (!$vimeoVideo.prop('id')) {
126                        $vimeoVideo.prop('id', 'vimeo' + Math.floor(Math.random()*999999));
127                    }
128                    $vimeoVideo.prop('src', src + '&api=1&player_id=' + $vimeoVideo.prop('id'));
129
130                    var player = $f($vimeoVideo.get(0));
131                    player.addEvent('ready', function() {
132                        player.addEvent('play', stopFeaturedSlider);
133                    });
134                }
135            }
136        }
137    }
138
139    /* First init on after page load */
140    initCarouFredSel();
141});

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.