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