PageSourceSearch

https://podarok-expert.com/wp-content/themes/podarok/src/scripts.js

js podarok-expert.com collected 2026-10-09 21:48:05 UTC 5,050 bytes, 102 lines download raw bytes

1(function($){
2    $(function () {
3
4        // Карусель
5        var owl = $('.owl-carousel');
6        owl.owlCarousel({autoplay:true,slideBy:4, loop: true,margin: 30, nav: false,dots: false,dotsEach:true, responsive: {0: {items:1},600: {items: 1},1000: {items: 4}}});
7        owl.on('translate.owl.carousel', function(event) {
8            var myLazyLoad = new LazyLoad({elements_selector: "[data-src],[data-bg]",load_delay: 0});
9            myLazyLoad.update();
10        })
11        $('.owl-prev').on('click',function () {
12            $($(this).attr('data-owl')).trigger('next.owl.carousel');
13        })
14        $('.owl-next').on('click',function () {
15            $($(this).attr('data-owl')).trigger('prev.owl.carousel');
16        })
17
18        //Случайнвй пост
19        $('button.refresh').on('click',function () {
20            var items =  $($(this).attr('data-target')).find('.collapse:not(.show)');
21            var rand_num = Math.floor(Math.random()* items.length);
22            $($(this).attr('data-target')).find('.collapse.show').removeClass('show');
23            items.eq(rand_num).addClass('show');
24        })
25
26        //Ajax - Загрузить ещё
27        $('.ajax-load-b').click(function(e){
28            e.preventDefault();
29            var el = $(this);
30            var href = el.attr('href');
31            var index = $('.posts-grid').index(el.parent().parent().find('.posts-grid'));
32            el.css('pointer-events','none');
33            el.find('.arrow').removeClass('icon arrow').addClass('spinner-border spinner-border-sm');;
34            $.get( href, function(data){
35                var content = $('.posts-grid:eq('+ index +')', data).wrapInner('').html();
36                $(content).appendTo('.posts-grid:eq('+ index +')');
37                href = $( '.posts-grid:eq('+ index +') + #ajax-load .ajax-load-b', data ).attr('href');
38                $( '.posts-grid:eq('+ index +') + #ajax-load + .pagination-number').html($( '.posts-grid:eq('+ index +') + #ajax-load + .pagination-number', data ).html());
39                el.find('span').removeClass('spinner-border spinner-border-sm').addClass('icon arrow');
40                var ajax_btn =  el.parent();
41                var ajax_btn_new = $( '.posts-grid:eq('+ index +') + #ajax-load', data );
42
43                if($('.posts-grid:eq('+ index +') .ajax-load').length) {
44                    ajax_btn_new = $( '.posts-grid:eq('+ index +') .ajax-load:last-child' );
45                    href = ajax_btn_new.find('.ajax-load-b').attr('href');
46                    ajax_btn.appendTo($('.posts-grid:eq(' + index + ')'));
47                    console.log(ajax_btn);
48                }
49
50                if(href){
51                    ajax_btn.find('a').html(ajax_btn_new.find('a').html());
52                    el.css('pointer-events','unset');
53                    el.attr('href',href);
54                    ajax_btn_new.remove();
55                } else {el.hide();}
56
57                //Загружаем изображения если есть
58                var myLazyLoad = new LazyLoad({elements_selector: "[data-src],[data-bg]",load_delay: 0});
59                myLazyLoad.update();
60            });
61        });
62
63        //////////////////////////////////////////////
64        //Просмотр статьи ++ ////////
65        if ($('#views_count').length>0){
66            var data = {action: 'set_post_views',id: $('#views_count').attr('data-id')};
67            $.post('/wp-admin/admin-ajax.php', data, function(response) {
68                $('#views_count .count').html(response.count);
69            },'json');
70        }
71        //////////////////////////////////////////////
72        //Лайк статьи ++ ////////
73        $('#add_gifts').on('click',function () {
74            var btn = $(this);
75            var data = {action: 'add_post_gifts',id: btn.attr('data-id')};
76            $.post('/wp-admin/admin-ajax.php', data, function(response) {
77                $('#add_'+btn.attr('data-id')+' .count').html(response.count);
78                btn.addClass('disabled').attr('disabled',true).html('Спасибо!');
79            },'json');
80        })
81
82        //////////////////////////////////////////////
83        //Голосование ////////
84        $('#vote-block button').on('click',function () {
85            var btn = $(this);
86            var vote =  btn.closest('#vote-block');
87            var data = {action: 'vote_post',num: btn.attr('data-num'),id: btn.attr('data-id')};
88            $(this).closest('.col').addClass('active');
89            $.post('/wp-admin/admin-ajax.php', data, function(response) {
90                btn.parent().find('.count').text(response.count);
91                vote.find('button').remove();
92                vote.find('span').removeClass('d-none');
93                vote.find('.hide-btn').addClass('show');
94                vote.addClass('selected');
95                console.log(response);
96            },'json');
97        })
98    });
99
100
101})(jQuery);
102

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.