PageSourceSearch

https://www.moto-avangard.ru/bitrix/templates/bmw/js/sub.js

js moto-avangard.ru collected 2026-10-05 00:03:37 UTC 7,930 bytes, 175 lines download raw bytes

1$(document).ready(function(){   
2   $(".popup").fancybox({}); 
3   $(".video-popup").fancybox({padding: 0}); 
4    $(".ing_form_slide_new").click(function(){
5        formId = $(this).attr("form-id");
6        link = $(this);
7        if($('#form-'+formId).is(':visible')){
8             $.when( $('#form-'+formId).slideToggle(1000)).then(function( data, textStatus, jqXHR ) {
9              $('#form-'+formId).remove();
10              });
11        }else{
12
13            if(formId == 21)
14              ing_events({category:'test-drive',action:'click',label:'test-drive_click',ya_label:'test-drive_click'});
15            else if(formId == 22)
16              ing_events({category:'services',action:'click',label:'services_click',ya_label:'services_click'});
17            else if(formId == 28)
18              ing_events({category:'compred',action:'click',label:'compred_click',ya_label:'compred_click'});
19            else if(formId == 26)
20              ing_events({category:'ocenka',action:'click',label:'ocenka_click',ya_label:'ocenka_click'});
21            else if(formId == 27)
22              ing_events({category:'raschet',action:'click',label:'raschet_click',ya_label:'raschet_click'});
23
24            $.ajax({
25              url: "/ajax/form2.php?form-id="+formId+"&ref="+REFERER+"&bacref="+BACKREFERER,
26              type: "POST",
27              data: "",
28              success: function(response){
29                    link.after("<div class='append' id='form-"+formId+"'></div>");
30                    $('#form-'+formId).html(response);
31                    $('#form-'+formId).slideToggle(1000);
32                    $('#form-'+formId).find("input[type='submit']").attr("disabled","");
33                    var c = document.querySelector('#apply_rules-'+formId);
34                    c.onclick = function() {
35                     $('#form-'+formId).find("input[type='submit']").attr("disabled","");
36                     if (c.checked) {
37                      $('#form-'+formId).find("input[type='submit']").removeAttr("disabled");
38                     }
39                    }
40              },
41              //dataType: dataType
42            });
43        }
44    });
45	
46  
47	
48}); 
49
50function formPost () {
51    console.log("formPost");
52    var form = $(".append form");
53
54    form.submit(function(){
55        data = form.serialize();
56        let form_data = document.getElementById('f_feedback_FID1');
57
58        $.ajax({
59          url: "/ajax/form2.php?form-id="+formId+"&ref="+REFERER+"&bacref="+BACKREFERER,
60          type: "POST",
61          data: data,
62          success: function(response){
63              $('#form-'+formId).html(response);
64              if(form_data) {
65                  sendDataToCallTouch(new FormData(form_data));
66              }
67
68          },
69          
70        });
71        return false;
72    })
73}
74
75function sendDataToCallTouch (data_form) {
76    console.log(data_form);
77
78    let phone = data_form.get('FIELDS[PHONE_FID1]').replace(/\D/g, '');
79    let info = [
80        {"name": "Имя клиента", "value": data_form.get('FIELDS[NAME_FID1]')},
81        {"name": "Телефон", "value": phone},
82    ];
83
84
85    try {
86        window.ctw.createRequest(
87            'moto_form',
88            phone,
89            info,
90            function(success, data){
91                if (success) {
92                    console.log('Создана заявка на колбек, идентификатор: ' + data.callbackRequestId)
93                } else {
94                    switch(data.type) {
95                        case "request_throttle_timeout":
96                        case "request_throttle_count":
97                            console.log('Достигнут лимит создания заявок, попробуйте позже');
98                            break;
99                        case "request_phone_blacklisted":
100                            console.log('номер телефона находится в черном списке');
101                            break;
102                        case "validation_error":
103                            console.log('были переданы некорректные данные');
104                            break;
105                        default:
106                            console.log('Во время выполнения запроса произошла ошибка: ' + data.type);
107                    }
108                }
109
110            }
111        );
112    }
113    catch(err) {
114        console.log('Calltouch doesn\'t work');
115    }
116}
117
118function ing_events(params) {
119    /* Включить вывод события в консоль */
120    var ing_events_debug = true;
121    var ing_events_counters = [];
122    /* Массив с ID метрики */
123    var ing_mertic_ids = ['37300570'];
124    /* Проверяем на существование параметров переданных в функцию */
125    if (typeof params !=="undefined") {
126        /* Проверяем на существование всех необходимых параметров */
127        if (typeof params.category !=="undefined" && typeof params.action !=="undefined" && typeof params.label !=="undefined" ) {
128            /* Ищем счетчик ga.js */
129            if (typeof _gaq !=="undefined"){
130                _gaq.push(['_trackEvent', params.category, params.action, params.label]);
131                ing_events_counters.push('_gaq');
132            }
133            /* Ищем счетчик analytics.js */
134            if (typeof ga !=="undefined"){
135                ga('send', 'event', params.category, params.action, params.label);
136                ing_events_counters.push('ga');
137            }
138            /* Ищем счетчик pageTracker */
139            if (typeof pageTracker !=="undefined"){
140                pageTracker._trackEvent(params.category, params.action, params.label);
141                ing_events_counters.push('pageTracker');
142            }
143            /* Перебираем ID метрики */
144            for(i=0;i<ing_mertic_ids.length;i++) {
145                /* Если существует функция с текущем ID */
146                if (typeof window['yaCounter'+ing_mertic_ids[i]] !=="undefined"){
147                    if (typeof params.mp !=="undefined") {
148                        /* Вызываем событие метрики с параметрами */
149                        if(typeof params.ya_label !=="undefined") {
150                            window['yaCounter'+ing_mertic_ids[i]].reachGoal(params.ya_label, params.mp);
151                        } else {
152                            window['yaCounter'+ing_mertic_ids[i]].reachGoal(params.label, params.mp);
153                        }
154                    } else {
155                        /* Вызываем событие метрики без параметров */
156                        if(typeof params.ya_label !=="undefined") {
157                            window['yaCounter'+ing_mertic_ids[i]].reachGoal(params.ya_label);
158                        } else {
159                            window['yaCounter'+ing_mertic_ids[i]].reachGoal(params.label);
160                        }
161                    }
162                    ing_events_counters.push('yaCounter'+ing_mertic_ids[i]);
163                }
164            }
165            if(ing_events_counters.length === 0) {ing_events_counters.push('none');}
166            if(ing_events_debug === true) {
167                if(typeof params.ya_label !=="undefined") {
168                    console.log('event reached:\n\t[category: '+params.category+']\n\t[action   :'+params.action+']\n\t[label    :'+params.label+']\n\t[ya_label :'+params.ya_label+']\nevent counters:\n\t'+ing_events_counters);
169                } else {
170                    console.log('event reached:\n\t[category:'+params.category+']\n\t[action  :'+params.action+']\n\t[label   :'+params.label+']\nevent counters:\n\t'+ing_events_counters);
171                }
172            }
173        }
174    }
175}

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.