PageSourceSearch

https://nextgis.ru/wp-content/themes/nextgisclean_wptheme/main-assets/js/front-page-slider.js?ver=1.0.0

js nextgis.ru collected 2026-10-01 11:52:08 UTC 3,404 bytes, 104 lines download raw bytes

1jQuery(document).ready(function($) {
2
3    // Image slider with bilingual support
4    const sliderTexts = {
5        en: [
6            'One central database for spatial resources',
7            'Powerful cartographic interface',
8            'Manage data layers, services, and maps',
9            'Control access with flexible permissions'
10        ],
11        ru: [
12            'Централизованное хранилище',
13            'Мощный картографический интерфейс',
14            'Управление картами, данными и сервисами',
15            'Гибкая настройка доступа'
16        ]
17    };
18    
19    // Detect language
20    function getCurrentLanguage() {
21        // Method 1
22        if (window.location.pathname.includes('/en/') || window.location.pathname.includes('-en.php')) {
23            return 'en';
24        }
25        if (window.location.pathname.includes('/ru/') || window.location.pathname.includes('-ru.php')) {
26            return 'ru';
27        }
28        
29        // Method 2
30        const bodyLang = $('body').attr('lang') || $('html').attr('lang');
31        if (bodyLang) {
32            return bodyLang.startsWith('ru') ? 'ru' : 'en';
33        }
34        
35        // Method 3
36        if ($('body').hasClass('lang-ru') || $('body').hasClass('ru')) {
37            return 'ru';
38        }
39        
40        return 'en';
41    }
42    
43    const currentLang = getCurrentLanguage();
44    const currentSliderTexts = sliderTexts[currentLang];
45    
46    let currentSlideIndex = 0;
47    const sliderImages = $('.slider-image');
48    const sliderText = $('.slider-text');
49    let sliderInterval;
50    
51    // Function to switch to next slide
52    function nextSlide() {
53        sliderImages.removeClass('active');
54        currentSlideIndex = (currentSlideIndex + 1) % sliderImages.length;
55        $(sliderImages[currentSlideIndex]).addClass('active');
56        sliderText.text(currentSliderTexts[currentSlideIndex]);
57    }
58    
59    // Function to switch to previous slide
60    function prevSlide() {
61        sliderImages.removeClass('active');
62        currentSlideIndex = (currentSlideIndex - 1 + sliderImages.length) % sliderImages.length;
63        $(sliderImages[currentSlideIndex]).addClass('active');
64        sliderText.text(currentSliderTexts[currentSlideIndex]);
65    }
66    
67    // Set up button event handlers
68    $('.slider-next').click(function() {
69        nextSlide();
70        resetInterval();
71    });
72    
73    $('.slider-prev').click(function() {
74        prevSlide();
75        resetInterval();
76    });
77    
78    // Function to reset interval
79    function resetInterval() {
80        clearInterval(sliderInterval);
81        startSlider();
82    }
83    
84    // Function to start auto-sliding
85    function startSlider() {
86        sliderInterval = setInterval(nextSlide, 5000);
87    }
88    
89    // Initialize Intersection Observer for slider visibility tracking
90    const observer = new IntersectionObserver((entries) => {
91        entries.forEach(entry => {
92            if (entry.isIntersecting && entry.intersectionRatio >= 0.33) {
93                startSlider();
94                observer.disconnect(); // Disable observer after first trigger
95            }
96        });
97    }, {
98        threshold: 0.33 // Triggers when one third of element is visible
99    });
100    
101    // Observe slider element
102    observer.observe($('.feature-slider')[0]);
103
104});

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.