1$(document).ready(function () { 2 $('.has-sub').hover( 3 function () { 4 $(this).find('.sub-menu').addClass('hover'); 5 6 }, 7 function () { 8 $(this).find('.sub-menu').removeClass('hover'); 9 }); 10 11 12// ÐаÑÑÑÐµÐ»Ñ Ð½Ð¾Ð²Ð¸Ð½ÐºÐ¸ 13// $(document).ready(function(){ 14// $('.news-slider-in').bxSlider({ 15// slideWidth: 270,.blog-cat ul li a 16// minSlides: 1, 17// maxSlides: 4, 18// slideMargin: 20, 19// pager: false 20// }); 21// }); 22// $(document).ready(function () { 23 // var items = 3; 24 // var nav = 'true'; 25 // if ($(window).width() < 500) { 26 // items = 1; 27 // nav = 'false'; 28 // } 29 $('.news-slider-in.owl-carousel').owlCarousel( 30 { 31 loop: false, 32 navText: ["", ""], 33 responsive: { 34 0: { 35 items: 2, 36 nav: false, 37 center: true, 38 loop: true 39 }, 40 768: { 41 items: 4, 42 nav: true, 43 loop: true, 44 }, 45 992: { 46 items: 3, 47 nav: true, 48 loop: false 49 }, 50 1150: { 51 items: 4, 52 nav: true, 53 loop: false 54 } 55 } 56 } 57 ); 58 59 // }) 60// ÐÐ¾Ð½ÐµÑ ÐаÑÑÑÐµÐ»Ñ Ð½Ð¾Ð²Ð¸Ð½ÐºÐ¸ 61 62// ÐаÑÑÑÐµÐ»Ñ Ð¿Ð¾Ð¿ÑлÑÑнÑе в блоге 63 $(document).ready(function () { 64 $('.pop-in').bxSlider({ 65 slideWidth: 285, 66 minSlides: 1, 67 maxSlides: 4, 68 slideMargin: 20, 69 pager: false 70 }); 71 }); 72// ÐÐ¾Ð½ÐµÑ ÐаÑÑÑÐµÐ»Ñ Ð¿Ð¾Ð¿ÑлÑÑнÑе в блоге 73 74 75// ÐаÑÑÑÐµÐ»Ñ ÑоваÑа (миниаÑÑÑÑ) 76 /*$(document).ready(function(){ 77 $('.prod-car-vert-in').bxSlider({ 78 mode: 'vertical', 79 slideWidth: 100, 80 minSlides: 3, 81 maxSlides: 3, 82 slideMargin: 15, 83 pager: false 84 }); 85 }); 86 // ÐÐ¾Ð½ÐµÑ ÐаÑÑÑÐµÐ»Ñ ÑоваÑа (ÐÑновнаÑ) 87 88 // ÐаÑÑÑÐµÐ»Ñ ÑоваÑа (миниаÑÑÑÑ) 89 // $(document).ready(function(){ 90 // $('.prod-car-big-in').bxSlider({ 91 // pagerCustom: '.prod-car-vert-in' 92 // }); 93 // });*/ 94// ÐÐ¾Ð½ÐµÑ ÐаÑÑÑÐµÐ»Ñ ÑоваÑа (ÐÑновнаÑ) 95 96// Ð¼ÐµÐ½Ñ Ð² ÑайдбаÑе 97 /*$('.side-menu > ul > li > span').click(function(){ 98 //$(this).fadeOut(); 99 $(this).parent().find('ul').fadeToggle(); 100 $(this).parent().toggleClass('open'); 101 setTimeout( function(){ $(".sidebar").trigger("sticky_kit:recalc"); }, 500 ); 102 103 });*/ 104// ÐÐ¾Ð½ÐµÑ Ð¼ÐµÐ½Ñ Ð² ÑайдбаÑе 105 106// СÑилизаÑÐ¾Ñ 107 /*(function($) { 108 $(function() { 109 110 var stylerObjects = $('input, select'); 111 stylerObjects.styler({ 112 onFormStyled:function(){ 113 stylerObjects.css('visibility', 'visible'); 114 } 115 }); 116 117 }); 118 })(jQuery);*/ 119 120 $('body').on('change', 'input:radio', function () { 121 if ($(this).is(':checked')) { 122 $(this).parents('.one-cat-color, .prod-color, .prod-size').find('label').removeClass('checked'); 123 $(this).closest('label').addClass('checked'); 124 } 125 if ($(this).data().url) { 126 document.location.href = $(this).data().url; 127 } 128 }); 129 130 $('input:checkbox').change(function () { 131 if ($(this).is(':checked')) { 132 $(this).closest('label').addClass('checked'); 133 } else { 134 $(this).closest('label').removeClass('checked'); 135 } 136 }); 137 138 $('.one-pay-radio input:radio').change(function () { 139 if ($(this).is(':checked')) { 140 $(this).parents('.pay-radio').find('.one-pay-radio').removeClass('checked'); 141 $(this).closest('.one-pay-radio').addClass('checked'); 142 143 $('.all-hide-radio').find('.radio-hide').fadeOut(0).eq($(this).parents('.one-pay-radio').index()).fadeIn(); 144 } 145 }); 146 147 148// ÐÐ¾Ð½ÐµÑ ÑÑилизаÑоÑ
149 let changeBodyPadding = false; 150// Шапка пÑи ÑкÑоле 151 $(window).scroll(function () { 152 var scroll = $(window).scrollTop(); 153 154 //>=, not <= 155 if (scroll >= 75) { 156 //clearHeader, not clearheader - caps H 157 $("header").addClass("scroll"); 158 159 } else { 160 $("header").removeClass("scroll"); 161 162 } 163 if (scroll >= 75 && !changeBodyPadding) { 164 // console.log('болÑÑе!!'); 165 const header = $('header'); 166 $('body').animate({paddingTop: header.height() + 'px'}); 167 setTimeout(function () { 168 $("#addProductStickyBar").css("top", header.height() + "px"); 169 }, 400); 170 171 changeBodyPadding = true; 172 } else if (scroll < 75 && changeBodyPadding) { 173 // console.log('менÑÑе!!'); 174 const header = $('header'); 175 $('body').animate({paddingTop: header.height() + 'px'}); 176 setTimeout(function () { 177 $("#addProductStickyBar").css("top", header.height() + "px"); 178 }, 400); 179 changeBodyPadding = false; 180 } 181 }); 182// ÐÐ¾Ð½ÐµÑ Ð¨Ð°Ð¿ÐºÐ° пÑи ÑкÑоле 183 184// ФилÑÑÑ 185 /*$('.filter-mob-bt').click(function() { 186 $(this).toggleClass('active'); 187 $('.cat-filter-left').fadeToggle(); 188 });*/ 189 190 if ($(window).width() < 1250) { 191 // $('.filter-mob-bt').click(function(e) { 192 // $(this).toggleClass('active'); 193 // $('.cat-filter-left').fadeToggle(); 194 // e.stopPropagation(); 195 // }); 196 // 197 // $(document).click(function(e) { 198 // if (!$(e.target).is('.filter-mob-bt, .filter-mob-bt *, .cat-filter-left, .cat-filter-left *')) { 199 // $(".cat-filter-left").fadeOut(); 200 // $(".filter-mob-bt").removeClass('active') 201 // } 202 // }); 203 } 204 205// ÐÐ¾Ð½ÐµÑ Ð¤Ð¸Ð»ÑÑÑ 206 207// ÐоказаÑÑ ÑкÑÑÑÑ Ð¼ÐµÐ½Ñ Ð² моб 208 $('.show-hide-menu, .menu-back').click(function (e) { 209 e.preventDefault(); 210 211 $('.header-menu').fadeToggle(); 212 // $('.banners_top').fadeToggle(); 213 // $('.sub-menu, .sub-menu-left ul li ul').fadeOut(0); 214 $('.header-menu li').removeClass('open'); 215 216 let banner = document.querySelector('.banners_top'); 217 if (banner) { 218 // banner.style.display = 'block'; 219 $('.header-menu').css('top', '90px'); 220 $('.header-menu-in').css('padding-bottom', '40px') 221 // $('.header-top').css({top: '45px', position: 'absolute'}); 222 $('.banners_top').css('display', 'block') 223 } else { 224 $('.header-top').css('position', 'static'); 225 $('.header-menu').css('top', '45px'); 226 } 227 }); 228// ÐÐ¾Ð½ÐµÑ ÐоказаÑÑ ÑкÑÑÑÑ Ð¼ÐµÐ½Ñ Ð² моб 229 230// Ð¼ÐµÐ½Ñ Ð² моб 231 232 // $('body').on('click', function () { 233 // console.log($(this)); 234 // }) 235 function checkWidth(li) { 236 let href = li.querySelector('.has-sub-title').href; 237 let plug = 'javascript:void(0)'; 238 239 if (window.innerWidth < 991 && li.querySelector('.sub-menu')) { 240 li.querySelector('.has-sub-title').href = plug; 241 } else if (window.innerWidth >= 991 && li.querySelector('.sub-menu')) { 242 li.querySelector('.has-sub-title').href = href; 243 } 244 245 } 246 247 $('.header-menu-in li.has-sub .has-sub-title').click(function () { 248 let parent = $(this).closest('.has-sub'); 249 if (!parent.find('span').hasClass('open') && window.innerWidth < 991) { 250 //$('.sub-menu').css('display', 'none'); 251 $('.header-menu-in li.has-sub span').removeClass('open'); 252 $('.has-sub-title').css('font-weight', '400'); 253 parent.find('.has-sub-title').css('font-weight', '600'); 254 parent.find('span').addClass('open'); 255 parent.find('.sub-menu').show(); 256 checkWidth(parent[0]); 257 } else { 258 if (window.innerWidth < 991) { 259 parent.find('.sub-menu').hide(); 260 } 261 parent.find('.has-sub-title').css('font-weight', '400'); 262 //parent.find('.sub-menu').css('display', 'none'); 263 parent.find('span').removeClass('open'); 264 265 } 266 }); 267 $('.header-menu-in li.has-sub.selected .has-sub-title').click(); 268 269
270 $('.sub-menu-left ul li span').click(function () { 271 $(this).parent().find('ul').fadeToggle(); 272 $(this).parent().toggleClass('open'); 273 }); 274// ÐÐ¾Ð½ÐµÑ Ð¼ÐµÐ½Ñ Ð² моб 275 if ($(window).width() < 768) { 276 // $('.soc-block').toggleClass('container soc-block'); 277 $('.soc-under-block').toggleClass('one-footer-menu mob-footer-soc soc-under-block'); 278 $('.footer-soc-tit').toggleClass('footer-tit mob-soc-tit footer-soc-tit'); 279 $('.mob-soc-tit').append('<svg><use xlink:href="#svg-arrow-down"></use></svg>'); 280 } 281// Ð¼ÐµÐ½Ñ Ð² ÑÑÑеÑе на моб 282 if ($(window).width() <= 992) { 283 $('.footer-tit').click(function () { 284 if (!$(this).hasClass('opened')) { 285 $('.show-mobile-menu ul').css('display', 'none'); 286 $('.footer-tit').removeClass('opened'); 287 $('.footer-tit').css('font-weight', '400'); 288 $(this).addClass('opened'); 289 $(this).css('font-weight', '600'); 290 $(this).parent().find('ul').css({display: 'flex'}); 291 292 } else { 293 $(this).css('font-weight', '400'); 294 $(this).removeClass('opened'); 295 $(this).parent().find('ul').css({display: 'none'}); 296 } 297 }); 298 } 299 300 301// ÐÐ¾Ð½ÐµÑ Ð¼ÐµÐ½Ñ Ð² ÑÑÑеÑе на моб 302 303// Ðнопка поиÑка 304 305 $(document).ready(function () { 306 $(".bt-2, .close-search").click(function (e) { 307 $('.basket-pop').fadeOut(); 308 $('.search-pop').fadeToggle(function () { 309 $('#title-search-input').focus(); 310 $('header').toggleClass('large-z-index'); 311 }); 312 313 e.stopPropagation(); 314 }); 315 316 $(document).click(function (e) { 317 if (!$(e.target).is('.search-pop, .search-pop *')) { 318 $(".search-pop").hide(); 319 $('header').removeClass('large-z-index'); 320 } 321 }); 322 }); 323 324// ÐÐ¾Ð½ÐµÑ Ðнопка поиÑка 325 326// Ðнопка коÑÐ·Ð¸Ð½Ñ 327 /*$(document).ready(function() { 328 $(".bask-bt a, .close-basket").click(function(e) { 329 $('.search-pop').fadeOut(); 330 $('.basket-pop').fadeToggle(); 331 e.stopPropagation(); 332 }); 333 334 $(document).click(function(e) { 335 if (!$(e.target).is('.basket-pop, .basket-pop *')) { 336 $(".basket-pop").hide(); 337 } 338 }); 339 });*/ 340// ÐÐ¾Ð½ÐµÑ Ðнопка коÑÐ·Ð¸Ð½Ñ 341 342// Ðнопка далее 343 $('.more-ab').click(function () { 344 $(this).fadeOut(0); 345 $('.about').addClass('open'); 346 }); 347// ÐÐ¾Ð½ÐµÑ ÐºÐ½Ð¾Ð¿ÐºÐ° далее 348 349// акаÑдеон ÑоваÑа 350 $(document.body).on('click', '.one-prod-info-tit', function (e) { 351 $(this).toggleClass('active'); 352 $(this).parent().find('.one-prod-info-descr').fadeToggle(); 353 }); 354// ÐÐÐ½ÐµÑ Ð°ÐºÐ°Ñдеон ÑоваÑа 355 356// ÐаÑÑÑÐµÐ»Ñ Ð¿Ð¾Ð¿ÑлÑÑнÑе в блоге 357 $(document).ready(function () { 358 $('.watch-slider-in').bxSlider({ 359 slideWidth: 258, 360 minSlides: 1, 361 maxSlides: 8, 362 slideMargin: 20, 363 pager: false 364 }); 365 }); 366// ÐÐ¾Ð½ÐµÑ ÐаÑÑÑÐµÐ»Ñ Ð¿Ð¾Ð¿ÑлÑÑнÑе в блоге 367 368// ÑÑлÑип Ð´Ð»Ñ ÑилÑÑÑа вкаÑалоге 369 $(function () { 370 $('[data-toggle="tooltip"]').tooltip({ 371 container: 'body' 372 }) 373 }) 374// ÐÐ¾Ð½ÐµÑ ÑÑлÑип Ð´Ð»Ñ ÑилÑÑÑа вкаÑалоге 375 376// ÐобавиÑÑ ÐºÐ¾Ð¼Ð¼ÐµÐ½Ñ 377 $(document.body).on('click', '.feed-bt a', function () { 378 $('.add-com').fadeToggle(); 379 }); 380// ÐÐ¾Ð½ÐµÑ Ð´Ð¾Ð±Ð°Ð²Ð¸ÑÑ ÐºÐ¾Ð¼Ð¼ÐµÐ½Ñ 381 382// ÐÑоÑмление заказ Ð´Ð»Ñ Ð¼Ð¾Ð± 383 $('.order-part.order-log .next-bt-order').click(function () { 384 if ($(window).width() > 767) { 385 $('.order-left').fadeOut(0); 386 $('.order-right').fadeIn(); 387 } else { 388 $('.order-part.order-log').fadeOut(0); 389 $('.order-part.order-pays').fadeIn(); 390 } 391 }); 392 393 $('.order-part.order-items .next-bt-order').click(function () { 394 $('.order-part.order-items').fadeOut(0); 395 $('.order-part.order-log').fadeIn(); 396 }); 397 398 $('.order-part.order-pays .next-bt-order').click(function () { 399 $('.order-part.order-pays').fadeOut(0); 400 $('.order-part.order-del').fadeIn(); 401 $('.bt-order').fadeIn(); 402 }); 403// ÐÐ¾Ð½ÐµÑ ÐÑоÑмление заказ Ð´Ð»Ñ Ð¼Ð¾Ð± 404 405// ÐиÑнÑй ÐºÐ°Ð±Ð¸Ð½ÐµÑ ÑекомендÑем 406 $(document).ready(function () { 407 $('.we-rec-in').bxSlider({ 408 slideWidth: 155, 409 minSlides: 1, 410 maxSlides: 4, 411 slideMargin: 25, 412 pager: false, 413 infiniteLoop: false 414 }); 415 }); 416 417 418// ÑилÑÑÑ 419// $('.multi-tit').click(function(e) { 420// $(this).parent().toggleClass("open"); 421// $(this).parent().find('ul').fadeToggle(); 422// e.stopPropagation(); 423// }); 424 (function () { 425 let getBoundingClientRect = {}; 426 $('body').find('.multi-tit').mouseenter(function (e) { 427 if ($('body').find('.filt-mobile .filt-color').length) { 428 getBoundingClientRect = $('body').find('.filt-mobile .filt-color').get(0).getBoundingClientRect(); 429 $(this).parent().addClass('open'); 430 } 431 }) 432 433 $('body').find('.filt-color, .multi-tit').mouseleave(function (e) { 434 try { 435 if (e.clientX <= getBoundingClientRect.left || e.clientX >= getBoundingClientRect.right) { 436 $('.filt-color').closest('.multi-sel').removeClass('open'); 437 } 438 if (e.clientY >= getBoundingClientRect.bottom || e.clientY <= getBoundingClientRect.top) { 439 $('.filt-color').closest('.multi-sel').removeClass('open'); 440 } 441 } catch (err) { 442 console.log(err); 443 } 444 445 }) 446 }()) 447 448 449 $(document).click(function (e) { 450 if (!$(e.target).is('.multi-sel, .multi-sel *')) { 451 $(".multi-sel ul").fadeOut(); 452 $(".multi-sel").removeClass('open') 453 } 454 }); 455 456 457// ÑикÑиÑованнÑй блок в каÑалоге 458 if ($(window).width() > 1250) { 459 if ($(".sidebar").length && !$(".banners_top").length) { 460 $('.sidebar').hcSticky({ 461 top: 70, 462 bottom: 300, 463 stickTo: '.main', 464 }); 465 } 466 if ($(".banners_top").length) { 467 $('.sidebar').hcSticky({ 468 top: 110, 469 bottom: 300, 470 stickTo: '.main' 471 }); 472 } 473 } 474 $(window).on('scroll', function () { 475 var margin; 476 if ($(window).scrollTop() > 170) { 477 // console.log($('header').height()); 478 // $('.sidebar').css({'position':'absolute', 'margin-top': $(window).scrollTop() - $('header').outerHeight(true) - $('.broad').outerHeight(true) - 50}); 479 } 480 }) 481 482 483 //ÑÐ¸ÐºÑ Ð¾ÑкÑÑÑÐ¸Ñ ÑилÑÑÑов в каÑалоге деÑкÑоп 484 if ($(window).width() >= 768) { 485 // $('#custom_filter_properties li span').on('click', function () { 486 // var filter_part_height = $(this).parent('li').find('ul'); 487 // var height = 0; 488 // var direction = ''; 489 // var interval = setInterval(function () { 490 // if(filter_part_height.height() > height && direction != 'stop'){ 491 // $('.catalog-wrap').height($('.catalog-wrap').height() + filter_part_height.height()); 492 // height = filter_part_height.height(); 493 // direction = 'down'; 494 // } else if(filter_part_height.height() < height && height < 20){//small valuew 495 // $('.catalog-wrap').height($('.catalog-wrap').height() - filter_part_height.height()); 496 // height = filter_part_height.height(); 497 // direction = 'up'; 498 // } else if(filter_part_height.height() < 1 || height == filter_part_height.height()) { 499 // direction = 'stop'; 500 // clearInterval(interval); 501 // } 502 // console.log('filterHeight',direction + ' ' +filter_part_height.height()); 503 // console.log('h',direction + ' ' +height); 504 // }, 100) 505 // }) 506 } 507 508 509 /*if ( $( ".cat-filter" ).length ) { 510 $('.cat-filter').hcSticky({ 511 top: 50, 512 stickTo: '.main', 513 }); 514 }*/ 515 516 517// ÑикÑиÑованнÑй блок лиÑного кабинеÑа 518 if ($(window).width() > 992) { 519 if ($(".lk-menu").length) { 520 $('.lk-menu').hcSticky({ 521 top: 120,//top: 80, 522 stickTo: '.lk-page' 523 }); 524 } 525 } 526 527}); 528 529// маÑка ÑелеÑона 530$(window).load(function () { 531 if ($('.phone').length != 0) { 532 $(".phone").inputmask({"mask": "+38 (999) 999 99 99"}); 533 } 534}); 535 536// СÑÑаниÑа магазинов 537$(window).load(function () { 538 539 $(function () { 540 var pane = $('.shop-list'); 541 if (pane.length > 0) { 542 pane.jScrollPane( 543 {
544 showArrows: false, 545 animateScroll: true, 546 autoReinitialise: true 547 } 548 ); 549 var api = pane.data('jsp'); 550 551 552 } 553 }); 554 555 556}); 557 558$('.shop-list li').click(function () { 559 $('.shop-list li').removeClass() 560 $('.shop-cont').fadeOut(0); 561 $(this).addClass('open'); 562 $(this).find('.shop-cont').fadeIn(300); 563}); 564 565// if($('.prod-car-big-in img').length > 0) { 566// $( ".prod-car-big-in img" ).each(function() { 567// $(this).xzoom({tint: 'transparent', Xoffset: 15}); 568// }); 569// } 570 571//не показÑваÑÑ alt пÑи нпведении 572$(document).ready(function () { 573 $('body').on('mouseover', 'img', function () { 574 var attr = $(this).attr('title'); 575 if (typeof attr !== typeof undefined && attr !== false) { 576 $(this).removeAttr('title'); 577 } 578 }) 579 $('body').on('mouseover', 'svg', function () { 580 $(this).find('title').remove(); 581 }); 582 //static loyality card here 583 (function () { 584 var i = 1; 585 $('body').on('click', '.loyality-card', function () { 586 i++; 587 $('body').find('.loyality-card .ver').hide(); 588 $('body').find('.loyality-card .v' + i).css('display', 'flex'); 589 if (i > 3) { 590 $('.loyality-card .card-block').hide(); 591 $('.left-card-part').hide(); 592 } else { 593 $('.loyality-card .card-block, .loyality-card .left-card-part').css('display', 'flex'); 594 } 595 if (i > 3) i = 1; 596 597 }) 598 }()); 599}) 600 601$('.modal').on('shown.bs.modal', function (e) { 602 // $('body, .modal').css('overflow','hidden'); 603}); 604$("#logo").click(function () { 605 if (window.pageYOffset > 10) { 606 if ($(window).width() <= '768') { 607 $('body,html').animate({scrollTop: 0}, 700); 608 } 609 } else { 610 window.location.reload(); 611 } 612}); 613$(document).ready(function () { 614 615 616 $('body').on('click', '.muted', function (e) { 617 e.preventDefault(); 618 var $this = $(this); 619 if ($this.next().prop('muted') === true) { 620 $this.next().prop('muted', false); 621 $this.html('<svg><use xlink:href="#svg-sound"></use></svg>'); 622 } else { 623 $this.next().prop('muted', true); 624 $this.html('<svg><use xlink:href="#svg-sound-mute"></use></svg>'); 625 } 626 }) 627}) 628 629function addFavorites() { 630 $('.btn-favorites').toggleClass('btn-favorites-solid') 631} 632 633function toggleSizes() { 634 $('.size-table-content').toggle('.toggle-sizes') 635} 636 637// ФÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð¿ÑовеÑки на налиÑие ÑазмеÑов ÑоваÑа в коÑзине 638 639$(document).ready(initFunction); 640 641function initFunction() { 642 const sizes = document.querySelectorAll('.size-label'); 643 const addToBasket = document.querySelectorAll('.prod-bay-link'); 644 645 async function checkSize(e) { 646 e.preventDefault(); 647 648 let offer = e.target.parentElement.getAttribute('data-offer'); 649 650 for (let btn of addToBasket) { 651 if (await window.store.dispatch('basket/checkOffer', offer)) { 652 btn.classList.add('circle'); 653 btn.classList.add('disabled'); 654 btn.classList.add('disactive'); 655 btn.innerText = window.store.state.basket.data.messages.productInBasket; 656 } else { 657 btn.classList.remove('circle'); 658 btn.classList.remove('disabled'); 659 btn.classList.remove('disactive'); 660 } 661 } 662 } 663 664 function checkSizeNotAvailable(e) { 665 e.preventDefault(); 666 for (let btn of addToBasket) { 667 btn.classList.add('circle'); 668 btn.classList.add('disabled'); 669 btn.classList.add('disactive'); 670 } 671 } 672
673 sizes.forEach(el => { 674 if (el.closest('.not-avaliable')) { 675 el.addEventListener('click', checkSizeNotAvailable); 676 } else { 677 el.addEventListener('click', checkSize); 678 } 679 }); 680 681 // sizes.forEach(el => { 682 // el.addEventListener('click', checkSize); 683 // }) 684} 685 686function setDataLayer(dataRes) { 687 if (dataRes) { 688 window.dataLayer = window.dataLayer || []; 689 dataLayer.push({'ecommerce': null}); 690 dataLayer.push(dataRes); 691 } 692 ; 693}; 694window.sendConversionFront = function (dataRes) { 695 if (dataRes) { 696 $.ajax({ 697 url: '/ajax/common.php', 698 data: { 699 handler: 'common', 700 func: 'sendConversionFront', 701 eventSourceUrl: window.location.origin + window.location.pathname, 702 res: dataRes 703 }, 704 method: 'POST', 705 success: function (response) { 706 // ÐбÑабоÑка ÑÑпеÑного оÑвеÑа Ð¾Ñ ÑеÑвеÑа 707 //console.log(response); 708 }, 709 error: function (xhr, status, error) { 710 // ÐбÑабоÑка оÑибки 711 //console.error(error); 712 } 713 }); 714 } 715} 716 717// попап вÑдео з Youtube 718function openVideoPopup(el) { 719 const videoUrl = el.getAttribute('data-ytb-src'); 720 if (!videoUrl) { 721 return false; 722 } 723 724 if (window.Fancybox) { 725 window.Fancybox.show([{ src: videoUrl}]); 726 727 return false; 728 } 729 const cssUrl = 'https://cdn.jsdelivr.net/npm/@fancyapps/[email protected]/dist/fancybox/fancybox.css'; 730 const jsUrl = 'https://cdn.jsdelivr.net/npm/@fancyapps/[email protected]/dist/fancybox/fancybox.umd.js'; 731 732 if (!document.querySelector(`link[href="${cssUrl}"]`)) { 733 const link = document.createElement('link'); 734 link.rel = 'stylesheet'; 735 link.href = cssUrl; 736 document.head.appendChild(link); 737 } 738 739 const script = document.createElement('script'); 740 script.src = jsUrl; 741 script.onload = () => { 742 if (window.Fancybox) { 743 window.Fancybox.show([{ src: videoUrl}]); 744 } else { 745 console.error('Fancybox не ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ.'); 746 } 747 }; 748 script.onerror = () => console.error('ÐÑибка загÑÑзки fancybox.umd.js'); 749 document.head.appendChild(script); 750 751 return false; 752} 753 754function logToServer(data) { 755 try { 756 fetch('/ajax/js-log.php', { 757 method: 'POST', 758 headers: { 'Content-Type': 'application/json' }, 759 body: JSON.stringify(data) 760 }).catch(function() { 761 762 }); 763 } catch (e) { 764 765 } 766} 767window.addEventListener('error', function(event) { 768 logToServer({ 769 type: 'js_error', 770 message: event.message, 771 source: event.filename, 772 line: event.lineno, 773 column: event.colno, 774 stack: event.error ? event.error.stack : null, 775 userAgent: navigator.userAgent, 776 url: window.location.href 777 }); 778}); 779 780window.addEventListener('unhandledrejection', function(event) { 781 const reason = event.reason; 782 let reasonData; 783 784 if (reason instanceof Error) { 785 reasonData = { 786 message: reason.message, 787 stack: reason.stack, 788 name: reason.name 789 }; 790 } else if (typeof reason === 'object' && reason !== null) { 791 reasonData = reason; 792 } else { 793 reasonData = { value: String(reason) }; 794 } 795 796 logToServer({ 797 type: 'unhandled_promise', 798 reason: JSON.stringify(reasonData), 799 userAgent: navigator.userAgent, 800 url: window.location.href 801 }); 802});
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.