PageSourceSearch

https://lkg.ru/bitrix/templates/aspro_max/js/custom.js?171646553713185

js lkg.ru collected 2026-10-08 03:31:39 UTC 13,185 bytes, 364 lines download raw bytes

1/*
2You can use this file with your scripts.
3It will not be overwritten when you upgrade solution.
4*/
5
6
7document.addEventListener('DOMContentLoaded', function () {
8  let quiz_load = true;
9  if (document.querySelector('#quiz-load') || document.querySelector('#quiz-load-banner')) {
10    document.querySelector('#quiz-load').addEventListener("click",  quizLoad);
11    if(document.querySelector('#quiz-load-banner')) {
12      document.querySelector('#quiz-load-banner').addEventListener("click",  quizLoad);
13    }
14    
15    
16    async function quizLoad(e) {
17      e.preventDefault();
18      if (quiz_load) {
19        quiz_load = false;
20        const head = document.querySelector('head');
21        const body = document.querySelector('body');
22
23        function addCSS(id, css, href, media) {
24          let link = document.createElement('link');
25          link.id = id;
26          link.rel = 'stylesheet';
27          if (css) {
28            link.type = 'text/css';
29          }
30          link.href = href;
31          if (media) {
32            link.media = 'all';
33          }
34          head.appendChild(link);
35        };
36
37        function addScript(id, src) {
38          let link = document.createElement('script');
39          link.id = id;
40          link.src = src;
41          body.appendChild(link);
42        };
43
44        addCSS('quiz-css', true, '/quiz/css/style.min.css?00012', true);
45        addCSS('quiz-font', false, 'https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap', false);
46
47        await fetch('/quiz/start.php?0001')
48          .then(function (response) {
49            return response.text()
50          })
51          .then(function (html) {
52            // console.info(html);
53            let quiz = document.createElement('div');
54            quiz.id = 'quiz-block';
55            // quiz.setAttribute('data-id', '1')
56            quiz.classList.add('quiz-block');
57            quiz.innerHTML = html;
58            body.appendChild(quiz);
59            // quizForm();
60            // quizLink();
61            addScript('quiz-js', '/quiz/js/script.min.js?0008');
62            // Close
63            let closeQuiz = document.querySelector('#close-quiz');
64            let closeSuccess = document.querySelector('#close-success');
65            let quizBlock = document.querySelector('#quiz-block');
66            closeQuiz.addEventListener('click', function (e) {
67              e.preventDefault();
68              quizBlock.classList.add('dn');
69            })
70            closeSuccess.addEventListener('click', function (e) {
71              e.preventDefault();
72              quiz_load = true;
73              quizBlock.remove();
74              document.querySelector('#quiz-js').remove();
75              document.querySelector('#quiz-css').remove();
76              document.querySelector('#quiz-font').remove();
77            })
78          })
79          .catch(function (err) {
80            console.error('Failed to fetch page: ', err);
81          });
82      } else {
83        document.querySelector('#quiz-block').classList.remove('dn');
84      }
85    }
86    
87  }
88}, false);
89
90
91
92// $(window).on("load", function () {
93//
94//   // Маска ввода телефона start
95//   function setCursorPosition(pos, elem) {
96//     elem.focus();
97//     if (elem.setSelectionRange) elem.setSelectionRange(pos, pos);
98//     else if (elem.createTextRange) {
99//       var range = elem.createTextRange();
100//       range.collapse(true);
101//       range.moveEnd("character", pos);
102//       range.moveStart("character", pos);
103//       range.select()
104//     }
105//   }
106//
107//   function mask(event) {
108//     var matrix = "+7 (___) ___-__-__",
109//       i = 0,
110//       def = matrix.replace(/\D/g, ""),
111//       val = this.value.replace(/\D/g, "");
112//     if (def.length >= val.length) val = def;
113//     this.value = matrix.replace(/./g, function (a) {
114//       return /[_\d]/.test(a) && i < val.length ? val.charAt(i++) : i >= val.length ? "" : a
115//     });
116//     if (event.type == "blur") {
117//       if (this.value.length == 2) this.value = ""
118//     } else setCursorPosition(this.value.length, this)
119//   };
120//
121//   var inputPhone = document.querySelectorAll('input[name="phone"].required');
122//   for (var i = 0; i < inputPhone.length; i++) {
123//     inputPhone[i].addEventListener("input", mask, false);
124//     inputPhone[i].addEventListener("focus", mask, false);
125//     inputPhone[i].addEventListener("blur", mask, false);
126//   }
127//   ;
128//   // Маска ввода телефона end
129//
130//
131//   // показ модалки start
132//   //ховер start
133//   if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
134//     // код для мобильных устройств
135//   } else {
136//     $(".modal-form__img, .modal-form__content, .modal-form__form")
137//       .hover(
138//         function () {
139//           $(".modal-form__img").addClass("active");
140//         },
141//         function () {
142//           $(".modal-form__img").removeClass('active');
143//         }
144//       );
145//   }
146//   //ховер end
147//
148//   function modalShow() {
149//     // console.log("modalShow", sessionStorage.getItem("modalShow"));
150//     return sessionStorage.getItem("modalShow") == "0" ? false : true
151//   }
152//
153//   function modalActive() {
154//     if (modalShow()) {
155//       $(".modal-form_wrap").addClass("active");
156//       sessionStorage.setItem("modalShow", "0");
157//     }
158//   }
159//
160//   const dataElement = $(".modal-form_wrap").attr("data-element");
161//   // console.log("dataElement", dataElement);
162//   if (dataElement === "" && modalShow()) {
163//     console.log("dataElement if", dataElement);
164//     inWindow();
165//   } else if (dataElement !== "" && modalShow() && dataElement !== undefined) {
166//     // console.log("dataElement else if", dataElement);
167//     inWindow(dataElement);
168//   }
169//
170//   function inWindow(elem = "#fast-popup") {
171//     $(window).scroll(function () {
172//       let wt = $(window).scrollTop();
173//       let wh = $(window).height();
174//       let et = $(elem).offset().top;
175//       let eh = $(elem).outerHeight();
176//       if (wt + wh >= et && wt + wh - eh * 2 <= et + (wh - eh)) {
177//         if (modalShow()) {
178//           modalActive();
179//         }
180//       }
181//     });
182//     // $(window).scroll(function(){
183//     //   let wt = $(window).scrollTop();
184//     //   let wh = $(window).height();
185//     //   let et = $(elem).offset().top;
186//     //   let eh = $(elem).outerHeight();
187//     //   let dh = $(document).height();
188//     //   if (wt + wh >= et || wh + wt == dh || eh + et < wh){
189//     //     modalActive();
190//     //   }
191//     // });
192//   }
193//
194//   const dataTime = $(".modal-form_wrap").attr("data-time");
195//
196//   // console.log("dataTime", dataTime);
197//   function funTime(time = 60) {
198//     setTimeout(modalActive, time + "000");
199//   }
200//
201//   if (dataTime === "" && modalShow()) {
202//     // console.log("dataTime if", dataTime);
203//     funTime();
204//   } else if (dataTime && dataTime > 0 && modalShow()) {
205//     // console.log("dataTime else if", dataTime);
206//     funTime(Number(dataTime));
207//   }
208//
209//   const dataScroll = $(".modal-form_wrap").attr("data-scroll");
210//   // console.log("dataScroll", dataScroll);
211//   if (dataScroll !== "" && dataScroll !== undefined) {
212//     // console.log("dataScroll if", dataScroll);
213//     const heightHTML = $(document).outerHeight(true);
214//     // console.log("heightHTML", heightHTML);
215//     const heigh = Math.round(heightHTML / 100 * dataScroll - window.innerHeight / 2); // window.innerHeight / 2
216//     // console.log("heigh", heigh);
217//     $(window).scroll(function () {
218//       let scrollTop = $(this).scrollTop()
219//       // console.log("scrollTop", scrollTop);
220//       // if (scrollTop <= heigh+10 && scrollTop >= heigh-10) {
221//       //   console.log("TEST");
222//       //   $(".modal-form_wrap").addClass("active");
223//       // }
224//       if (scrollTop >= heigh && modalShow()) {
225//         modalActive();
226//       }
227//     });
228//   }
229//
230//   const dataClick = $(".modal-form_wrap").attr("data-click");
231//
232//   // console.log("dataClick", dataClick);
233//   function funClick(click = "#show-fast-popup") {
234//     $("a[href=" + click + "]").on("click", function () {
235//       modalActive();
236//     });
237//   }
238//
239//   if (dataClick === "") {
240//     // console.log("dataClick if", dataClick);
241//     funClick();
242//   } else if (dataClick !== "" && dataClick !== undefined) {
243//     // console.log("dataClick else if", dataClick);
244//     funClick(dataClick);
245//   }
246//
247//   const dataMouse = $(".modal-form_wrap").attr("data-mouse");
248//   // console.log("dataMouse", dataMouse);
249//   if (dataMouse === "" && modalShow()) {
250//     $(window).on('mouseleave', function (e) {
251//       if (e.relatedTarget == null && modalShow()) {
252//         modalActive();
253//       }
254//     });
255//   }
256//
257//   $(".modal-form__close").on("click", function () {
258//     $(".modal-form_wrap").removeClass("active");
259//   });
260//   // показ модалки end
261//
262//   // отправка формы start
263//   if ($(".modal-form_wrap")) {
264//     // Отправка формы
265//     $(".modal-form__form-send").on("click", function (e) {
266//       e.preventDefault();
267//
268//       // получаем форму
269//       var form = $(this).parent(".modal-form__form-form");
270//       // console.log(form);
271//
272//       //укажем url в форме
273//       var location = window.location.pathname;
274//       // console.log(location)
275//       form.find("input[name='url']").val(location);
276//
277//       // собираем потомков
278//       var formChildren = form.find(".modal-form__form-input.required");
279//       // console.log(formChildren);
280//
281//       // очистка поля от обводки ошибки заполнения
282//       if (formChildren.parent(".modal-form__form-label").hasClass("err")) {
283//         formChildren.parent(".modal-form__form-label").removeClass("err");
284//         form.find("div.error").remove();
285//         // formChildren.parent(".modal-form__form-label").siblings("div.error").remove();
286//       }
287//
288//       // массив ошибок заполнение полей
289//       var err = [];
290//
291//       // Проверка на заполнение полей
292//       formChildren.each(function () {
293//         if ($(this).hasClass("required")) {
294//           var name = $(this).attr("name");
295//           // console.log(name);
296//           switch (name) {
297//             case "name":
298//               if ($(this).val() === "") {
299//                 $(this).after('<div class="error">Заполните поле</div>');
300//                 $(this).parent(".modal-form__form-label").addClass("err");
301//                 err.push('false');
302//               }
303//               break;
304//             case "phone":
305//               if ($(this).val() === "") {
306//                 $(this).after('<div class="error">Заполните поле</div>');
307//                 $(this).parent(".modal-form__form-label").addClass("err");
308//                 err.push('false');
309//               } else if ($(this).val() != $(this).val().match(/\+7 \(\d\d\d\) \d\d\d-\d\d-\d\d/)) {
310//                 $(this).after('<div class="error">Введите валидный номер</div>');
311//                 $(this).parent(".modal-form__form-label").addClass("err");
312//                 err.push('false');
313//               }
314//               break;
315//           }
316//           setTimeout(function () {
317//             formChildren.parent(".modal-form__form-label").removeClass("err");
318//             form.find("div.error").remove();
319//           }, 5000);
320//         }
321//       });
322//
323//       // если ошибок нет отправим форму
324//       if (!err.includes('false')) {
325//         var formData = new FormData(form.get(0));
326//         // for(let [name, value] of formData) {
327//         //   console.log(`${name} = ${value}`);
328//         // }
329//
330//         $.ajax({
331//           url: "/ajax/custom_form/handler.php",
332//           type: "POST",
333//           contentType: false,
334//           processData: false,
335//           data: formData,
336//           success: function (data) {
337//             // console.log(data);
338//             // form.html(data);
339//             // var dt = data.replace(/\s/g, '');
340//             form.after("<p id='successfully'>Форма успешно отправлена</p>");
341//             form.hide();
342//             $(".modal-form__form-privacy").hide();
343//
344//             gtag('event', 'Отправка формы', {'event_category': 'Отправка любой формы'});
345//             ym(66908173, 'reachGoal', 'send_all_form');
346//
347//             setTimeout(function () {
348//               $("#successfully").remove();
349//               form[0].reset();
350//               form.show();
351//               $(".modal-form__form-privacy").show();
352//             }, 5000);
353//           },
354//           error: function (xhr, str) {
355//             alert('Возникла ошибка: ' + xhr.responseCode);
356//           }
357//         });
358//       }
359//
360//     });
361//   }
362//   // отправка формы end
363// });
364//

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.