PageSourceSearch

https://salon-love.ru/wp-content/themes/loveforever/js/front.js?ver=1791499319

js salon-love.ru collected 2026-10-08 22:42:20 UTC 14,989 bytes, 382 lines download raw bytes

1// Cookie manipulatiions
2if ($.cookie === undefined) {
3  !function (a) { "function" == typeof define && define.amd ? define(["jquery"], a) : "object" == typeof exports ? a(require("jquery")) : a(jQuery) }(function (a) { function b(a) { return h.raw ? a : encodeURIComponent(a) } function c(a) { return h.raw ? a : decodeURIComponent(a) } function d(a) { return b(h.json ? JSON.stringify(a) : String(a)) } function e(a) { 0 === a.indexOf('"') && (a = a.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\")); try { return a = decodeURIComponent(a.replace(g, " ")), h.json ? JSON.parse(a) : a } catch (b) { } } function f(b, c) { var d = h.raw ? b : e(b); return a.isFunction(c) ? c(d) : d } var g = /\+/g, h = a.cookie = function (e, g, i) { if (void 0 !== g && !a.isFunction(g)) { if (i = a.extend({}, h.defaults, i), "number" == typeof i.expires) { var j = i.expires, k = i.expires = new Date; k.setTime(+k + 864e5 * j) } return document.cookie = [b(e), "=", d(g), i.expires ? "; expires=" + i.expires.toUTCString() : "", i.path ? "; path=" + i.path : "", i.domain ? "; domain=" + i.domain : "", i.secure ? "; secure" : ""].join("") } for (var l = e ? void 0 : {}, m = document.cookie ? document.cookie.split("; ") : [], n = 0, o = m.length; o > n; n++) { var p = m[n].split("="), q = c(p.shift()), r = p.join("="); if (e && e === q) { l = f(r, g); break } e || void 0 === (r = f(r)) || (l[q] = r) } return l }; h.defaults = {}, a.removeCookie = function (b, c) { return void 0 === a.cookie(b) ? !1 : (a.cookie(b, "", a.extend({}, c, { expires: -1 })), !a.cookie(b)) } });
4}
5
6!function (a) { function f(a, b) { if (!(a.originalEvent.touches.length > 1)) { a.preventDefault(); var c = a.originalEvent.changedTouches[0], d = document.createEvent("MouseEvents"); d.initMouseEvent(b, !0, !0, window, 1, c.screenX, c.screenY, c.clientX, c.clientY, !1, !1, !1, !1, 0, null), a.target.dispatchEvent(d) } } if (a.support.touch = "ontouchend" in document, a.support.touch) { var e, b = a.ui.mouse.prototype, c = b._mouseInit, d = b._mouseDestroy; b._touchStart = function (a) { var b = this; !e && b._mouseCapture(a.originalEvent.changedTouches[0]) && (e = !0, b._touchMoved = !1, f(a, "mouseover"), f(a, "mousemove"), f(a, "mousedown")) }, b._touchMove = function (a) { e && (this._touchMoved = !0, f(a, "mousemove")) }, b._touchEnd = function (a) { e && (f(a, "mouseup"), f(a, "mouseout"), this._touchMoved || f(a, "click"), e = !1) }, b._mouseInit = function () { var b = this; b.element.bind({ touchstart: a.proxy(b, "_touchStart"), touchmove: a.proxy(b, "_touchMove"), touchend: a.proxy(b, "_touchEnd") }), c.call(b) }, b._mouseDestroy = function () { var b = this; b.element.unbind({ touchstart: a.proxy(b, "_touchStart"), touchmove: a.proxy(b, "_touchMove"), touchend: a.proxy(b, "_touchEnd") }), d.call(b) } } }(jQuery);
7
8$('[data-max-pages]').each(function () {
9  cur_part = $(this).attr('data-load-part');
10  if (parseInt($(this).attr('data-max-pages')) > 1) {
11    $('[data-load=' + cur_part + ']').show();
12  }
13})
14
15function getUploadedFiles(fieldName) {
16  const inputElement = document.querySelector(`input[name="${fieldName}"]`);
17  if (!inputElement || inputElement.type !== 'file') return '';
18  if (!inputElement.files || inputElement.files.length === 0) return '';
19  const uploadedFiles = Array.from(inputElement.files).map(file => file.name).join(', ');
20  return uploadedFiles;
21}
22
23jQuery(document).ready(function ($) {
24
25  $('[data-load-files] input').on('change', function () {
26
27    const form = $(this).parents('form');
28
29    const field = $(this).attr('name');
30    const files_list = form.find(`[data-files-list="${field}"]`);
31    const files_reset = form.find(`[data-files-reset="${field}"]`);
32
33    if (files_list.length) {
34
35      const uploadedFiles = getUploadedFiles(field);
36
37      if (uploadedFiles) {
38        files_list.html(files_list.attr('data-template').replace('{{ files }}', uploadedFiles));
39        files_list.show();
40        files_reset.show();
41      }
42    }
43  })
44
45  $('[data-files-reset]').on('click', function () {
46
47    const form = $(this).parents('form');
48
49    const field = $(this).attr('data-files-reset');
50    const files_field = form.find(`[data-load-files="${field}"] input`);
51    const files_list = form.find(`[data-files-list="${field}"]`);
52
53    $(this).hide();
54    files_field.val('');
55    files_list.html('');
56    files_list.hide();
57  })
58
59  $('[data-action=autoload]').on('change', function () {
60    $(this).parents('form').trigger('submit');
61  });
62
63  $('[data-action="search_filter_ajax"] [data-taxonomy]').click(function () {
64    if (!$(this).find('input').is(':checked')) { $(this).removeClass('active'); } else { $(this).addClass('active'); }
65  });
66
67  $('[data-action="reset_filter"]').click(function () {
68
69    $('[data-action=search_filter_ajax]').trigger("reset");
70
71    $('[data-range-slider]').each(function () {
72      let field = $(this).attr('data-range-slider');
73      let min_val = $('[name=min_pm_' + field + ']').attr('data-value');
74      let max_val = $('[name=max_pm_' + field + ']').attr('data-value');
75      $(this).slider("option", "values", [parseInt(min_val), parseInt(max_val)]);
76    });
77
78    $('[data-action=search_filter_ajax] .active').removeClass('active');
79
80    $('[data-action=search_filter_ajax]').trigger("submit");
81
82    $('[data-action=search_filter_ajax] .w-checkbox-input--inputType-custom').removeClass('w--redirected-checked');
83  });
84
85  $('[data-action="search_filter_ajax"]').submit(function (e) {
86
87    e.preventDefault();
88
89    let cur_part = $('body').attr('data-load-current');
90    let data_load = $('[data-load=' + cur_part + ']');
91
92    let formData = new FormData($(this)[0]);
93    let fields = {};
94
95    for (let [key, value] of formData) {
96      fields[key] = value;
97    }
98
99    fields['query'] = query_vars;
100
101    $('[data-action=preload]').show();
102    ajaxs('filter', fields, function (data) {
103      if (data) {
104        if (cur_part !== undefined) {
105          cur_part = '=' + cur_part;
106        } else {
107          cur_part = '';
108        }
109
110        let parent_container = $('[data-load-part' + cur_part + ']').parent().parent();
111        $('[data-load-part' + cur_part + ']').parent().remove();
112        parent_container.prepend(data);
113
114        const max_pages = parseInt($('[data-max-pages]').attr('data-max-pages'));
115
116        if (max_pages <= 1 || isNaN(max_pages)) {
117          $(data_load).hide();
118        } else {
119          $(data_load).show();
120        }
121
122        if (typeof (wtw_after_filter_ajax_load) === 'function') {
123          wtw_after_filter_ajax_load(cur_part);
124        } else {
125          Webflow.destroy(); Webflow.ready();
126          if (Webflow.require('ix2') !== undefined) Webflow.require('ix2').init();
127        }
128
129        $('[data-action=preload]').hide();
130
131      } else {
132        $(data_load).hide();
133      }
134    });
135  });
136
137  // $('[data-action="search_filter_ajax"]').trigger('submit');
138
139  $('[href*=\"brandjs\"],.w-webflow-badge').attr('style', 'display:none !important');
140
141  if ($('[data-load]')[0]) {
142
143    $('[data-load-part]:first').each(function () {
144      $('body').attr('data-load-current', $(this).attr('data-load-part'));
145    });
146
147    $('[data-set-part]').click(function () {
148      $('body').attr('data-load-current', $(this).attr('data-set-part'));
149    });
150
151    $('[data-max-pages=0]').each(function () {
152      cur_part = $(this).attr('data-load-part');
153      $('[data-load=' + cur_part + ']').hide();
154    })
155
156    $('[data-max-pages=1]').each(function () {
157      cur_part = $(this).attr('data-load-part');
158      if ($(this).attr('data-current-page') === '1') {
159        $('[data-load=' + cur_part + ']').hide();
160      }
161    })
162
163    $('[data-load]').click(function () {
164      var part = $(this).attr('data-load'); $('body').attr('data-load-current', part);
165      var max_pages = $('[data-load-part=' + part + ']:last').attr('data-max-pages');
166      var current_page = $('[data-load-part=' + part + ']').last().attr('data-current-page');
167      var archive = $(this).attr('data-load'); $('body').attr('data-archive', part);
168      var data = {
169        'query': query_vars,
170        'page': current_page,
171        'part': part,
172        'archive': archive
173      };
174      if (current_page != max_pages) {
175        $('[data-action=preload]').show();
176        ajaxs('ajaxs_load_posts', data, function (data) {
177          if (data) {
178            current_page++;
179            cur_part = $('body').attr('data-load-current');
180            if (cur_part !== undefined) {
181              cur_part = '=' + cur_part;
182            } else {
183              cur_part = '';
184            }
185            $('[data-load-part' + cur_part + ']').last().parent().after(data);
186            if (current_page == max_pages) $('[data-load' + cur_part + ']').hide();
187            Webflow.destroy(); Webflow.ready();
188            if (Webflow.require('ix2') != undefined) Webflow.require('ix2').init();
189            $('[data-action=preload]').hide();
190          } else {
191            $(data_load).hide();
192          }
193        });
194      }
195    });
196
197    if ($('body').attr('data-load-scroll') !== undefined) {
198      $(window).scroll(function () {
199        var scroll_offset = $('body').attr('data-load-scroll');
200        var part = $(this).attr('data-load'); $('body').attr('data-load-current', part);
201        var max_pages = $('[data-load-part=' + part + ']:last').attr('data-max-pages');
202        var current_page = $('[data-load-part=' + part + ']').last().attr('data-current-page');
203        var archive = $(this).attr('data-load'); $('body').attr('data-archive', part);
204        var data = {
205          'query': query_vars,
206          'page': current_page,
207          'part': part,
208          'archive': archive
209        };
210        if ($(document).scrollTop() > ($(document).height() - scroll_offset) && current_page != max_pages && !$('body').hasClass('loading')) {
211          $('body').addClass('loading');
212          ajaxs('ajaxs_load_posts', data, function (data) {
213            if (data) {
214              cur_part = $('body').attr('data-load-current');
215              if (cur_part !== undefined) {
216                data_load = '[data-load=' + cur_part + ']';
217              } else {
218                data_load = '[data-load]';
219              }
220              $('body').removeClass('loading');
221              $(data_load).before(data);
222              current_page++;
223              if (current_page == max_pages) $(data_load).hide();
224              Webflow.destroy(); Webflow.ready();
225              if (Webflow.require('ix2') != undefined) Webflow.require('ix2').init();
226            }
227          });
228        }
229      });
230    }
231  }
232
233  $('body').on('click', '[data-copy]', function () {
234    params = $(this).attr('data-copy').split(' ');
235    $('.' + params[1]).html($(this).parent().find('.' + params[0]).html());
236    wtw_webflow_init();
237  });
238
239  $('body').on('click', '[data-copy-attrs]', function () {
240    params = $(this).attr('data-copy').split(' ');
241    $('.' + params[1]).html($(this).parent().find('.' + params[0]).html());
242    Webflow.destroy(); Webflow.ready();
243    if (Webflow.require('ix2') != undefined) Webflow.require('ix2').init();
244  });
245
246  $('[data-object=wp_term_menu] a').each(function () {
247    if (document.URL === $(this).attr('href')) {
248      $(this).addClass('active');
249      $(this).addClass('w--current');
250      $(this).parents().each(function () {
251        if ($(this).attr('data-object') === 'wp_term_menu') return false;
252        $(this).addClass('active');
253        $(this).addClass('w--current');
254      });
255    }
256  });
257
258  $('a').not('.w--current,.active').each(function () {
259    if (document.URL === $(this).attr('href')) {
260      $(this).addClass('w--current');
261    }
262  });
263
264  $('a').each(function () {
265    if ($(this).attr('href') === '#') {
266      $(this).removeClass('w--current');
267    }
268  });
269
270  $('[data-content=term-level] .w--current').each(function () {
271    $(this).parent().parent().parents('[data-content=term-level]').each(function () {
272      $(this).children().first().trigger('click');
273    });
274  });
275
276  // обработка полей фильтра
277  $('[name=search_filter]').submit(function (e) {
278    var form = $(this);
279    if ($(this).attr('data-mode') !== 'ajax') {
280      if ($(this).find('[name=s]').val() === '') {
281        $(this).find('[name=s]').removeAttr('name');
282      }
283      $(this).find('.w-input').each(function () {
284        if ($(this).attr('data-value') === $(this).val()) {
285          // $(this).removeAttr('name');
286        }
287      });
288    }
289  });
290
291  // слайдер диапозонов значений
292  $('[data-range-slider]').each(function () {
293    var field = $(this).attr('data-range-slider');
294    $(this).slider({
295      step: parseInt($(this).attr('data-ui-slider')),
296      range: true,
297      min: parseInt($("[name=min_pm_" + field + "]").attr('data-value')),
298      max: parseInt($("[name=max_pm_" + field + "]").attr('data-value')),
299      values: [parseInt($("[name=min_pm_" + field + "]").val()), parseInt($("[name=max_pm_" + field + "]").val())],
300      slide: function (event, ui) {
301        $("[name=min_pm_" + field + "]").val(ui.values[0]).keyup();
302        $("[name=max_pm_" + field + "]").val(ui.values[1]).keyup();
303      }
304    });
305  });
306
307});
308
309// use in Ajax filter
310
311function set_query_vars(query_data) {
312  query_vars = query_data;
313}
314
315function wtw_webflow_init() {
316  Webflow.destroy();
317  Webflow.ready();
318  WebflowIx2 = Webflow.require('ix2');
319  WebflowIx2 != undefined ? WebflowIx2.init() : '';
320  document.dispatchEvent(new Event('readystatechange'));
321}
322
323function d() {
324  for (var i = 0; i < arguments.length; i++) {
325    console.log(arguments[i]);
326  }
327}
328
329function dt() {
330  for (var i = 0; i < arguments.length; i++) {
331    console.table(arguments[i]);
332  }
333}
334
335function wtw_number_format(number, decimals, dec_point, thousands_sep) {
336  number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
337  var n = !isFinite(+number) ? 0 : +number,
338    prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
339    sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
340    dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
341    s = '',
342    toFixedFix = function (n, prec) {
343      var k = Math.pow(10, prec);
344      return '' + (Math.round(n * k) / k)
345        .toFixed(prec);
346    };
347  s = (prec ? toFixedFix(n, prec) : '' + Math.round(n))
348    .split('.');
349  if (s[0].length > 3) {
350    s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
351  }
352  if ((s[1] || '')
353    .length < prec) {
354    s[1] = s[1] || '';
355    s[1] += new Array(prec - s[1].length + 1)
356      .join('0');
357  }
358  return s.join(dec);
359}
360
361function logForms() {
362  const forms = document.forms;
363
364  for (const form of forms) {
365    const formName = form.name;
366    const formId = form.id;
367    const formElements = form.elements;
368    const formValues = {};
369
370    for (const element of formElements) {
371      const { name, value } = element;
372
373      formValues[name] = value;
374    }
375
376    console.log({ formName, formId, ...formValues });
377  }
378}
379
380function getParentIndex(element) {
381  return [].indexOf.call(element.parentNode.children, element);
382}

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.