PageSourceSearch

https://roz-vet.ru/assets/tpl/js/functions.js

js roz-vet.ru collected 2026-10-05 00:33:28 UTC 3,266 bytes, 110 lines download raw bytes

1$(function(){
2    // Проверка браузера
3    if ( !supportsCssVars() ) {
4        $('body').addClass('lock')
5        $('.supports_error').addClass('show')
6    }
7
8
9    // Ленивая загрузка
10    setTimeout(function(){
11        observer = lozad('.lozad', {
12            rootMargin: '200px 0px',
13            threshold: 0,
14            loaded: function(el) {
15                el.classList.add('loaded')
16            }
17        })
18
19        observer.observe()
20    }, 200)
21
22
23    // Установка ширины стандартного скроллбара
24    $(':root').css('--scroll_width', widthScroll() +'px')
25
26
27    // Маска ввода
28    $('input[type=tel]').inputmask('+7 (999) 999-99-99')
29
30    // Фокус при клике на название поля
31    $('body').on('click', '.form .label', function() {
32        $(this).closest('.line').find('.input, textarea').focus()
33    })
34
35
36    // Fancybox
37    $.fancybox.defaults.hash = false
38    $.fancybox.defaults.touch = false
39    $.fancybox.defaults.backFocus = false
40    $.fancybox.defaults.autoFocus = false
41    $.fancybox.defaults.animationEffect = 'zoom'
42    $.fancybox.defaults.transitionEffect = 'slide'
43    $.fancybox.defaults.speed = 500
44    $.fancybox.defaults.gutter = 40
45    $.fancybox.defaults.i18n = {
46        'en' : {
47            CLOSE: "Закрыть",
48            NEXT: "Следующий",
49            PREV: "Предыдущий",
50            ERROR: "Запрошенный контент не может быть загружен.<br /> Пожалуйста, повторите попытку позже.",
51            PLAY_START: "Запустить слайдшоу",
52            PLAY_STOP: "Остановить слайдшоу",
53            FULL_SCREEN: "На весь экран",
54            THUMBS: "Миниатюры",
55            DOWNLOAD: "Скачать",
56            SHARE: "Поделиться",
57            ZOOM: "Увеличить"
58        }
59    }
60
61
62    // Моб. меню
63    $('body').on('click', '.mob_header .mob_menu_link', function(e) {
64        e.preventDefault()
65
66        $(this).addClass('active')
67        $('body').addClass('lock')
68        $('header').addClass('show')
69        $('.overlay').fadeIn(300)
70    })
71
72    $('body').on('click', 'header .close, .overlay', function(e) {
73        e.preventDefault()
74
75        $('.mob_header .mob_menu_link').removeClass('active')
76        $('body').removeClass('lock')
77        $('header').removeClass('show')
78        $('.overlay').fadeOut(300)
79    })
80})
81
82
83
84// Вспомогательные функции
85function widthScroll() {
86    let div = document.createElement('div')
87    div.style.overflowY = 'scroll'
88    div.style.width = '50px'
89    div.style.height = '50px'
90    div.style.visibility = 'hidden'
91    document.body.appendChild(div)
92
93    let scrollWidth = div.offsetWidth - div.clientWidth
94    document.body.removeChild(div)
95
96    return scrollWidth
97}
98
99
100var supportsCssVars = function() {
101    var s = document.createElement('style'),
102        support
103
104    s.innerHTML = ":root { --tmp-var: bold; }"
105    document.head.appendChild(s)
106    support = !!(window.CSS && window.CSS.supports && window.CSS.supports('font-weight', 'var(--tmp-var)'))
107    s.parentNode.removeChild(s)
108
109    return support
110}

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.