PageSourceSearch

https://medsef.ru/bitrix/templates/aspro-allcorp3medc/js/custom.js

js medsef.ru collected 2026-09-25 20:07:34 UTC 8,033 bytes, 274 lines download raw bytes

1$(document).ready(function(){
2    const sliderBlock = $('#all-slides')
3    const slide = Array.from($('.company-item_sl'))
4    const dotBlock = $('.sl_block-dots')
5
6    let timeInterval = 3000
7
8    let currentSlide = 0;
9    let interval
10    let arrDots
11
12
13    const addDots = () => {
14        for(let dot = 0; dot <= slide.length - 1; dot++){
15            const newDot = document.createElement('a')
16            dotBlock.append(newDot)
17        }
18
19        arrDots = Array.from(dotBlock.find('a'))
20
21        
22        arrDots.forEach((dot, index) => {
23           if(index === 0){
24            dot.classList.add('dot_sl', 'dot_sl_act')
25           } else{
26            dot.classList.add('dot_sl')
27           }
28        })
29    }
30
31    const prevSlide = (elem, index, strClass) => {
32        elem[index].classList.remove(strClass)
33        $('#titleTown').text(slide[index].getAttribute('data-regionTitle'))
34    }
35
36    const nextSlide = (elem ,index, strClass) => {
37        elem[index].classList.add(strClass)
38        $('#titleTown').text(slide[index].getAttribute('data-regionTitle'))
39    }
40
41    const autoSlide = () => {
42       
43        prevSlide(slide, currentSlide, 'company-item-active_sl')
44        prevSlide(Array.from(dotBlock.find('a')) ,currentSlide, 'dot_sl_act')
45        currentSlide++
46        
47        if(currentSlide >= slide.length){
48            currentSlide = 0
49        }
50
51        nextSlide(slide, currentSlide, 'company-item-active_sl')
52        nextSlide(Array.from(dotBlock.find('a')) ,currentSlide, 'dot_sl_act')
53    }
54
55    const startSlide = () => {
56        if(sliderBlock && slide !== null){
57            interval = setInterval(autoSlide, timeInterval)
58        } else{
59            return
60        }
61    }
62
63    const stopSlide = () => {
64        clearInterval(interval);
65      };
66
67      const swithSlide = (e) => {
68        e.preventDefault();
69
70        prevSlide(slide, currentSlide, 'company-item-active_sl')
71        prevSlide(Array.from(dotBlock.find('a')) ,currentSlide, 'dot_sl_act')
72 
73        if (e.target.matches("#arrow-right")) {
74            currentSlide++;
75          } else if (e.target.matches("#arrow-left")) {
76            currentSlide--;
77          } else if (e.target.classList.contains('dot_sl')){
78            Array.from(dotBlock.find('a')).forEach((dot, index) => {
79                if(e.target === dot){
80                    currentSlide = index
81                }
82            })
83          }
84
85
86          if (currentSlide >= slide.length) {
87            currentSlide = 0;
88          }
89      
90          if (currentSlide < 0) {
91            currentSlide = slide.length - 1;
92          }
93
94
95        nextSlide(slide, currentSlide, 'company-item-active_sl')
96        nextSlide(Array.from(dotBlock.find('a')) ,currentSlide, 'dot_sl_act')
97      }
98
99      sliderBlock.on('click', swithSlide)
100      sliderBlock.on('mouseover', (e) => {
101            if(e.target.matches('.dot_sl, .sls-btn')){
102                stopSlide()
103            }
104      })
105      sliderBlock.on('mouseout', (e) => {
106        if(e.target.matches('.dot_sl , .sls-btn')){
107            startSlide(timeInterval);
108        }
109      })
110
111
112    addDots()
113    startSlide()
114})
115
116$(document).ready(function(){
117    const sendBtn = $('#form_send_app__')
118
119
120
121function maskPhone(selector, masked = '+7 (___) ___-__-__') {
122    const elems = document.querySelectorAll(selector);
123
124    function mask(event) {
125        const keyCode = event.keyCode;
126        const template = masked,
127            def = template.replace(/\D/g, ""),
128            val = this.value.replace(/\D/g, "");
129        let i = 0,
130            newValue = template.replace(/[_\d]/g, function (a) {
131                return i < val.length ? val.charAt(i++) || def.charAt(i) : a;
132            });
133        i = newValue.indexOf("_");
134        if (i !== -1) {
135            newValue = newValue.slice(0, i);
136        }
137        let reg = template.substr(0, this.value.length).replace(/_+/g,
138            function (a) {
139                return "\\d{1," + a.length + "}";
140            }).replace(/[+()]/g, "\\$&");
141        reg = new RegExp("^" + reg + "$");
142        if (!reg.test(this.value) || this.value.length < 5 || keyCode > 47 && keyCode < 58) {
143            this.value = newValue;
144        }
145        if (event.type === "blur" && this.value.length < 5) {
146            this.value = "";
147        }
148
149    }
150
151    for (const elem of elems) {
152        elem.addEventListener("input", mask);
153        elem.addEventListener("focus", mask);
154        elem.addEventListener("blur", mask);
155    }
156}
157
158maskPhone('.mask_tel');
159
160
161
162    const formValidate = (input) => {
163
164        const arrInput = Array.from(input)
165
166        let succes
167
168
169
170        arrInput.forEach((elem) => {
171            if(elem.value === ''){
172                succes = false
173            } else{
174                succes = true
175            }
176        })
177
178        return succes
179    }
180
181    function send_form_serv (data)  {
182        $.ajax({
183            url: '/sendformvac.php',
184            method: 'POST',
185            processData: false,
186            data: data,
187            contentType: false,
188            success: function(resp) {
189               alert('форма отправлена успешно')
190				console.log(resp)
191            },
192            error: function(error){
193                alert('ошибка отправки формы')
194            }
195        });
196    }
197
198    const dataPreporation = (e) => {
199        e.preventDefault()
200
201ym(89121425,'reachGoal','clickVakcina')
202
203        const form = $('#form_send__')
204const inputAll = $('.input__app')
205        const formData = new FormData(form[0])
206
207
208        if(formValidate(inputAll)){
209            send_form_serv(formData)
210        } else{
211            alert("заполните обязательные поля")
212        }
213    }
214
215    sendBtn.on("click", dataPreporation) 
216})
217
218//подсвечивание города
219document.addEventListener('DOMContentLoaded', () => {
220    const currentHost = window.location.host.replace('www.', '');
221    const links = document.querySelectorAll('.region-nav a');
222    const sloganHeader = document.querySelector('.slogan-header');
223    let isCitySelected = false;
224
225    // Проверяем каждую ссылку
226    links.forEach(link => {
227        try {
228            const linkUrl = new URL(link.href);
229            const linkHost = linkUrl.host.replace('www.', '');
230            
231            if(linkHost === currentHost) {
232                link.classList.add('active-city');
233                isCitySelected = true; // Город выбран
234            }
235        } catch(e) {
236            console.error('Invalid URL in city link:', link.href);
237        }
238    });
239
240    // Управляем видимостью блока с лозунгом
241    if(sloganHeader) {
242        sloganHeader.style.display = isCitySelected ? 'none' : 'block';
243    }
244});
245
246document.addEventListener('DOMContentLoaded', function() {
247    const sloganHeader = document.querySelector('.slogan-header');
248    if (!sloganHeader) return;
249
250    // Получаем текущий домен без www
251    const currentDomain = window.location.hostname
252        .replace('www.', '')
253        .toLowerCase();
254
255    // Проверяем строгое соответствие основному домену
256    const isMainDomain = currentDomain === 'medsef.ru';
257
258    // Управляем видимостью
259    sloganHeader.style.display = isMainDomain ? 'block' : 'none';
260    
261    console.log('Domain:', currentDomain, 'Visibility:', sloganHeader.style.display);
262sloganHeader.style.setProperty('display', 'none', 'important');
263});
264
265
266// Добавляем data-атрибут для body при загрузке страницы
267document.addEventListener('DOMContentLoaded', function() {
268    const currentDomain = window.location.hostname
269        .replace(/^(www|dev|test)\./i, '') // Удаляем служебные поддомены
270        .replace(/\.medsef\.ru$/i, ''); // Оставляем только основную часть
271    
272    document.body.setAttribute('data-domain', currentDomain);
273    console.log('Current domain:', currentDomain);
274});

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.