PageSourceSearch

https://perspect.ca/wp-content/themes/perspect/js/services-section.js?ver=7.1.2

js perspect.ca collected 2026-10-04 12:29:30 UTC 2,200 bytes, 39 lines download raw bytes

1  // Функция для обработки события "DOMContentLoaded" (аналог "$(document).ready()")
2  document.addEventListener('DOMContentLoaded', function() {
3    // Получаем все элементы с классом "ser"
4    const serLinks = document.querySelectorAll('.ser');
5    
6    // Обработчик клика на элементы с классом "ser"
7    serLinks.forEach(link => {
8      link.addEventListener('click', function(event) {
9        // Проверяем, является ли устройство мобильным
10        const isMobileDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
11        
12        // Если устройство мобильное
13        if (isMobileDevice) {
14          // Убеждаемся, что атрибут "href" имеет значение перед изменением стандартного поведения
15          if (this.getAttribute('href') !== "") {
16            // Отменяем стандартное поведение ссылки
17            event.preventDefault();
18
19            // Получаем значение атрибута "href" (хэш)
20            const hash = this.getAttribute('href');
21
22            // Используем метод "scrollTo()" для добавления плавной прокрутки к указанному элементу
23            // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
24            const options = {
25              top: document.querySelector(hash).offsetTop,
26              behavior: 'smooth'
27            };
28            window.scroll(options);
29
30            // Добавляем хэш (#) в URL после окончания прокрутки (стандартное поведение)
31            window.location.hash = hash;
32          }
33        } else {
34          // Для не-мобильных устройств просто отменяем стандартное поведение ссылки
35          event.preventDefault();
36        }
37      });
38    });
39  });

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.