PageSourceSearch

https://svoboda-3.ru/js/custom.js?179025440820944

js svoboda-3.ru collected 2026-10-02 07:03:18 UTC 20,944 bytes, 528 lines download raw bytes

1/*window.initYouxWidgetKassyRu = function(event = '') {
2    if(typeof kassy_widget  == 'object') {
3        if(event) {
4            kassy_widget.init('https://rnd.kassy.ru/widget/12-1/event/'+event+'/buy/');
5        }
6        else {
7            kassy_widget.init('https://rnd.kassy.ru/widget/12-1/events/');
8        }
9    }
10}*/
11window.initYouxWidgetKassyRu = function(event = '', element = null) {
12    if (typeof kassy_widget !== 'object') return;
13    
14    if (!event || !element) {
15        const currentDate = new Date();
16        const transitionDate = new Date(2026, 1, 1);
17        
18        if (currentDate >= transitionDate) {
19            kassy_widget.init('https://tickets.afisha.ru/wl/3582/api#');
20        } else {
21            kassy_widget.init('https://rnd.kassy.ru/widget/12-1/events/');
22        }
23    } else {
24        const eventDateStr = element.getAttribute('data-date-event');
25        const [day, month, year] = eventDateStr.split('.');
26        const eventDate = new Date(year, month - 1, day);
27        const transitionDate = new Date(2026, 1, 1);
28        
29        if (eventDate >= transitionDate) {
30            kassy_widget.init('https://tickets.afisha.ru/wl/3582/api#/place/' + event);
31        } else {
32            kassy_widget.init('https://rnd.kassy.ru/widget/12-1/event/' + event + '/buy/');
33        }
34    }
35    ym(29136795, 'reachGoal', 'open widget', { event_id: event });
36}
37
38function isMobile() {
39    return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
40}
41const page = window.location.pathname;
42if (isMobile() && !sessionStorage.getItem('redirect_afisha') && page === '/') {
43    sessionStorage.setItem('redirect_afisha', '1');
44    window.location.href = '/afisha/';
45} else if (isMobile() && !sessionStorage.getItem('redirect_afisha') && page.startsWith('/afisha/')) {
46    sessionStorage.setItem('redirect_afisha', '1');
47}
48
49//
50// swiper
51//
52window.initSwiper = function() {
53    if (typeof (Swiper) == 'function') {
54        $('.filter__slider-container').each(function(i, swiper) {
55            const defaultOptions = {
56                slidesPerView: 'auto',
57                spaceBetween: 10,
58                updateOnWindowResize: true,
59                observer: true,
60                observeParents: true,
61                pagination: {
62                    el: swiper.querySelector('.swiper-pagination'),
63                },
64                navigation: {
65                    nextEl: swiper.querySelector(".swiper-button-custom-next") || swiper.querySelector(".swiper-button-next"),
66                    prevEl: swiper.querySelector(".swiper-button-custom-prev") || swiper.querySelector(".swiper-button-prev"),
67                },
68                breakpoints: {
69                    290: {
70                        spaceBetween: 0,
71                    },
72                    1001: {
73                        spaceBetween: 10,
74                    }
75                }
76            };
77            const data = $(swiper).data('swiper') || {};
78            const dataOptions = Object.values(data).length ? data : {};
79            const options = Object.assign({}, defaultOptions, dataOptions);
80            new Swiper($('.filter__slider', swiper)[0], options);
81        });
82    }
83}
84//
85// /swiper
86//
87function TranslateInit() {
88    new google.translate.TranslateElement({
89        pageLanguage: 'ru'
90    });
91};
92
93function setCookie(name, value, expirationInDays) {
94    const date = new Date();
95    date.setTime(date.getTime() + (expirationInDays * 24 * 60 * 60 * 1000));
96    document.cookie = name + '=' + value
97        + ';expires=' + date.toUTCString()
98        + ';path=/';
99}
100
101window.getList = function(params){
102    if(params.params.action == 'showMore'){
103        $('[data-age-property] .afisha-filter-list-item.afisha-active').each(function(i, el) {
104            var ths = $(el);
105            var id = ths.data('id');
106            if(id){
107                params.params[id] = 'Y';
108            }
109        });
110        $('[data-genre-property] .afisha-filter-list-item.afisha-active').each(function(i, el) {
111            var ths = $(el);
112            var id = ths.data('id');
113            if(id){
114                params.params[id] = 'Y';
115            }
116        });
117    }
118    $.ajax({
119        url: params.url,
120        type: 'GET',
121        dataType: 'JSON',
122        data: params.params
123    })
124    .done(function(data) {
125        if(data.status == 'success'){
126            if(data.target){
127                if(params.params.action == 'showMore'){
128                    $(data.target).append(data.html);
129                }
130                else{
131                    $(data.target).html(data.html);
132                }
133                if(params.params?.isAfisha && params.params?.date){
134                    const dateString = `${params.params.date}`;
135                    const dateStringToFilter = `${dateString.slice(0,2)}.${dateString.slice(2,4)}.${dateString.slice(-4)}`;
136                    filterAfishaBtns(dateStringToFilter);
137                }
138                if(data.paginationNum){
139                    $('[data-pagination-num="'+data.paginationNum+'"]').html(data.pagination);
140                }
141                if(data.url){
142                    BX.ajax.history.put(null, data.url);
143                }
144            }
145        }
146    })
147    .fail(function() {
148        console.log('Произошла ошибка сервера!');
149    });
150}
151
152window.filterAfisha = function(ths, url){
153    let holder = $(ths);
154    if(holder.hasClass('filter__day-active')) {
155        return;
156    }
157    data = {
158        'url': url || '/ajax/afisha_ajax.php',
159        'params': {
160            'action': 'setFilter',
161            'tabId': holder.data('tab-id'),
162            'lazyLoad': (holder.data('lazy-load') || ''),
163            'pageElementCount': (parseInt(holder.data('page-count')) || 5),
164            'date': holder.data('time'),
165            'isAfisha': true,
166        }
167    };
168    setTimeout(function () {
169        smartFilter = {};
170        if(holder.data('time')){
171            smartFilter['date'] = holder.data('time');
172        }
173        if(holder.data('tab-id')){
174            smartFilter['tabId'] = holder.data('tab-id');
175        }
176        $('[data-age-property] .afisha-filter-list-item.afisha-active').each(function(i, el) {
177            var ths = $(el);
178            var id = ths.data('id');
179            if(id){
180                smartFilter[id] = 'Y';
181                data['params'][id] = 'Y';
182            }
183        });
184        $('[data-genre-property] .afisha-filter-list-item.afisha-active').each(function(i, el) {
185            var ths = $(el);
186            var id = ths.data('id');
187            if(id){
188                smartFilter[id] = 'Y';
189                data['params'][id] = 'Y';
190            }
191        });
192        window.smartFilterPropAfisha(smartFilter);
193        window.getList(data);
194    }, 200);
195}
196
197window.filterAfishaBtns = function(currentDate) {
198    $('.afisha__card').each((ind,el) => {
199        const $card = $(el);
200        const $btns = $('.afisha__btn', $card);
201        const $date = $('.afisha__date', $card);
202        if (currentDate) {
203            const $filtredBtn = $btns.filter(`[data-date-event="${currentDate}"]`);
204            $btns.removeClass('visible');
205            $filtredBtn.addClass('visible')
206            $date.text($filtredBtn.data('date'));
207        }else{
208            $btns.removeClass('visible').eq(0).addClass('visible')
209        }
210    });
211}
212
213window.filterPropAfisha = function(ths, url){
214    let holder = $(ths);
215    if(holder){
216        data = {
217            'url': url || '/ajax/afisha_ajax.php',
218            'params': {
219                'action': 'setFilter',
220                'tabId': $('.afisha__tab-cnt.afisha__tab-active').data('tab-id'),
221                'lazyLoad': (holder.data('lazy-load') || ''),
222                'pageElementCount': (parseInt(holder.data('page-count')) || 5),
223                'date': holder.data('time'),
224                'isAfisha': true,
225            }
226        };
227        setTimeout(function () {
228            smartFilter = {};
229            if(holder.data('time')){
230                smartFilter['date'] = holder.data('time');
231            }
232            if($('.afisha__tab-cnt.afisha__tab-active').data('tab-id')){
233                smartFilter['tabId'] = $('.afisha__tab-cnt.afisha__tab-active').data('tab-id');
234            }
235            // $('[data-age-property] .afisha-filter-list-item.afisha-active').each(function(i, el) {
236            //     var ths = $(el);
237            //     var id = ths.data('id');
238            //     if(id){
239            //         smartFilter[id] = 'Y';
240            //         data['params'][id] = 'Y';
241            //     }
242            // });
243            // $('[data-genre-property] .afisha-filter-list-item.afisha-active').each(function(i, el) {
244            //     var ths = $(el);
245            //     var id = ths.data('id');
246            //     if(id){
247            //         smartFilter[id] = 'Y';
248            //         data['params'][id] = 'Y';
249            //     }
250            // });
251            // custom by stanislav_web
252            var filterSelectors = [
253                '[data-age-property]',
254                '[data-genre-property]',
255                '[data-scene-property]',
256                '[data-label-property]',
257                '[data-duration-property]',
258                '[data-author-property]'
259            ];
260            filterSelectors.forEach(function(selector) {
261                $(selector + ' .afisha-filter-list-item.afisha-active').each(function(i, el) {
262                    var ths = $(el);
263                    var id = ths.data('id');
264                    if (id) {
265                        smartFilter[id] = 'Y';
266                        data.params[id] = 'Y';
267                    }
268                });
269            });
270            $('[data-pushkin-property] .afisha-filter-list-item.afisha-active').each(function(i, el) {
271                var ths = $(el);
272                var id  = ths.data('id');
273                var txt = ths.text().trim();
274                var val = null;
275
276                if (txt === 'Нет')  val = 0;
277                if (txt === 'Да')   val = 1;
278
279                if (id && val !== null) {
280                    smartFilter[id] = val;
281                    data.params[id] = val;
282
283                    var pairId = id.indexOf('_MIN') !== -1
284                        ? id.replace('_MIN', '_MAX')
285                        : id.replace('_MAX', '_MIN');
286
287                    smartFilter[pairId] = val;
288                    data.params[pairId] = val;
289                }
290            });
291            // custom by stanislav_web
292            window.smartFilterPropAfisha(smartFilter);
293            window.getList(data);
294        }, 200);
295    }
296}
297
298window.smartFilterPropAfisha = function(params){
299    var smartfilter = $('[data-smartfilter');
300    if(smartfilter.length){
301        params['ajax'] = 'y';
302        setTimeout(function () {
303            $.ajax({
304                url: '/ajax/afisha_smartfilter_ajax.php',
305                type: 'GET',
306                dataType: 'JSON',
307                data: params
308            })
309            .done(function(data) {
310                if(data && data.ITEMS){
311                    var i, k, prop, val, smartfilterProp, smartfilterPropVal;
312                    for(i in data.ITEMS){
313                        prop = data.ITEMS[i];
314                        // custom by stanislav_web
315                        if (prop.CODE === 'PUSHKIN') {
316                            continue;
317                        }
318                        // custom by stanislav_web
319                        smartfilterProp = $('[data-property-code="'+prop.CODE+'"]', smartfilter);
320                        if(smartfilterProp){
321                            $('li', smartfilterProp).removeClass('afisha-active').addClass('afisha-disabled');
322                            for(k in prop.VALUES){
323                                val = prop.VALUES[k];
324                                smartfilterPropVal = $('[data-id="'+val.CONTROL_ID+'"]', smartfilterProp);
325                                if(smartfilterPropVal){
326                                    if(val.CHECKED){
327                                        smartfilterPropVal.removeClass('afisha-disabled').addClass('afisha-active');
328                                    }else if(val.DISABLED){
329                                        smartfilterPropVal.removeClass('afisha-active').addClass('afisha-disabled');
330                                    }
331                                    else{
332                                        smartfilterPropVal.removeClass('afisha-disabled afisha-active');
333                                    }
334                                }
335                            }
336                        }
337                    }
338                }
339            })
340            .fail(function() {
341                console.log('Произошла ошибка сервера!');
342            });
343        }, 200);
344    }
345}
346//ajax
347$.fn.ajaxForm = function(settings){
348    settings = $.extend({
349        requiredInputs: '.req',
350        statusEmptyText: 'Заполните обязательные поля',
351        disableButtonAfterSend: true,
352        showstatus: true,
353        start: function(holder,form,data){},
354        success: function(holder,form,data){},
355        complete: function(holder,form,data){}
356    }, settings);
357
358    $(this).each(function(index, el) {
359        var holder = $(this);
360        var form = $("form", holder);
361        var status = $('.status', holder).length ? $('.status', holder).hide() : $('<div>').addClass('status').prependTo(form).hide();
362        var button = $('button[type=submit]', form);
363        var reqInputs = $(settings.requiredInputs, form);
364        var file = $('input[type=file]', form);
365        $('input[name=e-mail]', form).val('');
366        var stars = $('.rating-group input[type=radio]', form);
367
368        form.on('submit', function(event) {
369            event.preventDefault();
370            var inputError = false;
371
372            reqInputs.each(function(){
373                var ths = $(this);
374                if(ths.attr('disabled') == 'disabled'){
375                    return;
376                }
377                if (!ths.val() || ths.val() == '' || (ths.is(':checkbox') && !ths.is(':checked')) || (ths.is(':radio') && !$('input[name="' + ths.attr('name') + '"]').not('[value="0"]').not(':disabled').is(':checked'))) {
378
379                    inputError = true;
380                    ths.parent().parent().addClass('is-invalid');
381                    ths.parent().addClass('error');
382
383                    ths.off('focus.req').on('focus.req', function(event) {
384                        status.fadeOut();
385                        ths.parent().parent().removeClass('is-invalid').addClass('is-valid');
386                        ths.parent().removeClass('error');
387                    });
388                }
389
390                if (ths.attr('type') === 'email') {
391                    var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
392                    if (!emailRegex.test(ths.val())) {
393                        inputError = true;
394                        ths.parent().parent().addClass('is-invalid');
395                        ths.parent().addClass('error');
396                        
397                        ths.off('focus.req').on('focus.req', function(event) {
398                            status.fadeOut();
399                            ths.parent().parent().removeClass('is-invalid').addClass('is-valid');
400                            ths.parent().removeClass('error');
401                        });
402                    }
403                }
404            });
405
406            if(!inputError){
407                button.attr('disabled', 'disabled').addClass('disabled');
408                settings.start(holder, form);
409                if(file.length){
410                    if(form){
411                        $.ajax({
412                            url: form.attr('action'),
413                            type: 'POST',
414                            data: new FormData(form.get(0)),
415                            async: false,
416                            cache: false,
417                            contentType: false,
418                            processData: false,
419                            success: function(data){
420                                button.removeAttr('disabled').removeClass('disabled');
421                                if(data.status == "success"){
422                                    Fancybox.show([{
423                                        src: '#successful-popup',
424                                        type: 'inline'
425                                    }]);
426                                    $(file).val(""),
427                                    $(".input__file-button .file-box").removeClass("showbox"),
428                                    $(".input__file-button .file-name").text(""),
429                                    $(".input__file-button .input__file-button-text").removeClass("none")
430                                    $(".input__file-button .input__file-icon-wrapper").removeClass("none"),
431                                    $(".input__resume-wrapper").removeClass("active-file")
432                                    settings.success(holder,form,data);
433                                    if(settings.disableButtonAfterSend){
434                                        button.addClass('disabled').attr('disabled', 'disabled');
435                                    }
436                                }else{
437                                    status.removeClass('success').addClass('error');
438                                }
439                                settings.complete(holder,form,data);
440                                setTimeout(function () {
441                                    Fancybox.close();
442                                }, 2000);
443                            },
444                            error: function(){
445                                status.fadeIn().html('Ошибка сервера. Повторите позже.');
446                                button.removeAttr('disabled').removeClass('disabled');
447                            },
448                        });
449                    }
450                }
451                else{
452                    $.ajax({
453                        url: form.attr('action'),
454                        type: form.attr('method'),
455                        dataType: 'JSON',
456                        data: form.serialize(),
457                    })
458                    .done(function(data) {
459                        button.removeAttr('disabled').removeClass('disabled');
460                        if(data.status == "success"){
461                            Fancybox.show([{
462                                src: '#successful-popup',
463                                type: 'inline'
464                            }]);
465                            settings.success(holder,form,data);
466                            if(settings.disableButtonAfterSend){
467                                button.addClass('disabled').attr('disabled', 'disabled');
468                            }
469                        }else{
470                            status.removeClass('success').addClass('error');
471                        }
472                        settings.complete(holder,form,data);
473                        setTimeout(function () {
474                            Fancybox.close();
475                        }, 2000);
476                    })
477                    .fail(function(data) {
478                        status.fadeIn().html('Ошибка сервера. Повторите позже.');
479                        button.removeAttr('disabled').removeClass('disabled');
480                    });
481                }
482            }
483        });
484    });
485};
486
487$(function () {
488    if ($('.filter__slider-container').length) {
489        window.initSwiper();
490    }
491
492    $('[data-vacancy-id]').on('click', function (e) {
493        var input = $('#vak-form input[name=id]');
494        if(input){
495            input.val($(this).data('vacancy-id'));
496        }
497    });
498    
499    $('.ajax-form').ajaxForm({
500        disableButtonAfterSend: false,
501        complete: function(holder, form, data){
502            holder.addClass('sended');
503            if(data.status == "success"){
504                form.trigger('reset');
505            }
506            if(data && typeof data.eventdata == 'object'){
507                if ($('[data-sid="PHONE"]', form)) {
508                    data.eventdata.phone = $('[data-sid="PHONE"]', form).val();
509                }
510                if ($('[data-sid="CLIENT_NAME"]', form)) {
511                    data.eventdata.name = $('[data-sid="CLIENT_NAME"]', form).val();
512                }
513                BX.onCustomEvent('onCounterGoals', [data.eventdata]);
514            }
515            if(data.redirect) {
516                setTimeout(function () {
517                    location.href = data.redirect;
518                }, 1000);
519                return;
520            }
521        }
522    });
523
524    // filterAfishaBtns
525    if($('.afisha__card').length){
526        window.filterAfishaBtns();
527    }
528});

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.