PageSourceSearch

https://aurora-pack.ru/bitrix/cache/js/s1/aurora/template_7e81685f…9e71747a3407ff36a1cce6_v1.js?17907573438682

js aurora-pack.ru collected 2026-10-04 13:26:13 UTC 8,682 bytes, 223 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:55:"/local/templates/aurora/js/phone-mask.js?17852435471696";s:6:"source";s:40:"/local/templates/aurora/js/phone-mask.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3(function () {
4  function format(digits) {
5    if (digits.length && (digits[0] === '7' || digits[0] === '8')) digits = digits.slice(1);
6    digits = digits.slice(0, 10);
7    var out = '+7';
8    if (digits.length > 0) out += ' ' + digits.slice(0, 3);
9    if (digits.length > 3) out += ' ' + digits.slice(3, 6);
10    if (digits.length > 6) out += ' ' + digits.slice(6, 8);
11    if (digits.length > 8) out += ' ' + digits.slice(8, 10);
12    return out;
13  }
14  function attach(el) {
15    if (el.dataset.phoneMasked) return;
16    el.dataset.phoneMasked = '1';
17    el.setAttribute('inputmode', 'tel');
18    el.setAttribute('autocomplete', 'tel');
19    if (!el.getAttribute('maxlength')) el.setAttribute('maxlength', '18');
20    if (!el.placeholder) el.placeholder = '+7 ___ ___ __ __';
21    el.addEventListener('focus', function () { if (!el.value) el.value = '+7 '; });
22    el.addEventListener('input', function () {
23      var digits = el.value.replace(/\D/g, '');
24      el.value = digits ? format(digits) : '';
25    });
26    el.addEventListener('blur', function () { if (el.value === '+7' || el.value === '+7 ') el.value = ''; });
27    el.addEventListener('keydown', function (e) {
28      if (e.key === 'Backspace' && el.value.replace(/\D/g, '').replace(/^7/, '').length === 0) el.value = '';
29    });
30    el.addEventListener('paste', function (e) {
31      e.preventDefault();
32      var text = (e.clipboardData || window.clipboardData).getData('text');
33      el.value = format(text.replace(/\D/g, ''));
34    });
35  }
36  function init() { document.querySelectorAll('input[type="tel"]').forEach(attach); }
37  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);
38  else init();
39})();
40
41/* End */
42;
43; /* Start:"a:4:{s:4:"full";s:50:"/local/templates/aurora/js/forms.js?17897523043967";s:6:"source";s:35:"/local/templates/aurora/js/forms.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
44(function () {
45  if (window.__auroraFormsBound) return;
46  window.__auroraFormsBound = true;
47
48  var ENDPOINT = '/local/ajax/lead.php';
49
50  function isSearch(form) {
51    return !!(form.querySelector('input[name="q"]') || form.getAttribute('role') === 'search');
52  }
53
54  function labelFor(el) {
55    var lab = el.closest('label');
56    if (lab) {
57      var txt = (lab.querySelector('span') || lab).textContent || '';
58      txt = txt.replace(/\s+/g, ' ').trim().replace(/\s*\*$/, '');
59      if (txt) return txt;
60    }
61    if (el.id) {
62      var byFor = document.querySelector('label[for="' + el.id + '"]');
63      if (byFor) {
64        var t = (byFor.textContent || '').replace(/\s+/g, ' ').trim().replace(/\s*\*$/, '');
65        if (t) return t;
66      }
67    }
68    return (el.getAttribute('placeholder') || el.getAttribute('name') || el.getAttribute('aria-label') || 'Поле').trim();
69  }
70
71  function formTitle(form) {
72    var explicit = (form.getAttribute('data-form-name') || '').replace(/\s+/g, ' ').trim();
73    if (explicit) return explicit;
74    var node = form;
75    for (var i = 0; i < 6 && node; i++) {
76      var h = node.querySelector ? node.querySelector('h1, h2, h3') : null;
77      if (h && h.textContent.trim()) return h.textContent.replace(/\s+/g, ' ').trim();
78      node = node.parentElement;
79    }
80    return (document.title || 'Форма').trim();
81  }
82
83  function isConsent(el) {
84    var nm = (el.name || '').toLowerCase();
85    if (/soglas|consent|agree|personal|politic/.test(nm)) return true;
86    var lbl = (labelFor(el) || '').toLowerCase();
87    return /соглас|обработк|персональн|политик/.test(lbl);
88  }
89
90  function collect(form) {
91    var fields = {};
92    var controls = form.querySelectorAll('input, textarea, select');
93    for (var i = 0; i < controls.length; i++) {
94      var el = controls[i];
95      var type = (el.type || '').toLowerCase();
96      if (type === 'submit' || type === 'button' || type === 'reset' || type === 'hidden' || type === 'file') continue;
97      if ((type === 'checkbox' || type === 'radio') && !el.checked) continue;
98      if ((type === 'checkbox' || type === 'radio') && isConsent(el)) continue;
99      var val = (el.value || '').trim();
100      if (!val) continue;
101      if (type === 'checkbox' || type === 'radio') val = el.value && el.value !== 'on' ? el.value : 'да';
102      fields[labelFor(el)] = val;
103    }
104    return fields;
105  }
106
107  function filesWith(form) {
108    var out = [], ins = form.querySelectorAll('input[type="file"]');
109    for (var i = 0; i < ins.length; i++) if (ins[i].files && ins[i].files.length) out.push(ins[i]);
110    return out;
111  }
112
113  function onSubmit(e) {
114    var form = e.target;
115    if (!form || form.tagName !== 'FORM' || isSearch(form)) return;
116
117    var fields = collect(form);
118    var files = filesWith(form);
119    if (!Object.keys(fields).length && !files.length) return;
120
121    try {
122      if (files.length) {
123        var fd = new FormData();
124        fd.append('form', formTitle(form));
125        fd.append('code', form.getAttribute('data-form-code') || '');
126        fd.append('page', location.pathname);
127        for (var k in fields) if (Object.prototype.hasOwnProperty.call(fields, k)) fd.append('fields[' + k + ']', fields[k]);
128        for (var i = 0; i < files.length; i++) {
129          var fl = files[i].files;
130          for (var j = 0; j < fl.length; j++) fd.append('files[]', fl[j]);
131        }
132        fetch(ENDPOINT, { method: 'POST', body: fd, credentials: 'same-origin' }).catch(function () {});
133      } else {
134        fetch(ENDPOINT, {
135          method: 'POST',
136          headers: { 'Content-Type': 'application/json' },
137          body: JSON.stringify({ form: formTitle(form), code: form.getAttribute('data-form-code') || '', page: location.pathname, fields: fields }),
138          keepalive: true,
139          credentials: 'same-origin'
140        }).catch(function () {});
141      }
142    } catch (err) {}
143  }
144
145  document.addEventListener('submit', onSubmit, true);
146})();
147
148/* End */
149;
150; /* Start:"a:4:{s:4:"full";s:59:"/local/templates/aurora/js/catalog-filter.js?17852435502221";s:6:"source";s:44:"/local/templates/aurora/js/catalog-filter.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
151(function () {
152  function attach(form) {
153    if (form.dataset.cfBound) return;
154    form.dataset.cfBound = '1';
155
156    var url = form.dataset.countUrl || '/local/ajax/catalog_count.php';
157    var section = form.dataset.section || '';
158    var countEl = form.querySelector('[data-cf-count]');
159    var timer;
160
161    function buildParams() {
162      var p = new URLSearchParams();
163      form.querySelectorAll('input[type="checkbox"]').forEach(function (cb) {
164        if (cb.checked && cb.name) p.append(cb.name, cb.value);
165      });
166      if (section) p.set('section', section);
167      return p;
168    }
169
170    function refresh() {
171      if (countEl) countEl.classList.add('is-loading');
172      fetch(url + '?' + buildParams().toString(), { headers: { 'X-Requested-With': 'fetch' } })
173        .then(function (r) { return r.json(); })
174        .then(function (d) {
175          if (countEl) {
176            countEl.textContent = (d && typeof d.count === 'number') ? plural(d.count) : '';
177            countEl.classList.remove('is-loading');
178          }
179        })
180        .catch(function () { if (countEl) countEl.classList.remove('is-loading'); });
181    }
182
183    var resetBtn = form.querySelector('[data-cf-reset]');
184    if (resetBtn) {
185      resetBtn.addEventListener('click', function (e) {
186        e.preventDefault();
187        form.querySelectorAll('input[type="checkbox"]').forEach(function (cb) { cb.checked = false; });
188        if (location.search) { location.href = location.pathname; return; }
189        refresh();
190      });
191    }
192
193    form.addEventListener('change', function (e) {
194      if (e.target.matches('input[type="checkbox"]')) {
195        clearTimeout(timer);
196        timer = setTimeout(refresh, 120);
197      }
198    });
199
200    refresh();
201  }
202
203  function plural(n) {
204    var a = Math.abs(n) % 100, b = a % 10, w;
205    if (a > 10 && a < 20) w = 'товаров';
206    else if (b > 1 && b < 5) w = 'товара';
207    else if (b === 1) w = 'товар';
208    else w = 'товаров';
209    return n + ' ' + w;
210  }
211
212  function boot() {
213    document.querySelectorAll('form.catalog-filter, form#catalog-filter').forEach(attach);
214  }
215
216  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot);
217  else boot();
218})();
219
220/* End */
221;; /* /local/templates/aurora/js/phone-mask.js?17852435471696*/
222; /* /local/templates/aurora/js/forms.js?17897523043967*/
223; /* /local/templates/aurora/js/catalog-filter.js?17852435502221*/

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.