1jQuery(function(){ 2 //Main init script 3 $('.section-link').click(function(){ 4 var ID=$(this).attr('data-id'); 5 get_catalog_card(ID); 6 }); 7}); 8 9function show_fancy_content(html_data) { 10 11 $("#footer_fancy_wrap").html(html_data); 12 $.fancybox( 13 "#footer_fancy_wrap", 14 { 15 padding: 0, 16 scrolling: 'visible', 17 helpers : { 18 title : { 19 type : 'outside' 20 } 21 } 22 } 23 ); 24} 25 26function get_catalog_card (ID) { 27 startLoadingAnimation(); 28 var cur_url=document.location.href; 29 $.post( 30 cur_url, 31 { 32 AJAX_FANCY_CALL: 'Y', 33 AJAX_CARD_ID: ID, 34 }, function( data ) { 35 show_fancy_content(data ); 36 section_init (); 37 stopLoadingAnimation() 38 } 39 ); 40} 41 42function section_init () { 43 $('.delete_basket').click(function(){ 44 var id_offer_data = $('#fancybox02').attr('data-offer_id'); 45 $('#offer_'+id_offer_data+' .go_basket2').hide(); 46 $('#offer_'+id_offer_data+' .action_basket_small').show(); 47 $.ajax({ 48 type: "POST", 49 url: "/basket/add_basket.php", 50 data: "delete="+id_offer_data, 51 success: function(data){ 52 $.fancybox.close(); 53 } 54 }); 55 }); 56 57 //Add basket 58 $('.add_basket').click(function(){ 59 var id_offer_data = $(this).attr('data-offer_id'); 60 // Check if all selects are filled in 61 allSelectsOk = true; 62 $('.item-wrapper#offer_'+id_offer_data+' .information select').each(function(){ 63 if ($(this).val() == '') 64 { 65 allSelectsOk = false; 66 if(!$(this).parent().hasClass('error')) $(this).parent().addClass('error'); 67 } 68 else 69 { 70 $(this).parent().removeClass('error'); 71 } 72 }); 73 if (!allSelectsOk) 74 { 75 if ($(this).parent().find('.error-message').length == 0) 76 { 77 $(this).before('<span class="error-message" style="text-align:right;">ÐожалÑйÑÑа, вÑбеÑиÑе вÑе паÑамеÑÑÑ</span>'); 78 } 79 return false; 80 } 81 if ($(this).parent().find('.error-message').length > 0) 82 { 83 $(this).parent().find('.error-message').remove(); 84 } 85 // End check 86 $(this).hide(); 87 $(this).next().show(); 88 89 var price = $(this).attr('data-offer_pice'); 90 var id_offer = $(this).parent().parent().attr('id'); 91 var src = $( '#'+id_offer+' .photo img' ).attr('src'); 92 var name_h2 = $( '#'+id_offer+' h2' ).text(); 93 var block_basket = $( '#'+id_offer+' .add_block_basket').html(); 94 var detail_url = $(this).prev().attr('href'); 95 96 $('#fancybox02 .image img').attr('src', src); 97 $('#fancybox02 .text-box a').text(name_h2); 98 $('#fancybox02 .price strong').text(price); 99 $('#fancybox02 .cost strong').text(price); 100 $('#fancybox02 .add_block_basket_in').html(block_basket); 101 $('#fancybox02 .text-box a').attr('href', detail_url); 102 $('#fancybox02').attr('data-offer_id', id_offer_data); 103 104 analyticsGoal('ADD_TO_CART',{}); 105 $.ajax({ 106 type: "POST", 107 url: "/basket/add_basket.php", 108 data: "id="+id_offer_data+"&name=Rehh", 109 success: function(data){ 110 $('#fancybox02 .amount-form .text').val(data); 111 calk(); 112 function calk(){ 113 var price = $('#fancybox02 .price strong').text(); 114 var count = parseInt($('#fancybox02 .amount-form .text').val(), 10); 115 var price2 = parseInt(price.replace(/\s+/g, ''), 10); 116 var cost = count*price2; 117 cost+=''; 118 $('#fancybox02 .cost strong').text(cost.replace(/(\d{1,3})(?=((\d{3})*([^\d]|$)))/g, " $1 ")); 119 } 120 } 121 }); 122 }); 123 124 125 126 127 $( ".select_prop select" ).change(function() { 128 //now selected 129 var id_offer = $( this ).parent().parent().parent().parent().attr('id'); 130 var ar_now_select = new Array(); 131 var this_val = $( this ).val(); 132 var label; 133 var label_block = false; 134 $( '#'+id_offer+' .select_prop select' ).each(function( index ) { 135 ar_now_select[index] = $( this ).val(); 136 }); 137 138 //true selected 139 var id_fancybox = $( this ).parent().parent().parent().parent().parent().attr('id'); 140 var ar_select_true_g = new Array(); 141 var id_offer_all; 142 var n; 143 //1-each 144 $( '#'+id_fancybox+' .offer' ).each(function( index1 ) { 145 id_offer_all = $( this ).attr('id'); 146 var ar_select_true = new Array(); 147 n = 0; 148 //2-each 149 $( '#'+id_offer_all+' .select_prop select option' ).each(function( index2 ){ 150 if( $( this ).attr('data-selected') == 'true' ){ 151 ar_select_true[n] = $( this ).val(); 152 n++; 153 } 154 }); 155 //label 156 label = true; 157 for(var i in ar_select_true) { 158 if(ar_now_select[i]!=ar_select_true[i]){ 159 label = false;
160 } 161 //console.log( ar_now_select[i] +'='+ ar_select_true[i]); 162 } 163 if(label == true){ 164 label_block = true; 165 $('#'+id_offer_all).css('display','block'); 166 } 167 else{$('#'+id_offer_all).css('display','none');} 168 }); 169 170 //if there is no trade 171 if(label_block == false){ 172 var stop = false; 173 $( '#'+id_fancybox+' .offer' ).each(function( index1 ){ 174 if(stop == false){ 175 id_offer_all = $( this ).attr('id'); 176 $( '#'+id_offer_all+' .select_prop select option' ).each(function( index2 ){ 177 if( $( this ).attr('data-selected') == 'true' && $( this ).attr('data-value') == this_val && stop == false){ 178 $( this ).parent().parent().parent().parent().parent().css('display','block'); 179 stop = true; 180 } 181 }); 182 } 183 }); 184 } 185 186 // attr -> selected 187 $( '#'+id_fancybox+' .offer' ).each(function( index1 ) { 188 id_offer_all = $( this ).attr('id'); 189 $( '#'+id_offer_all+' .select_prop select option' ).each(function( index2 ){ 190 if( $( this ).attr('data-selected') == 'true' ){ 191 $( this ).attr('selected','selected'); 192 } 193 }); 194 }); 195 196 }); 197 198 jcf.customForms.replaceAll(); 199 200} 201 202function startLoadingAnimation() { 203 var imgObj = $("#ajax-wait"); 204 imgObj.show(); 205 206 // вÑÑиÑлим в какие кооÑдинаÑÑ Ð½Ñжно помеÑÑиÑÑ Ð¸Ð·Ð¾Ð±Ñажение загÑÑзки, 207 // ÑÑÐ¾Ð±Ñ Ð¾Ð½Ð¾ оказалоÑÑ Ð² ÑеÑидине ÑÑÑаниÑÑ: 208 var centerY = $(window).scrollTop() + ($(window).height() + imgObj.height())/2; 209 var centerX = $(window).scrollLeft() + ($(window).width() + imgObj.width())/2; 210 211 // поменÑем кооÑдинаÑÑ Ð¸Ð·Ð¾Ð±ÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð½Ð° нÑжнÑе: 212 imgObj.offset({top:centerY, left:centerX}); 213} 214 215function stopLoadingAnimation() { 216 var imgObj = $("#ajax-wait"); 217 imgObj.hide(); 218} 219$(document).ready(function(){ 220 $('.drop-box2').hide(); 221 $('.drop-box').hide(); 222 $('.drop').hide(); 223 $('.expanded .drop').show(); 224 $('.expanded02 .drop-box').show(); 225 $('.category-box .category-list .t2.expanded .drop-box2').show(); 226 $('.category-box .category-list .t1.expanded .drop-box2').show(); 227 228 $('div.category-box>ul.category-list>li.expanded>div.drop ul>li a').each(function(e){ 229 if(location.pathname == $(this).attr('href')){ 230 $(this).addClass('activemenu'); 231 //Ð´Ð»Ñ Ð¿Ð¾Ð´Ñазделов 232 var elem_parent = $(this).parent(); 233 var child = elem_parent.find("div.drop-box:first"); 234 if(child.length > 0) 235 { 236 elem_parent.addClass("expanded02"); 237 child.css({display:'block'}); 238 } 239 } 240 }); 241 242 $(document).on('click','.product .buy',function(){ 243 analyticsGoal('ITEM_CLICK',{}); 244 }); 245 246 247 248// var COMPAREtimer; 249// $(window).resize(function(){ 250// clearTimeout(COMPAREtimer); 251// COMPAREtimer = setTimeout(function () { 252 253// // jcf.modules.customscroll.superclass.destroy(comapareid); 254 255// }, 1000); 256// }); 257 258}); 259 260// $(document).on('click', '.sorting.push_url .select-area', function(event){ 261// console.log('select') 262// }) 263$(document).on('click', '.minus2.action_basket_small', function(event){ 264 if ($(this).siblings('input').val() == '1') 265 { 266 location.href = $(this).parents('tr').find('.action_basket_small.delete a').attr('href'); 267 } 268}) 269$(document).on('change', '.js-all-sort', function(event){ 270 if ($(this).val() == 'all') 271 { 272 event.preventDefault(); 273 if ($('.all').length) 274 numPages = Math.ceil(parseInt($('.all').text().replace(/\D+/g,"")) / 45); 275 else 276 numPages = 1; 277 278 if ($('.nav_string').length) 279 $('.nav_string').remove(); 280 281 $('.js-items-list').html(''); 282 283 $('html, body').animate({ scrollTop: $('.js-items-list').offset().top - 100 }, 500); 284 285 page = 1; 286 loadItems(page, numPages); 287 } 288 // return false; 289}); 290 291function loadItems(page, numPages) { 292 var sorting_type = ''; 293 if( $('.list a').attr('class')=='active' ){ 294 sorting_type = '&SORTING_TYPE=1'; 295 } 296 else if ($('.table a').attr('class')=='active' ){ 297 sorting_type = '&SORTING_TYPE=2'; 298 } 299 $.ajax({ 300 url: location.pathname + '?AJAX_MODE=Y&SHOW_BY=45&PAGEN_1=' + page + sorting_type, 301 type: "GET", 302 dataType: "html", 303 success: function(data){ 304 console.log(page); 305 console.log(numPages); 306 if (page <= numPages) { 307 $('.js-items-list').append(data); 308 page++; 309 loadItems(page, numPages); 310 } 311 } 312 }) 313} 314 315/*$(document).ready(function(){ 316 $(window).scroll(function(){ 317 if ($('.js-catalog-pager .next_page_url').length) 318 { 319 var curTop=$(window).scrollTop()-200; 320 var curBtnTop=$('.pagination-wrapper').offset().top-window.innerHeight; 321 if (curTop>curBtnTop) 322 { 323 loadItemsNextPage(); 324 } 325 } 326 }); 327});*/ 328var catalogLoadedPages=[]; 329function loadItemsNextPage() { 330 if ($('.js-catalog-pager .next_page_url').length) 331 { 332 var curPage=$('.js-catalog-pager a.active').text(); 333 334 if ($.inArray(curPage,catalogLoadedPages)==-1) 335 { 336 catalogLoadedPages.push(curPage); 337 var url=$('.js-catalog-pager .next_page_url').val(); 338 if (url.indexOf("SHOW_BY")==-1) 339 { 340 var curShowBy=$('.js-all-sort').val(); 341 url+='&SHOW_BY='+curShowBy; 342 } 343 if (url.indexOf("AJAX_MODE")==-1) 344 { 345 url+='&AJAX_MODE=Y'; 346 } 347 if (url.indexOf("AJAX_MODE_CATALOG_PAGER")==-1) 348 { 349 url+='&AJAX_MODE_CATALOG_PAGER=Y'; 350 } 351 showWaitOverlay(); 352 $.ajax({ 353 url: url, 354 type: "GET", 355 dataType: "html", 356 success: function(data){ 357 $('.js-items-list').append(data); 358 $('.js-catalog-pager').html($('.js-catalog-pager-ajax').html()); 359 $('.js-catalog-pager-ajax').remove(); 360 closeWaitOverlay(); 361 } 362 }); 363 } 364 } 365} 366 367function compare_tov(id) { 368 var AddedGoodId = id; 369 $.get("/list_compare.php", 370 { 371 action: "ADD_TO_COMPARE_LIST", id: AddedGoodId}, 372 function(data) { 373 $("#compare_list_count").html(data); 374 } 375 ); 376 console.log(id); 377} 378 379$( document ).ready(function() { 380 381 var phone_place = $('input[name="form_text_9"]'); 382 phone_place.attr('id', 'pattern-callback-mask'); 383 384 $('#fancybox06 input[name="form_text_21"]').attr('id', 'pattern-callback-mask-2'); 385 386//Telephone mask
387 //$(document).ready(function($) { 388 // phone_place.mask('+7 (999) 999-99-99'); 389 phone_place.focus(function(){ 390 $(".phonetooltip").css("display", "block"); 391 }); 392 phone_place.blur(function(){ 393 $(".phonetooltip").css("display", "none"); 394 }); 395 //}); 396 397 398 var element = document.getElementById('pattern-callback-mask'); 399 var callbackMask = new IMask(element, { 400 mask: '+{7}(000)000-00-00', 401 lazy: false, // make placeholder always visible 402 placeholderChar: '_' // defaults to '_' 403 }); 404 405 var element = document.getElementById('pattern-callback-mask-2'); 406 var callbackMask = new IMask(element, { 407 mask: '+{7}(000)000-00-00', 408 lazy: false, // make placeholder always visible 409 placeholderChar: '_' // defaults to '_' 410 }); 411 412 if ($('form[name=SIMPLE_FORM_2] input[name=form_text_5]').length > 0) { 413 var guarMask_1_inp = $('form[name=SIMPLE_FORM_2] input[name=form_text_5]'); 414 //guarMask_1_inp.removeAttr('placeholder'); 415 var guarMask_1 = new IMask(guarMask_1_inp.get(0), { 416 mask: '+{7}(000)000-00-00', 417 lazy: false, 418 //placeholderChar: '_' 419 }); 420 } 421 422 $('.compare_repeat').click(function(){ 423 $(this).prev().show(500); 424 function compare_repeat() { 425 $('.compare_repeat').prev().hide(500); 426 } 427 setTimeout(compare_repeat, 2000); 428 }); 429 430 $('.compare').click(function(){ 431 432 433 434 var compare = $(this); 435 var id = $(this).attr('id'); 436 compare.prev().show(500, function(){ 437 $.post( "/ajax/get_compare_count.php", function( data ){ 438 $('.js-compare-count').html(data); 439 }); 440 }); 441 442 function func_compare() { 443 compare.prev().hide(500); 444 } 445 function func_compare2() { 446 $('.'+id).next().show(); 447 $('.'+id).hide(); 448 } 449 450 setTimeout(func_compare, 2000); 451 setTimeout(func_compare2, 2500); 452 453 }); 454 455 $(document).on('click', '.action_basket_small', function(){ 456 function func(){ 457 $.post( "/basket/ajax_basket.php", function( data ){ 458 $('#small_basket').html(data); 459 }); 460 $.post( "/basket/ajax_basket_sidebar.php", function( data ){ 461 $('.js-cart-sidebar-count').html(data); 462 }); 463 } 464 gtag('event', 'add_to_cart', { 'send_to': 'UA-162923751-1' }); 465 gtag('event', 'conversion', {'send_to': 'AW-431860945/CgI9CN-VlfwBENHZ9s0B'}); 466 setTimeout(func, 500); 467 }); 468 469 470 $('.closed').click(function(){ 471 $.fancybox.close(); 472 }); 473 474 //guaranteed price 475 $('.guaranteed_price').click(function(){ // ÑкоÑее вÑего не иÑполÑзÑеÑÑÑ, Ñ.к. веÑÑ ÐºÐ¾Ð´ заÑÐ¸Ñ Ð¿ÑÑмо в Ñаблон ÑоÑÐ¼Ñ 476 477 var ui_slider_handle_1 = $('#slider2 .ui-slider-range').next().css('left'); 478 var ui_slider_handle_2 = $('#slider2 .ui-slider-range').next().next().css('left'); 479 480 var time_1; 481 var time_2; 482 483 //time1 484 if( parseInt(ui_slider_handle_1,10)<18.9 ){ 485 time_1 = '09:00'; 486 }else if( parseInt(ui_slider_handle_1,10)>18.9&&parseInt(ui_slider_handle_1,10)<41.9 ){ 487 time_1 = '09:30'; 488 }else if( parseInt(ui_slider_handle_1,10)>41.9&&parseInt(ui_slider_handle_1,10)<68.9 ){ 489 time_1 = '10:00'; 490 }else if( parseInt(ui_slider_handle_1,10)>68.9&&parseInt(ui_slider_handle_1,10)<91.98 ){ 491 time_1 = '10:30'; 492 }else if( parseInt(ui_slider_handle_1,10)>91.98&&parseInt(ui_slider_handle_1,10)<119.984 ){ 493 time_1 = '11:00'; 494 }else if( parseInt(ui_slider_handle_1,10)>119.984&&parseInt(ui_slider_handle_1,10)<142.844 ){ 495 time_1 = '11:30'; 496 }else if( parseInt(ui_slider_handle_1,10)>142.844&&parseInt(ui_slider_handle_1,10)<168.813 ){ 497 time_1 = '12:00'; 498 }else if( parseInt(ui_slider_handle_1,10)>168.813&&parseInt(ui_slider_handle_1,10)<191.797 ){ 499 time_1 = '12:30'; 500 }else if( parseInt(ui_slider_handle_1,10)>191.797&&parseInt(ui_slider_handle_1,10)<219.78 ){ 501 time_1 = '13:00'; 502 }else if( parseInt(ui_slider_handle_1,10)>219.78&&parseInt(ui_slider_handle_1,10)<242.78 ){ 503 time_1 = '13:30'; 504 }else if( parseInt(ui_slider_handle_1,10)>242.78&&parseInt(ui_slider_handle_1,10)<270.78 ){ 505 time_1 = '14:00'; 506 }else if( parseInt(ui_slider_handle_1,10)>270.78&&parseInt(ui_slider_handle_1,10)<294.78 ){ 507 time_1 = '14:30'; 508 }else if( parseInt(ui_slider_handle_1,10)>294.78&&parseInt(ui_slider_handle_1,10)<320.78 ){ 509 time_1 = '15:00'; 510 }else if( parseInt(ui_slider_handle_1,10)>320.78&&parseInt(ui_slider_handle_1,10)<346.781 ){ 511 time_1 = '15:30'; 512 }else if( parseInt(ui_slider_handle_1,10)>346.781&&parseInt(ui_slider_handle_1,10)<371.76 ){ 513 time_1 = '16:00'; 514 }else if( parseInt(ui_slider_handle_1,10)>371.76&&parseInt(ui_slider_handle_1,10)<393.75 ){ 515 time_1 = '16:30'; 516 }else if( parseInt(ui_slider_handle_1,10)>393.75){ 517 time_1 = '17:00'; 518 } 519 520 //time2 521 if( parseInt(ui_slider_handle_2,10)<18.9 ){ 522 time_2 = '09:00'; 523 }else if( parseInt(ui_slider_handle_2,10)>18.9&&parseInt(ui_slider_handle_2,10)<41.9 ){ 524 time_2 = '09:30'; 525 }else if( parseInt(ui_slider_handle_2,10)>41.9&&parseInt(ui_slider_handle_2,10)<68.9 ){ 526 time_2 = '10:00'; 527 }else if( parseInt(ui_slider_handle_2,10)>68.9&&parseInt(ui_slider_handle_2,10)<91.98 ){ 528 time_2 = '10:30'; 529 }else if( parseInt(ui_slider_handle_2,10)>91.98&&parseInt(ui_slider_handle_2,10)<119.984 ){ 530 time_2 = '11:00'; 531 }else if( parseInt(ui_slider_handle_2,10)>119.984&&parseInt(ui_slider_handle_2,10)<142.844 ){ 532 time_2 = '11:30'; 533 }else if( parseInt(ui_slider_handle_2,10)>142.844&&parseInt(ui_slider_handle_2,10)<168.813 ){ 534 time_2 = '12:00'; 535 }else if( parseInt(ui_slider_handle_2,10)>168.813&&parseInt(ui_slider_handle_2,10)<191.797 ){ 536 time_2 = '12:30'; 537 }else if( parseInt(ui_slider_handle_2,10)>191.797&&parseInt(ui_slider_handle_2,10)<219.78 ){ 538 time_2 = '13:00'; 539 }else if( parseInt(ui_slider_handle_2,10)>219.78&&parseInt(ui_slider_handle_2,10)<242.78 ){ 540 time_2 = '13:30'; 541 }else if( parseInt(ui_slider_handle_2,10)>242.78&&parseInt(ui_slider_handle_2,10)<270.78 ){ 542 time_2 = '14:00'; 543 }else if( parseInt(ui_slider_handle_2,10)>270.78&&parseInt(ui_slider_handle_2,10)<294.78 ){ 544 time_2 = '14:30'; 545 }else if( parseInt(ui_slider_handle_2,10)>294.78&&parseInt(ui_slider_handle_2,10)<320.78 ){ 546 time_2 = '15:00'; 547 }else if( parseInt(ui_slider_handle_2,10)>320.78&&parseInt(ui_slider_handle_2,10)<346.781 ){ 548 time_2 = '15:30'; 549 }else if( parseInt(ui_slider_handle_2,10)>346.781&&parseInt(ui_slider_handle_2,10)<371.76 ){ 550 time_2 = '16:00'; 551 }else if( parseInt(ui_slider_handle_2,10)>371.76&&parseInt(ui_slider_handle_2,10)<393.75 ){ 552 time_2 = '16:30'; 553 }else if( parseInt(ui_slider_handle_2,10)>393.75){ 554 time_2 = '17:00'; 555 } 556 }); 557 558 $(document).on("submit", "#contactForm", function(e) { 559 e.preventDefault(); 560 561 $("#contactForm .contactFormError").remove(); 562 563 $.post("/contacts/contact_form.php", { 564 action: $("input[name='action']", this).val(), 565 CFormName: $("#CFormName", this).val(), 566 CFormMail: $("#CFormMail", this).val(), 567 CFormMess: $("#CFormMess", this).val(), 568 }, function(res) { 569 if(res.state == 'true') { 570 var replaceContent = ''; 571 572 replaceContent += "<div style='margin-top: 20px; background: #FDFDFD; text-align: center; height: 360px;'>"; 573 replaceContent += "<div style='font: 300 28px/28px \"Ubuntu\", sans-serif; color: #BDBDBD; padding-top: 150px;'>ÐаÑе ÑообÑение ÑÑпеÑно оÑпÑавлено!</div>"; 574 replaceContent += "</div>"; 575 576 $("#contactForm").replaceWith(replaceContent); 577 } 578 579 if(res.state == 'false') { 580 if(res.error.CFormName) { $("#contactForm label[for='CFormName']").append("<span class='contactFormError'>" + res.error.CFormName.text + "</span>"); } 581 if(res.error.CFormMail) { $("#contactForm label[for='CFormMail']").append("<span class='contactFormError'>" + res.error.CFormMail.text + "</span>"); } 582 if(res.error.CFormMess) { $("#contactForm label[for='CFormMess']").append("<span class='contactFormError'>" + res.error.CFormMess.text + "</span>"); } 583 584 if(res.error.other_error) { 585 $("#contactForm").replaceWith(res.error.other_error.text); 586 } 587 } 588 }, 'json').fail(function() { 589 // ÐбÑабоÑка оÑибок 590 }); 591 }); 592 593 $(document).on("submit", "#guarantForm", function(e) { 594 e.preventDefault(); 595 596 $("#guarantForm .guarantFormError").remove(); 597 598 $.post("/guarantee/guarant_form.php", { 599 action: $("input[name='action']", this).val(), 600 GFormName: $("#GFormName", this).val(), 601 GFormPhon: $("#GFormPhon", this).val(), 602 GFormMess: $("#GFormMess", this).val(), 603 }, function(res) { 604 if(res.state == 'true') { 605 var replaceContent = ''; 606 607 replaceContent += "<div style='text-align: center;'>"; 608 replaceContent += "<div style='font: 300 28px/28px \"Ubuntu\", sans-serif; color: #BDBDBD; padding-top: 170px;'>ÐаÑе запÑÐ¾Ñ ÑÑпеÑно оÑпÑавлен!</div>"; 609 replaceContent += "</div>"; 610 611 $("#guarantForm").replaceWith(replaceContent); 612 } 613 614 if(res.state == 'false') { 615 if(res.error.GFormName) { $("#guarantForm label[for='GFormName']").append("<span class='guarantFormError'>" + res.error.GFormName.text + "</span>"); } 616 if(res.error.GFormPhon) { $("#guarantForm label[for='GFormPhon']").append("<span class='guarantFormError'>" + res.error.GFormPhon.text + "</span>"); } 617 if(res.error.GFormMess) { $("#guarantForm label[for='GFormMess']").append("<span class='guarantFormError'>" + res.error.GFormMess.text + "</span>"); } 618 619 if(res.error.other_error) { 620 $("#guarantForm").replaceWith(res.error.other_error.text); 621 } 622 } 623 }, 'json').fail(function() { 624 // ÐбÑабоÑка оÑибок 625 }); 626 }); 627 628 $('.fancybox').fancybox({ 629 padding: 0, 630 scrolling: 'visible', 631 helpers : { 632 title : { 633 type : 'outside' 634 } 635 } 636 }); 637 638 var config = { 639 '.chosen-select' : {}, 640 '.chosen-select-deselect' : {allow_single_deselect:true}, 641 '.chosen-select-no-single' : {disable_search_threshold:10}, 642 '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'}, 643 '.chosen-select-width' : {width:"95%"} 644 } 645 for (var selector in config) { 646 $(selector).chosen(config[selector]); 647 } 648 649 650 651 // if ($('form[name=SIMPLE_FORM_6] input[name=form_text_31]').length > 0) { 652 // var guarMask_2_inp = $('form[name=SIMPLE_FORM_6] input[name=form_text_31]'); 653 // var guarMask_2 = new IMask(guarMask_2_inp.get(0), { 654 // mask: '+{7}(000)000-00-00', 655 // lazy: false, 656 // placeholderChar: '_' 657 // }); 658 // } 659 660 661 if (typeof basketItems !== "undefined") { 662 for(var i in basketItems) { 663 var $productBasketButtons = $('.add_basket[data-offer_id="' + basketItems[i] + '"], #compareid_' + basketItems[i]); 664 if($productBasketButtons.length) { 665 $productBasketButtons.siblings('.go_basket2').removeClass('go_basket2').addClass('go_basket1'); 666 $productBasketButtons.siblings('.in_comparison').addClass('in_comparison2'); 667 $productBasketButtons.siblings('.tovar_add_comp').hide(); 668 $productBasketButtons.hide(); 669 } 670 } 671 } 672 673 674/* ÐлаваÑÑее Ð¼ÐµÐ½Ñ Ð½Ð° Ð¼Ð¾Ð±Ð¸Ð»Ð°Ñ */ 675 676 var attachedTopHeader = $('#header-top'), 677 attachedTopHeaderContainer = $('#header-top-container'), 678 lastScrollTop = 0; 679 680 var scrollTimer; 681 682 $(window).on("scroll", function() { 683 684 if (window.innerWidth <= 1170) { 685 686 var winScrollTop = $(window).scrollTop(); 687 688 var offsetTop = attachedTopHeaderContainer.offset().top, 689 attachedTopHeaderHeight = attachedTopHeaderContainer.outerHeight(), 690 attachedTopHeaderPoint = attachedTopHeaderHeight + offsetTop; 691 692 if (winScrollTop >= attachedTopHeaderPoint) { 693 attachedTopHeader.addClass('_fixed'); 694 //$('body').addClass('_fixed'); 695 } 696 else { 697 attachedTopHeader.removeClass('_fixed'); 698 //$('body').removeClass('_fixed'); 699 } 700 701 clearTimeout(scrollTimer); 702 703 if (winScrollTop == 0){ 704 lastScrollTop = winScrollTop; 705 attachedTopHeader.removeClass('_showed').removeClass('_hidden'); 706 } 707 708 if (winScrollTop >= attachedTopHeaderPoint) { 709 710 // console.log('lastScrollTop = ', lastScrollTop); 711 // console.log('winScrollTop = ', winScrollTop); 712 713 scrollTimer = setTimeout(function () { 714 715 if (winScrollTop <= lastScrollTop){ 716 attachedTopHeader.addClass('_showed').removeClass('_hidden'); 717 $('body').addClass('_fixed'); 718 //console.log('top'); 719 } else { 720 //console.log('down'); 721 attachedTopHeader.removeClass('_showed').addClass('_hidden'); 722 $('body').removeClass('_fixed'); 723 } 724 725 lastScrollTop = winScrollTop; 726 727 728 }, 30); 729 } 730 731 } 732 733 }); 734 735// Responsible Table in Tabs
736 $('.information-tab .info-drop .text-box table, .serie-info .description table, .bx_order_list_table_order').wrap("<div class='responsible-table'></div>"); 737 738// GoodsSlider 739 function goodsSliderInit(){ 740 $('.js-goodsSliderMobile').slick({ 741 arrows:true, 742 dots: false, 743 draggable: true, 744 infinite: true, 745 speed: 300, 746 slidesToShow: 4, 747 centerMode: false, 748 variableWidth: false, 749 touchThreshold: 100, 750 responsive: [ 751 { 752 breakpoint: 767, 753 settings: { 754 slidesToShow: 3, 755 slidesToScroll: 1, 756 variableWidth: false, 757 } 758 }, 759 { 760 breakpoint: 600, 761 settings: { 762 slidesToShow: 2, 763 slidesToScroll: 1, 764 variableWidth: false, 765 } 766 }, 767 { 768 breakpoint: 480, 769 settings: { 770 slidesToShow: 1, 771 slidesToScroll: 1, 772 variableWidth: false, 773 } 774 } 775 ] 776 }); 777 }; 778 779 function goodsSliderDestroy(){ 780 if ($('.js-goodsSliderMobile').length != 0){ 781 $('.js-goodsSliderMobile').slick('unslick'); 782 } 783 }; 784 785 if (window.innerWidth <= 767) { 786 goodsSliderInit(); 787 }; 788 789 var GoodsSliderTimer; 790 $(window).resize(function(){ 791 clearTimeout(GoodsSliderTimer); 792 GoodsSliderTimer = setTimeout(function () { 793 794 if (window.innerWidth <=767){ 795 goodsSliderInit(); 796 } else{ 797 goodsSliderDestroy(); 798 } 799 800 }, 1000); 801 }); 802 803 804// Ð¡Ð»Ð°Ð¹Ð´ÐµÑ Ð² ÑÐ°Ð±Ð°Ñ Ð½Ð° главной 805 var swiper; 806 807 function swiperTabSliderINIT(){ 808 809 var MainTabSlider = $('.js-prods-in-tabs-3:visible').get(0); 810 811 return new Swiper(MainTabSlider, { 812 slidesPerColumn: 2, 813 slidesPerView: 5, 814 spaceBetween: 0, 815 loop: false, 816 scrollbar: { 817 el: '.swiper-scrollbar', 818 hide: false, 819 }, 820 navigation: { 821 nextEl: '.swiper-button-next', 822 prevEl: '.swiper-button-prev', 823 }, 824 breakpoints: { 825 850: { 826 slidesPerView: 'auto', 827 spaceBetween: 0, 828 }, 829 } 830 }); 831 832 } 833 834 swiper = swiperTabSliderINIT(); 835 836 $(document).on('click', '.new-main-tabs .js-tab-head', function(){ 837 838 var curItem = $(this); 839 var curIndex = curItem.closest('div').index(); 840 curItem.addClass('active'); 841 curItem.closest('div').siblings('div').find('.js-tab-head').removeClass('active'); 842 843 var otherTabs = curItem.closest('.js-tab').find('.js-tab-content'); 844 otherTabs.each(function(){ 845 $(this).removeClass('active'); 846 swiper.destroy(false, false); 847 $('.swiper-notification').remove(); 848 }) 849 850 var curTab = curItem.closest('.js-tab').find('.js-tab-content').eq(curIndex); 851 curTab.addClass('active'); 852 swiperTabSliderINIT(); 853 }) 854 855 var tabSwiperResize; 856 $(window).resize(function(){ 857 clearTimeout(sliderResize); 858 tabSwiperResize = setTimeout(function () { 859 //swiper.update(); 860 swiper.destroy(true, true); 861 swiper = swiperTabSliderINIT(); 862 }, 1000); 863 }); 864 865 $(document).on('click', '[data-fancyheader]', function(event) { 866 event.preventDefault(); 867 /* Act on the event */ 868 var href = $(this).data('href'); 869 $.fancybox( 870 { 871 'href' : href, 872 'padding': 0, 873 'scrolling': 'visible', 874 'helpers' : { 875 'title' : { 876 'type' : 'outside' 877 } 878 } 879 880 } 881 ); 882 }); 883 884 var viewedSlider; 885 886 function viewedSliderINIT(){ 887 //console.log('slider_init'); 888 return new Swiper('.js-prod-viewed', { 889 slidesPerView: 3, 890 spaceBetween: 0, 891 loop: false, 892 scrollbar: { 893 el: '.js-prod-viewed__scrollbar', 894 hide: false, 895 }, 896 navigation: { 897 nextEl: '.js-prod-viewed__next', 898 prevEl: '.js-prod-viewed__prev', 899 }, 900 breakpoints: { 901 850: { 902 slidesPerView: 'auto', 903 spaceBetween: 0, 904 }, 905 } 906 }); 907 } 908 909 viewedSlider = viewedSliderINIT(); 910 911 var sliderResize; 912 $(window).resize(function(){ 913 clearTimeout(sliderResize); 914 sliderResize = setTimeout(function () { 915 viewedSlider.destroy(true, true); 916 viewedSlider = viewedSliderINIT(); 917 }, 1000); 918 }); 919 920// СкÑÑваÑÑ Ð²ÐµÑÑ Ð½Ð¸Ð¹ Ð±Ð°Ð½Ð½ÐµÑ Ð¿Ñи закÑÑÑии 921 $('.delete_banner_up').on('click', function(event) { 922 $.cookie('top-banner-show', 'no', { 923 path: '/', // Ð´Ð»Ñ Ð²Ñего ÑайÑа 924 }); 925 }); 926 927// ТабÑ, авÑоÑизаÑÐ¸Ñ 928 $(document).on('click', '.js-tab-head', function(){ 929 var curItem = $(this), 930 curIndex = curItem.index(); 931 curItem.addClass('_active'); 932 curItem.siblings('.js-tab-head').removeClass('_active'); 933 curItem.closest('.js-tab').find('.js-tab-content').removeClass('_active').eq(curIndex).addClass('_active'); 934 }) 935 936 $(document).on('click', '.js-tab-recovery__link', function(){ 937 var curItem = $(this); 938 curItem.closest('.js-tab').find('.js-tab-head').removeClass('_active'); 939 curItem.closest('.js-tab').find('.js-tab-content').removeClass('_active'); 940 curItem.closest('.js-tab').find('.js-tab-recovery').addClass('_active'); 941 }) 942 943 $(document).on('click','.js-auth-link',function(){ 944 var curShower = $(this), 945 curURL = curShower.data('src'); 946 if (typeof curURL != "undefined" && curURL!="") 947 { 948 var timeoutLength=0; 949 if ($('.white-popup').length>0) 950 { 951 $.magnificPopup.close(); 952 timeoutLength=350; 953 } 954 if (curURL.indexOf('?')!=-1) 955 { 956 curURL=curURL+'&SITE_ID='+SITE_ID; 957 } else 958 { 959 curURL=curURL+'?SITE_ID='+SITE_ID; 960 } 961 window.setTimeout(function () { 962 $.magnificPopup.open({ 963 tClose: BX.message('POPUP_CLOSE'), 964 tLoading: BX.message('POPUP_LOADING'), 965 items: { 966 src: '/ajax/auth/'+curURL, 967 }, 968 type: 'ajax', 969 preloader: true, 970 modal: false, 971 removalDelay: 300, 972 mainClass: 'my-mfp-zoom-in', 973 closeOnBgClick:true, 974 callbacks: { 975 ajaxContentAdded: function() { 976 // if (IS_GADGET) 977 // { 978 // document.location.hash='popup'; 979 // observerCloseMagnificPopup(); 980 // } 981 $('.white-popup input[type="tel"]').inputmask("+7 (999) 999-99-99",{placeholder: "+7 (___) ___-__-__"}); 982 if (curShower.data('tab') == 'registration'){ 983 $('#js-auth-form-reg-tab').click(); 984 } 985 }, 986 open: function() { 987 // if (IS_GADGET) 988 // { 989 // $.magnificPopup.instance.close = function () { 990 // removeHashForPopups(); 991 // $.magnificPopup.proto.close.call(this); 992 // }; 993 // } 994 995 }, 996 } 997 }); 998 }, timeoutLength); 999 return false;
1000 } 1001 }); 1002 1003 $(document).on('submit', '#js-auth-form-login', function(){ 1004 console.log('auth login'); 1005 var curForm=$(this); 1006 var curSubmitBTN=curForm.find('button[type="submit"]'); 1007 //var curSubmitBTNtext=curSubmitBTN.html(); 1008 1009 //curSubmitBTN.html('<span>'+BX.message('BTN_STATUS_WAIT')+'</span>'); 1010 curSubmitBTN.prop('disabled',true); 1011 $.ajax 1012 ({ 1013 url: '/ajax/auth/login.php'+'?SITE_ID='+SITE_ID, 1014 data: $(this).serialize(), 1015 type: "POST", 1016 cache: false, 1017 dataType: 'json', 1018 success: function(res) 1019 { 1020 //curSubmitBTN.html(curSubmitBTNtext); 1021 curSubmitBTN.prop('disabled',false); 1022 if (res.success=="Y") 1023 { 1024 curForm.find('.js-auth-form-error').hide(); 1025 if (res.new_location!="") 1026 { 1027 location.href=res.new_location; 1028 } else 1029 { 1030 location.reload(); 1031 } 1032 } else 1033 { 1034 curForm.find('.js-auth-form-error').show().html(res.error); 1035 } 1036 }, 1037 error: function(xhr, ajaxOptions, thrownError){ 1038 alert(xhr.status+" "+thrownError); 1039 //curSubmitBTN.html(curSubmitBTNtext); 1040 curSubmitBTN.prop('disabled',false); 1041 } 1042 }); 1043 return false; 1044 }); 1045 1046 $(document).on('submit', '#js-auth-form-reg', function(){ 1047 var curForm=$(this); 1048 var curSubmitBTN=curForm.find('button[type="submit"]'); 1049 //var curSubmitBTNtext=curSubmitBTN.html(); 1050 //curSubmitBTN.html('<span>'+BX.message('BTN_STATUS_WAIT')+'</span>'); 1051 curSubmitBTN.prop('disabled',true); 1052 $.ajax 1053 ({ 1054 url: '/ajax/auth/reg.php'+'?SITE_ID='+SITE_ID, 1055 data: $(this).serialize(), 1056 type: "POST", 1057 cache: false, 1058 dataType: 'json', 1059 success: function(res) 1060 { 1061 //curSubmitBTN.html(curSubmitBTNtext); 1062 curSubmitBTN.prop('disabled',false); 1063 if (res.success=="Y") 1064 { 1065 //curForm.find('.js-auth-form-error').hide(); 1066 //curForm.find('.js-auth-form-success').show().html('ÐÑ ÑÑпеÑно заÑегиÑÑÑиÑовалиÑÑ!'); 1067 $(curForm).html('<div class="is-auth-form__success-registration">ÐÑ ÑÑпеÑно заÑегиÑÑÑиÑовалиÑÑ!</div>'); 1068 var regTimer; 1069 clearTimeout(regTimer); 1070 regTimer = setTimeout(function () { 1071 location.reload(); 1072 }, 2000); 1073 } else 1074 { 1075 curForm.find('.js-auth-form-success').hide(); 1076 var arrError = res.error.split('<br>'); 1077 var arrErrorModify = $.map(arrError, function(index,value) { 1078 if(index.indexOf('Ðогин') >= 0 || index.indexOf('логин') >= 0) { 1079 return null; 1080 } else { 1081 return index; 1082 } 1083 }); 1084 var newErrorStr = arrErrorModify.join('<br>'); 1085 curForm.find('.js-auth-form-error').show().html(newErrorStr); 1086 } 1087 }, 1088 error: function(xhr, ajaxOptions, thrownError){ 1089 alert(xhr.status+" "+thrownError); 1090 //curSubmitBTN.html(curSubmitBTNtext); 1091 curSubmitBTN.prop('disabled',false); 1092 } 1093 }); 1094 return false; 1095 }); 1096 1097 $(document).on('submit', '#js-auth-form-pass-recovery', function(){ 1098 var curForm=$(this); 1099 var curSubmitBTN=curForm.find('button[type="submit"]'); 1100 //var curSubmitBTNtext=curSubmitBTN.html(); 1101 1102 //curSubmitBTN.html('<span>'+BX.message('BTN_STATUS_WAIT')+'</span>'); 1103 curSubmitBTN.prop('disabled',true); 1104 $.ajax 1105 ({ 1106 url: '/ajax/auth/pass_recovery.php'+'?SITE_ID='+SITE_ID, 1107 data: $(this).serialize(), 1108 type: "POST", 1109 cache: false, 1110 dataType: 'json', 1111 success: function(res) 1112 { 1113 //curSubmitBTN.html(curSubmitBTNtext); 1114 curSubmitBTN.prop('disabled',false); 1115 if (res.success=="Y") 1116 { 1117 //curForm.find('.js-auth-form-body').hide(); 1118 curForm.find('.js-auth-form-error').hide(); 1119 curForm.find('.js-auth-form-success').show().html('ÐовÑй паÑÐ¾Ð»Ñ Ð²ÑÑлан на ваÑÑ ÑлекÑÑоннÑÑ Ð¿Ð¾ÑÑÑ!'); 1120 } else 1121 { 1122 curForm.find('.js-auth-form-success').hide(); 1123 curForm.find('.js-auth-form-error').show().html(res.error); 1124 } 1125 }, 1126 error: function(xhr, ajaxOptions, thrownError){ 1127 alert(xhr.status+" "+thrownError); 1128 // curSubmitBTN.html(curSubmitBTNtext); 1129 curSubmitBTN.prop('disabled',false); 1130 } 1131 }); 1132 return false;
1133 }); 1134 1135// Buy 1 click 1136 1137 $(document).on('click','.js-buy-1-click',function(e){ 1138 1139 analyticsGoal('BUY_BY_ONE_CLICK',{}); 1140 1141 e.preventDefault(); 1142 var curShower = $(this), 1143 prodID = curShower.data('id'); 1144 1145 $.ajax 1146 ({ 1147 url: '/ajax/buy1click.php?getform=yes&id='+prodID, // Ðожно даннÑе пеÑедаÑÑ Ð·Ð´ÐµÑÑ GET паÑамеÑÑом 1148 success: function(res) 1149 { 1150 $.magnificPopup.open({ 1151 items: { 1152 src: $('<div class="white-popup white-popup-block zoom-anim-dialog by-one-click-form">'+res+'</div>'), 1153 type: 'inline', 1154 }, 1155 removalDelay: 300, 1156 closeOnBgClick: true, 1157 callbacks: { 1158 open: function (){ 1159 $('.white-popup input[type="tel"]').inputmask("+7 (999) 999-99-99",{placeholder: "+7 (___) ___-__-__"}); 1160 var colors = []; 1161 $('.add_block_basket > dl > div').each(function () { 1162 colors.push($(this).find('.select-title').text()+'###'+$(this).find('dd').text()); 1163 }); 1164 $('.js-buy-1-click-offer-props').val(colors.join('####').replace(/"/i,'')); 1165 } 1166 } 1167 }); 1168 }, 1169 error: function(xhr, ajaxOptions, thrownError){ 1170 console.log(xhr); 1171 } 1172 }); 1173 1174 }); 1175 1176 // оÑпÑавлÑем даннÑе 1177 $(document).on('submit', '.js-buy-click-form', function(event) { 1178 1179 event.preventDefault(); 1180 /* Act on the event */ 1181 1182 var curForm = $(this), 1183 data = curForm.serialize(); 1184 1185 if (!curForm.hasClass('wait')) 1186 { 1187 showWaitOverlay(); 1188 $.ajax 1189 ({ 1190 url: '/ajax/buy1click.php', 1191 type: 'POST', 1192 data: data, 1193 dataType: 'json', 1194 success: function(res) 1195 { 1196 if (res.success=='Y') 1197 { 1198 analyticsGoal('ONE_CLICK_FORM_SUBMITTED',{order_price:res.price, currency: "RUB"}); 1199 $(curForm).html('<div class="is-auth-form__success-registration"><div><div class="is-auth-form__success-registration-title">СпаÑибо за заказ!</div><div class="is-auth-form__success-registration-desc">ÐÐ°Ñ Ð¼ÐµÐ½ÐµÐ´Ð¶ÐµÑ ÑвÑжеÑÑÑ Ñ Ð²Ð°Ð¼Ð¸ в ближайÑее вÑемÑ.</div></div></div>'); 1200 } else 1201 if (res.error!="") 1202 { 1203 alert(res.error); 1204 } else 1205 { 1206 alert('ÐÑибка ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ Ð·Ð°ÐºÐ°Ð·Ð°'); 1207 } 1208 closeWaitOverlay(); 1209 }, 1210 error: function(xhr, ajaxOptions, thrownError){ 1211 //console.log(xhr); 1212 console.log('error'); 1213 closeWaitOverlay(); 1214 } 1215 }); 1216 } 1217 }); 1218 1219 $(window).on("scroll", function() { 1220 if (window.innerWidth >= 1170) { 1221 if ($(window).scrollTop() > 50) { 1222 $('.js-go-to-top').removeClass('_hidden'); 1223 } 1224 else { 1225 $('.js-go-to-top').addClass('_hidden'); 1226 } 1227 } 1228 }); 1229 1230 $(document).on("click", ".js-go-to-top", function(event) { 1231 $('html,body').animate({ scrollTop: 0}, 500 ); 1232 }); 1233 1234 var fixedTopMenuWRP = $('.js-top-fixed-menu'), 1235 fixedTopMenu = fixedTopMenuWRP.find('.js-top-fixed-menu__inner'); 1236 if (fixedTopMenu.length != 0) { 1237 $(window).on("scroll", function() { 1238 if (window.innerWidth >= 1170) { 1239 if ($(window).scrollTop() > fixedTopMenuWRP.offset().top) { 1240 fixedTopMenu.addClass('_fixed'); 1241 $('body').addClass('_fixed'); 1242 } 1243 else { 1244 fixedTopMenu.removeClass('_fixed'); 1245 $('body').removeClass('_fixed'); 1246 } 1247 } 1248 }); 1249 } 1250 1251 // Add to favorite 1252 1253 $(document).on('click', '.js-add-to-fav', function(event) { 1254 event.preventDefault(); 1255 1256 var curElement = $(this), 1257 curElementID = curElement.data('id'), 1258 favorites = []; 1259 1260 if (curElement.hasClass('in-fav')){ // еÑли Ñже в добавленнÑÑ 1261 curElement.removeClass('in-fav'); 1262 favorites = JSON.parse($.cookie('favorites')); 1263 newArrFav = favorites.filter(function(id) { 1264 return id != curElementID; 1265 }); 1266 $.cookie('favorites', JSON.stringify(newArrFav), { 1267 expires: 3650, 1268 path: '/', 1269 }); 1270 $('.js-fav-header-count').html(newArrFav.length); // колиÑеÑÑво в Ñапке 1271 if (curElement.data('curpage') == 'favorite'){ 1272 curElement.closest('.js-prod-col').remove(); 1273 $('.js-favs-title-count').html(newArrFav.length); 1274 } 1275 } else { 1276 curElement.addClass('in-fav'); 1277 if ($.cookie('favorites')){ 1278 favorites = JSON.parse($.cookie('favorites')); 1279 favorites.push(curElementID); 1280 $.cookie('favorites', JSON.stringify(favorites), { 1281 expires: 3650, 1282 path: '/', 1283 }); 1284 } else { 1285 favorites.push(curElementID); 1286 $.cookie('favorites', JSON.stringify(favorites), { 1287 expires: 3650, 1288 path: '/', 1289 }); 1290 } 1291 $('.js-fav-header-count').html(favorites.length); // колиÑеÑÑво в Ñапке 1292 } 1293 1294 }); 1295 1296// ÐозиÑиониÑование ÑÑÐ±Ð¼ÐµÐ½Ñ 1297 1298 1299 $(document).on('mouseenter', '.category-list .level-2.alone_level2:not(.expanded02)', function(event) { 1300 if (window.innerWidth > 1170) { 1301 event.preventDefault(); 1302 /* Act on the event */ 1303 var curMenuItem = $(this), 1304 subMenu = curMenuItem.find('.drop-box').eq(0); 1305 if (subMenu.length > 0) { 1306 var windowHeight = window.innerHeight, 1307 subMenuTop = curMenuItem.offset().top - $(window).scrollTop(), 1308 subMenuHeight = subMenu.outerHeight(), 1309 subMenuBottomPos = subMenuTop + subMenuHeight; 1310 curMenuItem.addClass('_hovered'); 1311 if (subMenuBottomPos > windowHeight) { 1312 subMenu.css('margin-top', windowHeight - subMenuBottomPos); 1313 } else { 1314 subMenu.css('margin-top', 0); 1315 } 1316 } 1317 } 1318 }); 1319 1320 $(document).on('mouseleave', '.category-list .level-2.alone_level2', function(event) { 1321 if (window.innerWidth > 1170) { 1322 event.preventDefault(); 1323 /* Act on the event */ 1324 var curMenuItem = $(this), 1325 subMenu = curMenuItem.find('.drop-box').eq(0); 1326 if (subMenu.length > 0) { 1327 curMenuItem.removeClass('_hovered'); 1328 } 1329 } 1330 }); 1331 1332// СообÑение о cookies 1333 /*$(document).on('click', '.js-cookies-notation__closer', function(event) { 1334 $(this).closest('.js-cookies-notation').animate({'opacity' : '0'}, 500, function(){ 1335 $.cookie('cookie_notate', 'yes', { 1336 expires: 100, 1337 path: '/', 1338 }); 1339 }) 1340 });*/ 1341 1342const container = document.querySelector(".warning"); 1343 1344 if (container) { 1345 // ÐÑли кÑки ÐÐТ (новÑй полÑзоваÑелÑ) â показÑваем плаÑÐºÑ 1346 if (document.cookie.indexOf("warning") === -1) { 1347 container.classList.add("warning--active"); 1348 } 1349 1350 const apply = container.querySelector(".warning__apply"); 1351 apply.addEventListener("click", () => { 1352 container.classList.remove("warning--active"); 1353 document.cookie = "warning=true; max-age=2592000; path=/"; 1354 }); 1355 } 1356 1357// seo tags 1358 $(document).on('click', '.js-sotbit-tags__toggler', function(event) { 1359 $(this).closest('.js-sotbit-tags').find('.js-sotbit-tags__item').removeClass('_hidden'); 1360 $(this).hide(); 1361 }); 1362 1363// Tooltipster 1364 $(document).on('click', '.js-is-open-tab-scroll', function(event) { 1365 event.preventDefault(); 1366 var targetID = $(this).data('target'), 1367 target = $('.information-tab .information-list a[href="#'+targetID+'"]'); 1368 1369 target.click(); 1370 $('html,body').animate({ scrollTop: $(target).offset().top-80}, 500 ); 1371 }); 1372 1373// New select styler 1374 1375 1376 1377 (function(){ 1378 1379 $(document).on('change','.js-select-styler',function(){ 1380 1381 var iOS = (navigator.userAgent.match(/(iPad|iPhone|iPod)/i) && !navigator.userAgent.match(/(Windows\sPhone)/i)) ? true : false;
1382 if (iOS) 1383 prodSelectChange($(this)); 1384 }); 1385 1386 function prodSelectStylerInit(first){ 1387 $('.js-select-styler').styler({ 1388 onSelectClosed: function(){ 1389 var curSelect = $(this).find('select').get(0); 1390 prodSelectChange(curSelect); 1391 }, 1392 onFormStyled: function(){ 1393 if (first == true){ 1394 $('#SKU_SELECTOR').find('select').last().trigger('change'); 1395 prodSelectChange($('#SKU_SELECTOR').find('select').get(0)); 1396 } 1397 } 1398 }); 1399 } 1400 1401 function prodSelectChange(curSelect){ 1402 1403 if (curSelect.length>1) 1404 { 1405 curSelect=$(curSelect); 1406 } 1407 1408 var val = curSelect.val(); 1409 var prop = curSelect.attr('name'); 1410 1411 if (typeof prop != "undefined") 1412 { 1413 1414 var len = prop.length; 1415 prop = prop.substr(11, len - 12); 1416 1417 $('#slider_0 .slides li').each(function (index, element) { 1418 if ($(this).data('descr') === prop + ' ' + val) { 1419 $('#slider_0').flexslider(index); 1420 } 1421 }); 1422 1423 $('.information .preloader').show(); 1424 var ajaxData = $('#SKU_SELECTOR').serializeArray(); 1425 ajaxData.push({ 1426 name: 'SKU_SELECTOR_AJAX', 1427 value: 'Y' 1428 }); 1429 $.ajax({ 1430 data: ajaxData, 1431 timeout: 10000, 1432 success: function (res) { 1433 $('.information-wrap').html(res); 1434 jcf.customForms.replaceAll(); 1435 var form = $('form#SKU_SELECTOR').serializeArray(); 1436 var validate = form.every(function (item) { 1437 return item.value ? true : false; 1438 }); 1439 1440 if (validate) { 1441 $('.add_basket2').addClass('fancybox'); 1442 } else { 1443 $('.add_basket2').removeClass('fancybox'); 1444 } 1445 1446 $('.tooltipstered').tooltipster({ 1447 animation: 'fade', 1448 trigger: 'custom', 1449 triggerOpen: { 1450 click: true, 1451 mouseenter: true, 1452 touchstart: true 1453 }, 1454 triggerClose: { 1455 mouseleave: true, 1456 scroll: true 1457 }, 1458 distance: 3, 1459 contentAsHTML: true, 1460 interactive: true, 1461 side: 'right', 1462 theme: 'tooltipster-light' 1463 }); 1464 1465 }, 1466 complete: function () { 1467 $('.information .preloader').hide(); 1468 prodSelectStylerInit(); 1469 } 1470 }); 1471 } 1472 } 1473 1474 prodSelectStylerInit(true); 1475 1476 })(); 1477 1478 1479 $(document).on('change','.var -filter',function(){ 1480 var iOS = (navigator.userAgent.match(/(iPad|iPhone|iPod)/i) && !navigator.userAgent.match(/(Windows\sPhone)/i)) ? true : false; 1481 if (iOS) 1482 filterSelectChange($(this)); 1483 }); 1484 1485 function filterSelectChange(select){ 1486 if (!smartFilter.loading) 1487 $('#'+select.val()).click(); 1488 } 1489 1490 $('.var -filter').styler({ 1491 onSelectClosed: function(){ 1492 var curSelect=$(this).find('select'); 1493 filterSelectChange(curSelect); 1494 } 1495 }); 1496 1497// Collection slider 1498 (function(){ 1499 var collectionGalleryThumbs = new Swiper('.js-is-detail-collection-slider-tumbs', { 1500 spaceBetween: 10, 1501 slidesPerView: 4, 1502 freeMode: true, 1503 watchSlidesVisibility: true, 1504 watchSlidesProgress: true, 1505 breakpoints: { 1506 700: { 1507 slidesPerView: 'auto', 1508 slidesPerView: 3, 1509 }, 1510 500: { 1511 slidesPerView: 'auto', 1512 slidesPerView: 2, 1513 }, 1514 } 1515 }); 1516 var collectionGalleryElem = $('.js-is-detail-collection-slider'), 1517 btnPrev = collectionGalleryElem.find('.js-is-detail-collection-slider__prevBtn').get(0), 1518 btnNext = collectionGalleryElem.find('.js-is-detail-collection-slider__nextBtn').get(0),
1519 collectionGallery = new Swiper('.js-is-detail-collection-slider', { 1520 slidesPerView: 1, 1521 loop: true, 1522 navigation: { 1523 nextEl: btnNext, 1524 prevEl: btnPrev, 1525 }, 1526 thumbs: { 1527 swiper: collectionGalleryThumbs 1528 } 1529 }); 1530 })(); 1531 1532}); 1533 1534function showWaitOverlay(spinnerId) 1535{ 1536 if (!spinnerId) spinnerId='js-spinner-common'; 1537 $('#'+spinnerId).addClass('ui-spinner--state_opened'); 1538} 1539function closeWaitOverlay(spinnerId) 1540{ 1541 if (!spinnerId) spinnerId='js-spinner-common'; 1542 $('#'+spinnerId).removeClass('ui-spinner--state_opened'); 1543} 1544 1545 1546var curFormObj=false; 1547var codeFormCanBeSubmitted=false; 1548function getRecaptchaToken(token) { 1549 if (curFormObj.find('.token').length) 1550 { 1551 curFormObj.find('.token').val(token); 1552 } else 1553 { 1554 curFormObj.append('<input type="hidden" name="grtoken" value="'+token+'" />'); 1555 curFormObj.append('<input type="hidden" name="web_form_submit" value="Y" />'); 1556 } 1557 1558 formSubmit(false); 1559} 1560function formSubmit(mode) { 1561 if (mode) 1562 { 1563 grecaptcha.reset(); 1564 grecaptcha.execute(); 1565 } else 1566 { 1567 var formCode=curFormObj.attr('name'); 1568 switch (formCode) 1569 { 1570 case "SIMPLE_FORM_1": 1571 case "SIMPLE_FORM_2": 1572 case "SIMPLE_FORM_3": 1573 case "SIMPLE_FORM_4": 1574 case "SIMPLE_FORM_5": 1575 case "SIMPLE_FORM_6": 1576 codeFormCanBeSubmitted=formCode; 1577 curFormObj.submit(); 1578 break; 1579 default: 1580 curFormObj=false; 1581 break; 1582 } 1583 1584 } 1585 return false; 1586} 1587$(document).on( 1588 'submit', 1589 'form[name="SIMPLE_FORM_1"],form[name="SIMPLE_FORM_2"],form[name="SIMPLE_FORM_3"],form[name="SIMPLE_FORM_4"],form[name="SIMPLE_FORM_5"],form[name="SIMPLE_FORM_6"]', 1590 function() 1591 { 1592 curFormObj=$(this); 1593 var formCode=curFormObj.attr('name'); 1594 if (formCode!=codeFormCanBeSubmitted) 1595 { 1596 formSubmit(false); 1597 return false; 1598 } else 1599 { 1600 codeFormCanBeSubmitted=false; 1601 } 1602 } 1603); 1604 1605document.addEventListener('DOMContentLoaded', function(){ 1606 $('.item-wrapper.item-wrapper2.offer2').css('opacity', 1); 1607 1608 var testDeviceContainer = $('#deviceTest'); 1609 testDeviceContainer.text(navigator.userAgent); 1610 1611}); 1612 1613 1614document.addEventListener('lt-1760014466558', () => { 1615 ym(53779276,'reachGoal','telegram'); 1616 window.location.href = 'https://t.me/i_sosna_ru'; 1617}); 1618 1619document.addEventListener('lt-1760014511932', () => { 1620 ym(53779276,'reachGoal','whatsapp'); 1621 window.location.href = 'https://api.whatsapp.com/send/?phone=79268130542'; 1622});
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.