PageSourceSearch

https://likta.lv/wp-content/plugins/likta-migrations/js/main.js?ver=20181010

js likta.lv collected 2026-10-03 21:56:55 UTC 7,788 bytes, 183 lines download raw bytes

1(function ($) {
2
3    $(window).resize(function () {
4        if (this.resizeTO) clearTimeout(this.resizeTO);
5        this.resizeTO = setTimeout(function () {
6            $(this).trigger('resizeEnd');
7        }, 300);
8    });
9
10    var LIKTANewsCarouselrun = function ($scope, $) {
11        
12        if ($().owlCarousel) {
13            console.log("carousel init");
14            var owl = $(".panel-grid-cell .likta-latest-news-wrapper");
15            owl.owlCarousel({
16                navigation: false,
17                pagination: true,
18                responsive: true,
19                items: 3,
20                itemsDesktopSmall: [1400, 2],
21                itemsTablet: [970, 3],
22                itemsTabletSmall: [600, 1],
23                itemsMobile: [360, 1],
24                touchDrag: true,
25                mouseDrag: true,
26                autoHeight: false,
27                autoPlay: false
28            }); // end owlCarousel
29
30        } // end if
31
32        if (anime()) {
33            $(window).bind('resizeEnd', function () {
34                updateElementAttributes();
35                // resizeFloatingPostSection();
36            });
37            updateElementAttributes();
38            resizeFloatingPostSection();
39        }
40
41        function updateElementAttributes() {
42            // set wrapper and element sizes
43            var wrapper = $('.panel-grid-cell .likta-latest-news-wrapper .owl-wrapper-outer');
44            var images = $('.panel-grid-cell .likta-latest-news-wrapper .owl-wrapper-outer img');
45            var firstHeight, secondHeight, thirdHeight;
46
47            if ($(window).width() > 600) {
48                firstHeight = (wrapper.width() * 0.57 * 9) / 16;
49                secondHeight = (wrapper.width() * 0.44 * 9) / 16;
50                thirdHeight = (wrapper.width() * 0.38 * 9) / 16;
51
52                $('.panel-grid-cell .likta-latest-news-wrapper .owl-item:nth-child(1) img').height(firstHeight);
53                $('.panel-grid-cell .likta-latest-news-wrapper .owl-item:nth-child(2) img').height(secondHeight);
54                $('.panel-grid-cell .likta-latest-news-wrapper .owl-item:nth-child(3) img').height(thirdHeight);
55
56                if ($(window).width() > 970) {
57                    wrapper.height(wrapper.width() * 0.78);
58
59                    $('.panel-grid-cell .likta-latest-news-wrapper .owl-item:nth-child(1)')
60                        .css({
61                            'width': wrapper.width() * 0.57,
62                            'position': 'absolute',
63                            'margin-left': wrapper.width() * 0.225,
64                            'z-index': 10
65                        });
66                    $('.panel-grid-cell .likta-latest-news-wrapper .owl-item:nth-child(2)').attr('data-parallax', '{' +
67                        'translateY: [' + (wrapper.height() * 0.6) + ', ' + (wrapper.height() * 0.3) + '],' +
68                        'translateX: [0, ' + (wrapper.width() * 0.1) + ']' +
69                        '}')
70                        .css({
71                            'width': wrapper.width() * 0.44,
72                            'position': 'absolute',
73                            'margin-left': 0
74                        });
75                    $('.panel-grid-cell .likta-latest-news-wrapper .owl-item:nth-child(3)').attr('data-parallax', '{' +
76                        'translateY: [' + (wrapper.height() * 0.65) + ', ' + (wrapper.height() * 0.35) + '],' +
77                        'translateX: [0, -' + (wrapper.width() * 0.1) + ']' +
78                        '}')
79                        .css({
80                            'width': wrapper.width() * 0.38,
81                            'position': 'absolute',
82                            'margin-left': wrapper.width() * 0.62
83                        });
84
85                } else {
86                    // greater than 600
87                    wrapper.height(wrapper.width() * 1);
88
89                    $('.panel-grid-cell .likta-latest-news-wrapper .owl-item:nth-child(1)')
90                        .css({
91                            'width': wrapper.width() * 0.57,
92                            'position': 'absolute',
93                            'margin-left': wrapper.width() * 0.225,
94                            'z-index': 10
95                        });
96                    $('.panel-grid-cell .likta-latest-news-wrapper .owl-item:nth-child(2)').attr('data-parallax', '{' +
97                        'translateY: [' + (wrapper.height() * 0.5) + ', ' + (wrapper.height() * 0.3) + '],' +
98                        'translateX: [0, ' + (wrapper.width() * 0.1) + ']' +
99                        '}')
100                        .css({
101                            'width': wrapper.width() * 0.44,
102                            'position': 'absolute',
103                            'margin-left': 0
104                        });
105                    $('.panel-grid-cell .likta-latest-news-wrapper .owl-item:nth-child(3)').attr('data-parallax', '{' +
106                        'translateY: [' + (wrapper.height() * 0.54) + ', ' + (wrapper.height() * 0.37) + '],' +
107                        'translateX: [0, -' + (wrapper.width() * 0.1) + ']' +
108                        '}')
109                        .css({
110                            'width': wrapper.width() * 0.38,
111                            'position': 'absolute',
112                            'margin-left': wrapper.width() * 0.62
113                        });
114                }
115
116            } else {
117                wrapper.removeAttr('style');
118                images.removeAttr('style');
119
120                $('.panel-grid-cell .likta-latest-news-wrapper .owl-item').each(function () {
121                    $(this).css({
122                        'position': '',
123                        'margin-left': '',
124                        'transform': ''
125                    }).attr('data-parallax', '');
126                });
127
128            }
129
130            $("[data-parallax]").each(function () {
131                initParallax(this)
132            })
133        };
134
135        function initParallax(element) {
136            var $this = $(element);
137            var animetl = anime.timeline({autoplay: false});
138            var properties = {
139                targets: $this[0],
140                easing: "linear"
141            };
142
143            // Parse properties from attribute and add them to properties object
144            $.each($this.attr("data-parallax").split(/[,\s]+(?={)/), function (i, value) {
145                if (value != '') {
146                    $.extend(properties, eval("(" + value + ")"));
147                }
148            });
149
150            animetl.add(properties); // add options object to timeline
151
152            var parallaxSetup = function () {
153                if ($(window).width() > 600) {
154                    var bound = $this[0].getBoundingClientRect();
155                    var wHeight = $(window).height();
156                    if (bound.top < wHeight && bound.bottom > 0) {
157                        animetl.seek(animetl.duration * ((wHeight - bound.top) / (wHeight + bound.height)).toFixed(3));
158                    } else {
159                        if (bound.top >= wHeight) {
160                            animetl.seek(0);
161                        } else if (bound.bottom <= 0) {
162                            animetl.seek(animetl.duration)
163                        }
164                    }
165                }
166            };
167
168            $(window).on("resize scroll", parallaxSetup);
169            setTimeout(parallaxSetup, 50);
170
171        };
172
173        function resizeFloatingPostSection() {
174            $('.elementor-widget-likta-posts').closest('section').width($('#content').width())
175        }
176    };
177
178
179    $(window).on('elementor/frontend/init', function () {
180        elementorFrontend.hooks.addAction('frontend/element_ready/likta-posts.default', LIKTANewsCarouselrun);
181    });
182
183})(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.