PageSourceSearch

https://prazdnik.prichod.ru/wp-content/themes/prihod/js/script.js?ver=1774615397

js prichod.ru collected 2026-10-02 04:48:58 UTC 6,954 bytes, 212 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3    /*
4    $('iframe.wp-iframe-pdf').each(function() {
5        var iframeSrc = $(this).attr('src');
6        
7        // Создаем элемент ссылки (<a>)
8        var downloadLink = $('<a>', {
9            href: iframeSrc,
10            text: 'Скачать PDF',
11            class: 'download-link', // можете добавить CSS-класс для стилизации
12            target: '_blank' // открываем ссылку в новом окне
13        });
14        
15        // Добавляем ссылку непосредственно перед каждым iframe
16        $(this).before(downloadLink);
17    });
18    */
19
20    
21    function check_menu() {
22        $('.menu-item-has-children').each(function(e){
23            var $el = $(this);
24            var right = $el.offset().left + $el.find('.sub-menu').outerWidth();
25            if ($(window).width() < right) {
26                $el.addClass('right');
27            } else {
28                $el.removeClass('right');
29            }
30        })
31    }
32    check_menu();
33
34    $(window).resize(function () {
35        check_menu();
36    });
37
38    function initializeSwiper(label, options) {
39        var isSwiperInitialized = false;
40        var mySwiper = null;
41    
42        function initSwiper() {
43            console.log('SWIPER');
44            $(label).removeClass('grid');
45            if (!isSwiperInitialized) {
46                mySwiper = new Swiper(label, options);
47                isSwiperInitialized = true;
48            }
49        }
50    
51        function destroySwiper() {
52            $(label).addClass('grid');
53            if (isSwiperInitialized && mySwiper !== null) {
54                mySwiper.destroy();
55                mySwiper = null;
56                isSwiperInitialized = false; 
57            }
58        }
59    
60        function checkWindowSize() {
61            if (window.innerWidth < 1320) {
62                initSwiper();
63            } else {
64                destroySwiper();
65            }
66        }
67    
68        checkWindowSize();
69        $(window).resize(function () {
70            checkWindowSize();
71        });
72    }
73    
74    function accSlider(label) {
75        if ($('.'+label+'__swiper').length > 0) {
76            var labelSwiper = '.'+label+'__swiper';
77            var optionsSwiper = {
78                loop: false,
79                slidesPerView: "auto",
80                spaceBetween: 10,
81                pagination: {
82                    el: '.'+label+'-pagination',
83                    clickable: true,
84                },
85                navigation: {
86                    nextEl: '.'+label+'__next',
87                    prevEl: '.'+label+'__prev',
88                },
89                breakpoints: {
90                    280: {
91                        slidesPerView: "1",
92                        spaceBetween: 20,
93                    },
94                    768: {
95                        slidesPerView: "auto",
96                        spaceBetween: 20,
97                    },
98                    1320: {
99                        slidesPerView: "3",
100                        spaceBetween: 20,
101                    },
102                }
103            };
104        
105            initializeSwiper(labelSwiper, optionsSwiper);
106        }
107    }
108    
109    accSlider('news');
110
111    $('.mob-m').click(function(){
112		$('body').toggleClass('open-m');
113		if($('body').hasClass('open-m')){
114			$('footer').after('<div class="over-bg"></div>');
115		}else{
116			$('.over-bg').remove();
117		}
118	});
119
120    $(document).on('click', '.over-bg', function(){
121        $(this).remove();
122        $('body').toggleClass('open-m');
123    });
124
125    $(".share-telegram").click(function(){window.open('https://telegram.me/share/url?url='+location.href,'sharer','toolbar=0,status=0,width=700,height=400');});
126    $(".share-vk").click(function () { window.open('https://vkontakte.ru/share.php?url=' + location, 'sharer', 'toolbar=0,status=0,width=700,height=400'); });
127    $(".share-twitter").click(function(){ window.open( 'https://twitter.com/intent/tweet?url=' + encodeURIComponent(location.href), 'sharer', 'toolbar=0,status=0,width=700,height=400' );});
128    $(".share-ok").click(function(){ window.open( 'https://connect.ok.ru/offer?url=' + encodeURIComponent(location.href), 'sharer', 'toolbar=0,status=0,width=700,height=400' );});
129
130
131    if ($('body').hasClass('single-post')) {
132        var post_id = $('body').attr('data-post');
133
134        if (post_id != '0') {
135            $.ajax({
136                url: '/api/views.php',
137                method: 'post',
138                dataType: 'json',
139                data: {post_id: post_id},
140                success: function(data){
141                    console.log(data);
142                }
143            });            
144        }
145    }
146
147    $(document).on('click', '.scroll-up', function() {
148        $('html, body').animate({scrollTop:0}, 500, 'swing');
149        return false; 
150    }); 
151
152    $(document).scroll(function(e){
153        var top = $(document).scrollTop(); 
154        if (top > 500) {
155            $('.scroll-up').addClass('active'); 
156        } else {
157            $('.scroll-up').removeClass('active');  
158        } 
159    });
160
161    $('.menu-item-has-children > a').on('click', function(e) {
162        if ($(window).width() <= 768) {
163            e.preventDefault();
164
165            $(this).toggleClass('active');
166            
167            return false; 
168        }
169    });
170
171    if (window.innerWidth < 720) {
172
173        $('iframe[src$=".pdf"]').each(function(i, el) {
174            $(el).addClass('wp-iframe-pdf');
175        });
176
177        $('.wp-iframe-pdf').each(function(i, el) {
178            let src = $(el).attr('src'); 
179            $(el).attr('src', `https://docs.google.com/viewer?url=${src}&embedded=true&dwnload=false`);
180        });
181
182        $('object[type="application/pdf"]').each(function(i, el) {
183            let src = $(el).attr('data');
184            $(el).replaceWith(`<iframe class="wp-iframe-pdf" src="https://docs.google.com/viewer?url=${src}&embedded=true&dwnload=false"></iframe>`);
185        });
186    }
187})
188
189document.addEventListener('DOMContentLoaded', function () {
190    var revSlider = document.querySelectorAll('.sliders-item');
191    if (revSlider.length > 0) {
192        revSlider.forEach(function (slider) {
193            var swiperContainer = slider.querySelector('.sliders__swiper');
194            var prev = slider.querySelector('.sliders__prev');
195            var next = slider.querySelector('.sliders__next');
196        
197            var swiper = new Swiper(swiperContainer, {
198                loop: false,
199                slidesPerView: 1,
200                spaceBetween: 10,
201                effect: 'fade',          // ← вот это
202                fadeEffect: {
203                    crossFade: true      // плавное появление/исчезновение
204                },
205                navigation: {
206                    prevEl: prev,
207                    nextEl: next,
208                },
209            });
210        });
211    }
212});

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.