PageSourceSearch

https://visitmo.ru/js/common/main.min.js?h=204300

js visitmo.ru collected 2026-10-02 17:43:31 UTC 7,759 bytes, 232 lines download raw bytes

1$(document).on('click', '.node_likes_alt, .top_likes_button2', function(){
2    let that = $(this), 
3        nodeID = $(this).attr('data-node-id'),
4        capt = 'like_' + nodeID;
5    
6    console.log( 'main min' );
7    
8    let valEl = that.hasClass('top_likes_button2') ? that : that.find('.count_label'),
9        val = parseInt(valEl.text());
10    
11    if ( that.hasClass('like_empty') ) {
12        $.post('/api/likes_alt.php', {nodeID: nodeID, mode: 'inc'}, function(){
13            that.removeClass('like_empty').addClass('like_filled');
14            $.cookie(capt, 1, {path: "/", expires: 30});
15            val ++;
16            valEl.text(val);
17        });
18    } else {
19        $.post('/api/likes_alt.php', {nodeID: nodeID, mode: 'dec'}, function(){
20            that.addClass('like_empty').removeClass('like_filled');
21            $.cookie(capt, null);
22            val --;
23            valEl.text(val);
24        });
25    }
26});
27
28
29function setLoginButton()
30{
31    $('.login_button').on('click', function(){
32        $('body .login_popup_window').css('display', 'table');
33    });
34    
35    $('body .login_popup_window .login_popup_window_closer').on('click', function(){
36        $('body').find('.login_popup_window').css('display', 'none');
37    });    
38}
39
40function validateName(name) {
41    const re = /^[a-zA-Zа-яА-ЯёЁ0-9 ]{4,20}$/
42    return re.test(name);
43}
44
45function validateEmail(email) {
46    const re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
47    return re.test(email);
48}
49
50function validatePassword(password) {
51    const re = /^[a-zA-Z0-9_]{8,20}$/;
52    return re.test(password);
53}
54
55/*
56$(function(){
57    $('.visitmo_logo').on('click', function(){
58        window.location.href = '/';
59    });
60});
61*/
62
63$(function(){
64   $('#menu_picker').on('click', function(){
65       if ($('#main_menu_items').css('display') == 'none') {
66           if (!$('#main_menu_items').find('.top_mobile_menu_header').length) {
67               $('#main_menu_items').prepend('<div class="top_mobile_menu_header">Путеводитель по туристическим местам Подмосковья</div><div sclass="top_mosreg1"><p class="mosreg_text1">Совместно с </p></div><div class="picker_logo"><div class="top_mosreg1"><a href="https://welcome.mosreg.ru" target="_blank""><img src="/img/header/mosreg.png" class="mosreg" /></a></div><!-- div class="top_360_1"><a href="https://360tv.ru/" target="_blank"><img src="/img/logo360.svg" class="mosreg" /></a></div --></div>');
68           }
69           
70           if (!$('#main_menu_items').find('.top_mobile_menu_login').length) {
71               //$('#main_menu_items').append('<div class="top_mobile_menu_login login_button"><a href="/" onClick="return false">Войти</a></div>');
72               //setLoginButton();
73           }
74           
75           if (!$('#main_menu_items').find('.top_mobile_menu_addition').length) {
76               $('#main_menu_items').append('<div class="top_mobile_menu_addition clearfix"><a href="/about/">О проекте</a></div>');
77               // $('#main_menu_items').append('<div class="top_mobile_menu_addition clearfix"><a href="/about/">О проекте</a><a href="/forum/">Форум</a><a href="/blogs/">Блог</a></div>');
78           }
79           
80           $('#main_menu_items').css('display', 'block');
81           $('.login_block').css('display', 'flex');
82           $(this).css('background-image', 'url(/img/header/close_menu.svg)');
83       } else {
84           //$('#main_menu_items').find('.top_mobile_menu_login').remove();
85           $('#main_menu_items').find('.top_mobile_menu_addition').remove();
86           $('#main_menu_items').css('display', 'none');
87           //$('.login_block').css('display', 'none');
88           $(this).css('background-image', 'url(/img/sandwich.svg)');
89       }
90   });
91});
92
93$(function(){
94    $('#search_closer').on('click', function(){
95        $('header').find('.search_block').css('visibility', 'hidden');
96    });
97});
98
99$(function(){
100    $('.search_field').on('focus', function(){
101        if ($(this).val() == 'Поиск') {
102            $(this).val('');
103        }
104    });
105
106    $('.search_field').on('blur', function(){
107        if ($(this).val() == '') {
108            $(this).val('Поиск');
109        }
110    });
111});
112
113function searchOnSite()
114{
115    var search_value = $('.search_field').val();
116    search_value = search_value.replace(/[^a-zA-Zа-яА-Я0-9Ёё]+/g, ' ').trim();
117    $('.search_field').val(search_value);
118
119    if (!search_value || (search_value == 'Поиск')) {
120        return;
121    }
122
123    if (search_value.length < 4) {
124        return;
125    }
126
127    window.location.href = '/search/?search=' + search_value;    
128}
129
130$(function(){
131    $('.search_button').on('click', function(){
132        searchOnSite();
133    });
134});
135
136$(function(){
137    $('.search_field').keyup(function(event) {
138        if(event.keyCode === 13){
139            searchOnSite();
140        } else {
141            console.log(event.keyCode);
142        }
143    });
144});
145
146$(function(){
147    $('#area_selector').on('change', function(){
148        window.location.href = window.location.pathname + ($(this).val() ? ('?direction=' + $(this).val()) : '');
149    });
150    
151    $('#subarea_selector').on('change', function(){
152        window.location.href = window.location.pathname + ($(this).val() ? ('?area=' + $(this).val()) : '');
153    }); 
154});
155
156function checkLoginData()
157{
158    if (!$('.auth_form').find('#user_mail').val()) {
159        $('.auth_form').find('.login_error').html('<span>Не верно указана почта/логин</span>');
160        return false;
161    }
162
163    if (!$('.auth_form').find('#user_password').val()) {
164        $('.auth_form').find('.password_error').html('<span>Не указан пароль</span>');
165        return false;
166    }
167
168    /*if (!validateEmail($('.auth_form').find('#user_mail').val())) {
169        $('.auth_form').find('.login_error').html('<span>Укажите правильный адрес e-mail</span>');
170        return false;
171    }
172
173    if (!validatePassword($('.auth_form').find('#user_password').val())) {
174        $('.auth_form').find('.password_error').html('<span>Пароль содержит запрещенные символы</span>');
175        return false;
176    }
177    */
178    
179    return true;
180}
181
182function sendLoginData()
183{
184    var data = new Object();
185    data.login = $('.auth_form').find('#user_mail').val();
186    data.password = $('.auth_form').find('#user_password').val();
187
188    $.post(ROOT + 'auth/',
189            data,
190            function(response){
191                if (response.auth_result) {
192                    window.location.reload();
193                } else {
194                    if (response.errors.login) {
195                        $('.auth_form').find('.login_error').html('<span>' + response.errors.login + '</span>');
196                    }
197
198                    if (response.errors.password) {
199                        $('.auth_form').find('.password_error').html('<span>' + response.errors.password + '</span>');
200                    }
201                }
202            },
203            'json'
204    );
205}
206
207function loginUser()
208{
209    if (!checkLoginData()) {
210        return;
211    }
212    
213    sendLoginData();
214}
215
216$(function(){
217    setLoginButton();
218    
219    $('.auth_form').find('#user_mail').on('focus', function(){
220        $('.auth_form').find('.login_error').html('');
221    });
222    
223    $('.auth_form').find('#user_password').on('focus', function(){
224        $('.auth_form').find('.password_error').html('');
225    });
226    
227    if ($('.auth_form').find('#user_login_button').length) {
228        $('.auth_form').find('#user_login_button').on('click', function(){
229            loginUser();
230        });
231    }
232});

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.