PageSourceSearch

https://rockthecycle.ru/local/assets/js/main.js

js rockthecycle.ru collected 2026-10-01 15:55:22 UTC 17,597 bytes, 514 lines download raw bytes

1function getApiDomain(){
2    let d = document.domain.indexOf('.beta.') != -1 || document.domain.indexOf('test.') != -1 || document.domain.indexOf('192.168.137.139') != -1 ? 'https://beta.pocketsport.ru/' : 'https://psport.me/';
3    return d;
4}
5var paymentButtonClick = false;
6var Pluralization = function (number, one, two, five) {
7    number = Math.abs(number);
8    number %= 100;
9    if (number >= 5 && number <= 20) {
10        return five;
11    }
12    number %= 10;
13    if (number == 1) {
14        return one;
15    }
16    if (number >= 2 && number <= 4) {
17        return two;
18    }
19    return five;
20};
21function isAppleDevice() {
22    if (navigator.userAgent.match(/(iPhone|iPod|iPad|Safari)/) != null) {
23        return true;
24    }
25
26    return false;
27}
28function stringDateToAppleFormat(myDate) {
29    if (myDate) {
30        var dateParts = myDate.substring(0,10).split('-');
31        var timePart = myDate.substr(11);
32        if (dateParts && dateParts.length == 3) {
33            myDate = dateParts[1] + '/' + dateParts[2] + '/' + dateParts[0];
34            if (timePart) {
35                myDate  += ' ' + timePart;
36            }
37        }
38
39    }
40
41    return myDate;
42}
43function isLocalStorageNameSupported() {
44    var testKey = 'test', storage = window.sessionStorage;
45    try {
46        storage.setItem(testKey, '1');
47        storage.removeItem(testKey);
48        return localStorageName in win && win[localStorageName];
49    }
50    catch (error) {
51        return false;
52    }
53}
54function getPackExpire(x) {
55    let dateFrom;
56    if (x && x.expire) {
57        if (isAppleDevice()) {
58            dateFrom = moment(stringDateToAppleFormat(x.expire))
59        } else {
60            dateFrom = moment(x.expire)
61        }
62    } else if (x && x.bought) {
63        if (isAppleDevice()) {
64            dateFrom = moment(stringDateToAppleFormat(x.bought))
65        } else {
66            dateFrom = moment(x.bought);
67        }
68        dateFrom.date(dateFrom.date() + x.term_activation);
69
70        if (x.hasOwnProperty('auto_activation') && x.auto_activation) {
71            dateFrom.date(dateFrom.date() + x.total_days);
72        }
73    }
74
75    if (dateFrom) {
76        dateFrom.hours(23)
77        dateFrom.minutes(59)
78        dateFrom.seconds(59)
79    }
80
81    return dateFrom;
82}
83$(function () {
84    $('[data-slick]').each(function (i, slider) {
85        var $self = $(slider),
86            attr = $self.data("slick"),
87            responsive = {};
88
89        if ($self.data("slick-responsive")) {
90            responsive = $.map($self.data("slick-responsive"), function (val) {
91                return val;
92            });
93            responsive = {"responsive": responsive};
94        }
95
96        var params = $.extend(attr, responsive);
97
98        $self.slick(params);
99    });
100    $('[data-main-slick]').on('beforeChange', function (event, slick, currentSlide, nextSlide) {
101        $(slick.$slides).each(function (i, slide) {
102            $(slide).removeClass('shifted-left shifted-right');
103        })
104    });
105    $(document).on('mouseover', '[data-main-slick] .slick-prev', function () {
106        var $this = $(this);
107        var $currentSlide = $this.parent().find('.slick-slide.slick-active');
108        var $prevSlide = $currentSlide.prev();
109        $prevSlide.addClass('shifted-left');
110    });
111    $(document).on('mouseout', '[data-main-slick] .slick-prev', function () {
112        var $this = $(this);
113        var $currentSlide = $this.parent().find('.slick-slide.slick-active');
114        var $prevSlide = $currentSlide.prev();
115        $prevSlide.removeClass('shifted-left');
116    });
117    $(document).on('mouseover', '[data-main-slick] .slick-next', function () {
118        var $this = $(this);
119        var $currentSlide = $this.parent().find('.slick-slide.slick-active');
120        var $prevSlide = $currentSlide.next();
121        $prevSlide.addClass('shifted-right');
122    });
123    $(document).on('mouseout', '[data-main-slick] .slick-next', function () {
124        var $this = $(this);
125        var $currentSlide = $this.parent().find('.slick-slide.slick-active');
126        var $prevSlide = $currentSlide.next();
127        $prevSlide.removeClass('shifted-right');
128    });
129
130    //feedbacks slider
131
132    var feedbackSlick = function (slick) {
133        var $slick = $(slick);
134        var id = $slick.attr('id');
135        var $navs = $('[data-slick-logos-for=' + id + ']');
136        $slick.slick({
137            centerMode: true,
138            slidesToShow: 5,
139            slidesToScroll: 1,
140            swipeToSlide: true,
141            asNavFor: $navs,
142            arrows: false,
143            responsive: [
144                {
145                    breakpoint: 2100,
146                    settings: {
147                        slidesToShow: 4,
148                        slidesToScroll: 1
149                    }
150                },
151                {
152                    breakpoint: 1610,
153                    settings: {
154                        slidesToShow: 3,
155                        slidesToScroll: 1
156                    }
157                },
158                {
159                    breakpoint: 767,
160                    settings: {
161                        slidesToShow: 1,
162                        slidesToScroll: 1
163                    }
164                }
165            ]
166        });
167        $navs.slick({
168            centerMode: true,
169            slidesToShow: 5,
170            slidesToScroll: 1,
171            asNavFor: $slick,
172            arrows: false,
173            responsive: [
174                //{
175                //	breakpoint: 99999,
176                //	settings: "unslick"
177                //},
178                {
179                    breakpoint: 2100,
180                    settings: {
181                        slidesToShow: 4,
182                        slidesToScroll: 1
183                    }
184                },
185                {
186                    breakpoint: 1610,
187                    settings: {
188                        slidesToShow: 3,
189                        slidesToScroll: 1
190                    }
191                },
192                {
193                    breakpoint: 767,
194                    settings: {
195                        centerMode: true,
196                        focusOnSelect: true,
197                        slidesToShow: 3,
198                        slidesToScroll: 1
199                    }
200                }
201            ]
202        });
203    }
204    $('[data-slick-feedbacks]').each(function (i, slick) {
205        feedbackSlick(slick);
206    });
207    // if (!isMobile.any){
208    // 	$('body').addClass('desktop');
209    // }
210    var truncatings = [
211        //'.feedbacks__txt div',
212        '.media-training .media-body p',
213        '.module-img .block-content p',
214        '.trainer-info__text .history',
215        '.panel-heading .trainings__info'
216    ];
217/*    $.each(truncatings, function (i, el) {
218        $(el).dotdotdot({
219            watch: window
220        })
221    });*/
222
223    //special popups close on click outside
224    $('[data-close-click-outside]').each(function (i, el) {
225        $(document).mouseup(function (e) {
226            var container = $(el);
227
228            if (!container.is(e.target)
229                && container.has(e.target).length === 0
230                && container.hasClass('in')
231            ) {
232                container.collapse('hide');
233            }
234        });
235    });
236    $(document).on('click', '.popup-tabs li.active', function () {
237        var $this = $(this),
238            $popup = $this.parents('.popup');
239        $popup.collapse('hide');
240    }).on('click', '#forgot-link', function (e) {
241        const email = $('#inputEmail').val()
242        $('#forgotEmail').val(email)
243
244        var $form = $('#forgot-pass');
245        if ($form.hasClass('in')) { // hide form
246            $('[data-form-login]').show()
247            $('#forgot-link').text('Не помню пароль')
248            $form.removeClass('in');
249        } else { // show form
250            $('[data-form-login]').hide()
251            $('#forgot-link').text('Назад')
252            $form.removeClass('collapse').addClass('collapsing');
253            window.setTimeout(function () {
254                $form.removeClass('collapsing').addClass('collapse in');
255            }, 200);
256        }
257    }).on('click', '#success-register a', function () {
258        $('.registration-tabs li.active').removeClass('active');
259        $('.registration-tabs li').eq(0).addClass('active');
260    });
261
262});
263
264//aligning the height of the slider to the max-height
265$(function () {
266    function setEqualHeight($columns) {
267        //del height
268        $columns.removeAttr('style');
269        //calc maxheight
270        var heights = $columns.map(function () {
271                return $(this).height();
272            }).get();
273
274        var maxHeight = Math.max.apply(null, heights);
275
276        $columns.height(maxHeight);
277    }
278
279    $(document).ready(function () {
280        setEqualHeight($(".feedbacks__txt > div"));
281    });
282
283    $(window).on('resize load', function () {
284        setEqualHeight($(".feedbacks__txt > div"));
285    });
286
287    $('.js-confirm-region').click(function(){
288	    $.cookie("confirm_region", 'Y', { expires: 365, path: '/' });
289    });
290
291    $('.js-close-confirm-reg-popup').click(function(){
292	    $('.popup--test_location').hide();
293    });
294
295});
296$(document).ready(function () {
297    var src;
298    /// certs
299    let number, pin;
300
301   $("#activate-cert-final").on("click", function(e) {
302        e.preventDefault();
303
304        let domain = getApiDomain();
305
306        $.ajax({
307            type: 'POST',
308            url: domain + "/gym/" + gymId + "/cert/activate",
309            data: {
310                pin_code: pin,
311                cert_number: number,
312                token: token
313            },
314            success: function (result){
315                if (result.result == 1) {
316                    document.location.href = '/profile'
317                } else if (result.result == -1) {
318                    Swal.fire({
319                        title: 'Ошибка!',
320                        text: 'Данный сертификат действителен только для новых клиентов студии!',
321                        icon: 'error',
322                        confirmButtonText: 'Ок'
323                      }).then(() => {
324                        document.location.href = '/profile';
325                      })
326                }
327                else {
328                    $('.form_final_bottom').html("<p style='color:red; margin-left:5px'>
328Ошибка активации</p>")
329                }
330            },
331            error: function(error) {
332                $('.form_final_bottom').html("<p style='color:red; margin-left:5px'>Ошибка сервера, попробуйте записаться позже</p>")
333            }
334        })
335    })
336
337    $("#activate-cert").on('submit', function(e) {
338        e.preventDefault();
339
340        let serialize = $(this).serializeArray();
341        number = serialize[0].value.trim();
342        pin = serialize[1].value.trim();
343
344        let domain = getApiDomain();
345
346        $.ajax({
347            type: 'GET',
348            url: domain + "/gym/" + gymId + "/cert/info",
349            data: {
350                pin_code: pin,
351                cert_number: number,
352                token: token
353            },
354            success: function (result){
355                if (result.id) {
356                    $('.form__bottom').html("")
357                } else {
358                    $('.form__bottom').html("<p style='color:red; margin-left:5px; margin-top: 15px'>Неверный номер или пин-код</p>")
359                    return;
360                }
361
362                let created = moment(result.created)
363                let expire = moment(result.expire)
364                if (isAppleDevice()) {
365                    created = moment(stringDateToAppleFormat(result.created))
366                    expire = moment(stringDateToAppleFormat(result.expire))
367                }
368                let products = result.products;
369
370                // применяется везде для форматирования дат
371                const dateFormatter = new DateFormatter();
372
373                created = dateFormatter.getTextDate(created)
374                expire = dateFormatter.getTextDate(expire)
375
376                $('#cert-created').html("Создан: " +created)
377                $('#cert-expire').html("Истекает: "+expire)
378                $('#cert-status').html("Статус: "+(result.status == 1 ? "Ждет активации": "Нельзя активировать"))
379                $('#cert-products').html("Продукт"+(products.length>1?"ы":"")+": "+products.map(x => x['name']).join(', '))
380                $("#opencert").click()
381                if ($(window).width() <= 700) {
382                    $('.container-fluid > .navbar').hide()
383                }
384
385                if ($(window).height() <= 600) {
386                    $('.form--check-balance_footer_final').css("margin-top", '40px')
387                }
388
389                if (result.status == 1) {
390                    $('.form--check-balance_footer_final > button').show()
391                } else {
392                    $('.form--check-balance_footer_final > button').hide()
393                }
394
395                console.log(result);
396            },
397            error: function (error) {
398                console.log(error)
399            }
400        })
401    })
402
403    $('.ps_gym_selector').on('click', function (e) {
404        let gym = $(this).attr('data-gym');
405        $.ajax({
406            type: 'POST',
407            url: '/psport/set_gym.php',
408            data: {
409                ps_gym: gym
410            },
411            success: function () {
412                window.location.hash = ""
413                document.location.reload()
414            }
415        })
416    })
417
418    // $('.city-block__item').hover(function () {
419    //     src = $(this).children('.city-item__img').attr('src');
420    //     dataSrc = $(this).children('.city-item__img').data('src-hover');
421    //     $(this).children('.city-item__img').attr('src',dataSrc);
422    //     $(this).children('.city-item__img').data('src-hover',src);
423    // }, function () {
424    //     src = $(this).children('.city-item__img').attr('src');
425    //     dataSrc = $(this).children('.city-item__img').data('src-hover');
426    //     $(this).children('.city-item__img').attr('src',dataSrc);
427    //     $(this).children('.city-item__img').data('src-hover',src);
428    // });
429    $('#choose_location, #select_club').on('shown.bs.modal',function () {
430        $(this).children('.modal-dialog').css({
431           marginTop: ($(window).height() - $(this).children('.modal
431-dialog').height()) / 2
432        })
433    });
434
435    function calcHeightContactBlock() {
436        var contactBlock = $('.popup--contact');
437        var winHeight = $(window).height();
438        var winWidth = $(window).width();
439        if(contactBlock.length > 0){
440            console.log(contactBlock);
441            console.log(contactBlock.height());
442            console.log(contactBlock.offset().top);
443            console.log(winHeight);
444            console.log(winWidth);
445            if(winWidth > 425) {
446                if (contactBlock.height() + contactBlock.offset().top > winHeight) {
447                    contactBlock.height(winHeight - contactBlock.offset().top - 15);
448                    contactBlock.css({
449                        overflow: 'auto'
450                    })
451                }
452            }
453        }
454    }
455    calcHeightContactBlock();
456    var locationBlock = $('.js-location span');
457    var locationLongName = locationBlock.html();
458    var locationShortName = locationBlock.attr('data-small-name');
459    changeLocationName();
460    function changeLocationName() {
461        if($(window).width() < 1440 && $(window).width() > 1200){
462            locationBlock.attr('data-small-name',locationLongName).html(locationShortName);
463        } else if ($(window).width() < 426){
464            locationBlock.attr('data-small-name',locationLongName).html(locationShortName);
465        }
466        else {
467            locationBlock.attr('data-small-name',locationShortName).html(locationLongName);
468        }
469    }
470    $(window).resize(function () {
471        changeLocationName();
472    });
473
474    $('#buyProductButton').on('click', function (e) {
475        e.preventDefault()
476        let productId = $(this).data('product-id')
477        if (!productId) {
478            $('#buyError').html("<p style='color:red; margin-left:5px'>Продукт не найден</p>")
479        }
480
481        $.ajax({
482            type: 'POST',
483            url: domain + "/gym/" + gymId + "/cart",
484            data: {
485                products: productId,
486                token: token
487            },
488            success: function (result){
489                if (result.result) {
490                    document.location = getApiDomain()+'cart/'+gymId+'/'+result.id+'/pay?token='+token
491                } else {
492                    $('#buyError').html("<p style='color:red; margin-left:5px'>Ошибка создания корзины</p>")
493                }
494            },
495            error: function(error) {
496                $('#buyError').html("<p style='color:red; margin-left:5px'>Ошибка создания корзины</p>")
497            }
498        })
499    });
500});
501
502const rctm220 = () => {
503  const li = document.querySelector('.footer .navbar-nav > li:nth-last-of-type(3)')
504  if(!li){
505    setTimeout(rctm220, 400)
506    return false
507  }
508
509  li.append( document.querySelector('.footer .navbar-nav > li:nth-last-of-type(2) > a') )
510  document.querySelector('.footer .navbar-nav > li:nth-last-of-type(2)').remove()
511  li.append( document.querySelector('.footer .navbar-nav > li:last-of-type > a') )
512  document.querySelector('.footer .navbar-nav > li:last-of-type').remove()
513}
514rctm220()

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.