1shop2.queue.addToCart = function() { 2 3 $(document).on('click', '.shop_product_button:not(.preorder-btn-js)', function(e) { 4 5 var $this = $(this), 6 $form = $this.closest('form'), 7 form = $form.get(0), 8 adds = $form.find('.additional-cart-params'), 9 len = adds.length, 10 i, el, 11 a4 = form.amount.value, 12 kind_id = form.kind_id.value; 13 14 e.preventDefault(); 15 16 if (len) { 17 a4 = { 18 amount: a4 19 }; 20 21 for (i = 0; i < len; i += 1) { 22 el = adds[i]; 23 if (el.value) { 24 a4[el.name] = el.value; 25 } 26 } 27 } 28 29 shop2.cart.add(kind_id, a4, function(d) { 30 31 $('#shop2-cart-preview').replaceWith(d.data); 32 33 if(shop2.my.gr_fast_cart_product){ 34 35 var totalCartAmount = +$(d.data).find('.gr-cart-total-amount').text(); 36 37 var $totalCartSum = $(d.data).find('.gr-cart-total-sum').html().replace(/[^\d]/g, ''); 38 39 if (totalCartAmount>0) { 40 $('.gr-cart-popup-btn').removeClass('pointer_events_none'); 41 $('.gr-cart-total-amount').text(totalCartAmount); 42 43 $('.cart_sum_fast').text($totalCartSum); 44 } else{ 45 $('.gr-cart-popup-btn').addClass('pointer_events_none'); 46 $('.gr-cart-total-amount').text('0'); 47 48 $('.cart_sum_fast').text('0'); 49 }; 50 } 51 52 if (d.errstr) { 53 shop2.msg(d.errstr, $this); 54 $('#shop2-cart-preview').addClass('class_name'); 55 setTimeout(function() { 56 $('#shop2-cart-preview').removeClass('class_name'); 57 }, 1500); 58 } else { 59 var $text = window._s3Lang.JS_SHOP2_ADD_CART_WITH_LINK; 60 // window._s3Lang.JS_ADDED - Ðобавлено 61 shop2.msg($text.replace('%s', shop2.uri + '/cart'), $this); 62 } 63 64 if (d.panel) { 65 $('#shop2-panel').replaceWith(d.panel); 66 } 67 }); 68 69 }); 70}, 71shop2.filter.sort = function(name, elem) { 72 var re = new RegExp(this.escape('s[sort_by]') + '=([^&]*)'), 73 params = this.str.match(re), 74 desc = name + ' desc', 75 asc = name + ' asc', 76 isDesc = (elem.is('.sort-param-desc')); 77 78 79 params = (params && params.length > 1) ? params[1] : ''; 80 81 params = (isDesc) ? desc : asc; 82 83 this.remove('s[sort_by]'); 84 this.add('s[sort_by]', params); 85 return this; 86}, 87shop2.queue.sort = function() { 88 var wrap = $('.sorting'); 89 90 wrap.find('.sort-param').on('click', function(e) { 91 var $this = $(this), 92 name = $this.data('name'); 93 94 e.preventDefault(); 95 shop2.filter.sort(name, $this); 96 shop2.filter.go(); 97 }); 98 99 wrap.find('.sort-reset').on('click', function(e) { 100 e.preventDefault(); 101 shop2.filter.remove('s[sort_by]'); 102 shop2.filter.go(); 103 }); 104}, 105shop2.queue.cart = function() { 106 107 var updateBtn = $('.shop2-cart-update'), 108 cartTable = $('.shop_cart_wrapper'), 109 form = $('#shop2-cart'); 110 111 shop2.on('afterCartRemoveItem, afterCartUpdate', function() { 112 document.location.reload(); 113 }); 114 115 function updateBtnShow() { 116 updateBtn.show(); 117 } 118 119 cartTable.find('.shop_cart_product input:text').on('keypress', function(e) { 120 if (e.keyCode == 13) { 121 shop2.cart.update(form); 122 } else { 123 updateBtnShow(); 124 } 125 }); 126 127 $(document).on('click', 'li.param-value:not(.shop2-color-ext-selected)', function() { 128 updateBtnShow(); 129 }); 130 131 $(document).on('change', 'select.param-value', function() { 132 updateBtnShow(); 133 }); 134 135 cartTable.find('.amount-minus, .amount-plus').on('click', updateBtnShow); 136 137 updateBtn.on('click', function(e) { 138 e.preventDefault(); 139 shop2.cart.update(form); 140 return false; 141 }); 142 143 144 $('.cart-delete a').on('click', function(e) { 145 var $this = $(this), 146 id = $this.data('id'); 147 148 e.preventDefault(); 149 150 shop2.cart.remove(id); 151 152 }); 153 154}, 155shop2.queue.question = function() { 156 var cls = '.price-old.question, .shop2-cart-total .question'; 157 158 $(document).on('mouseenter click', cls, function() { 159 var $this = $(this), 160 win = $this.next().show(), 161 position = $this.position(), 162 height = win.outerHeight(true); 163 164 win.css({ 165 top: position.top - height - 5, 166 left: position.left 167 }); 168 169 }).on('mouseleave', cls, function() { 170 171 var $this = $(this), 172 win = $this.next(); 173 174 win.hide(); 175 176 return win; 177 }); 178 179 $(document).on('click touchstart', function(event){ 180 if( $(event.target).closest('.price-old.question, .shop2-cart-total .question').length) 181 return; 182 $('.shop2-product-discount-desc').hide(); 183 }); 184 185}, 186shop2.queue.product = function() { 187 188 shop2.product._reload = function(node) { 189 190 var $node = $(node); 191 var kinds = shop2.product.getNodeData(node, 'kinds', true); 192 var paramName = shop2.product.getNodeData(node, 'name'); 193 var paramValue = shop2.product.getNodeData(node, 'value'); 194 var $form = $node.closest('form'); 195 var form = $form.get(0); 196 var meta; 197 var kind_id; 198 var product_id; 199 var keys = {}; 200 201 if (kinds && $.type(paramName) !== 'undefined' && $.type(paramValue) !== 'undefined' && form) { 202 203 meta = $form.find('input[name=meta]').val(); 204 205 product_id = $form.find('input[name=product_id]').val(); 206 207 $form.find('[name=submit]').prop('disabled', true); 208 209 $form.find('select.shop2-cf>option, li.shop2-cf, li.shop2-color-ext-selected, ul.shop2-color-ext-list>li').each(function() { 210 var name = $(this).data('name'); 211 if (name) { 212 keys[name] = true; 213 } 214 }); 215
216 kind_id = shop2.product.findKindId(product_id, kinds, paramName, paramValue, meta, keys); 217 218 if (shop2.mode == 'product') { 219 220 if (shop2.uri) { 221 document.location = shop2.uri + '/product/' + kind_id; 222 } else { 223 document.location = document.location.href.replace(/\/product\/.+/, '/product/' + kind_id); 224 } 225 226 } else { 227 228 shop2.product.getProductListItem(product_id, kind_id, function(d, status) { 229 var cont, newCont, body; 230 if (status === 'success') { 231 232 cont = $node.closest('.shop2-product-item'); 233 cont.hide(); 234 235 body = $.trim(d.data.body); 236 newCont = $(body).insertBefore(cont); 237 238 cont.remove(); 239 240 shop2.queue.heights(); 241 242 $('.product-list .shop2_product_item select').styler(); 243 244 $('.shop_cart_product, .shop2-product-item, .shop2-product').each(function(index) { 245 var $this = $(this), 246 $amountInput = $this.find('.shop2-product-amount input[type="text"]'), 247 amountInputValue = $amountInput.val(), 248 amountMax = $this.find('.shop2-product-amount input[type="text"]').attr('data-max'), 249 amountMin = $this.find('.shop2-product-amount input[type="text"]').data('min'), 250 amountMaxNum = +amountMax, 251 amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(), 252 amountInputNum = +amountInput2; 253 254 $this.find('.shop2-product-amount input').on('change', function(e) { 255 amInputVal = +$(this).val(); 256 amNumber = 1; 257 258 if (amInputVal <= amountMin) { 259 $(this).val(amountMin); 260 } 261 }); 262 263 function amounMinus() { 264 if (amountInputValue >= amountMin) { 265 $this.find('.shop2-product-amount button.amount-minus').removeAttr('disabled'); 266 } else { 267 $this.find('.shop2-product-amount button.amount-minus').attr('disabled', 'disabled'); 268 } 269 } 270 amounMinus(); 271 272 if (amountInputNum >= amountMaxNum) { 273 $this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled'); 274 } else { 275 $this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled'); 276 } 277 278 $this.find('.shop2-product-amount button').on('click', function(e) { 279 setTimeout(function() { 280 amountInputValue = $amountInput.val(); 281 282 amounMinus(); 283 }, 100); 284 setTimeout(function() { 285 var amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(), 286 amountInputNum = +amountInput2; 287 if (amountInputNum == amountMaxNum) { 288 $this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled'); 289 } else { 290 $this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled'); 291 } 292 }, 100); 293 }); 294 $this.find('.shop2-product-amount input').on('keyup', function(e) { 295 setTimeout(function() { 296 amountInputValue = $amountInput.val(); 297 298 amounMinus(); 299 300 var amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(), 301 amountInputNum = +amountInput2; 302 303 if (amountInputNum >= amountMaxNum) { 304 $this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled'); 305 } else { 306 $this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled'); 307 } 308 }, 100); 309 }); 310 }); 311 if (shop2.my.gr_img_lazyload) { 312 try{ 313 var myLazyLoad = new LazyLoad(); 314 myLazyLoad.update(); 315 } catch (e) { 316 console.log(e); 317 } 318 } 319 } 320 321 }); 322 323 } 324 } 325 326 }; 327 328 $.on('select.shop2-cf', { 329 change: function() { 330 shop2.product._reload(this); 331 } 332 }); 333 334 $.on('li.shop2-cf:not(.active-color, .active-texture)', { 335 click: function() { 336 shop2.product._reload(this); 337 } 338 }); 339 340}, 341 342shop2.queue.colorPopup = function() { 343 344 345 $(document).on('click', '.shop2-color-ext-list li', function() { 346 var caption = $(this); 347 var wrap = caption.closest('.shop2-color-ext-popup'); 348 var ul = wrap.find('.shop2-color-ext-list'); 349 var offset = caption.offset(); 350 var $this = $(this); 351 var data = $this.data(); 352 var input = $this.parent().find('input.additional-cart-params'); 353 var isSelected = $this.is('.shop2-color-ext-selected'); 354 355 colors = ul.children('li'); 356 357 if (typeof data.kinds !== 'undefined' || input.length) { 358 $this.addClass('shop2-color-ext-selected').siblings().removeClass('shop2-color-ext-selected'); 359 360 if (input.length) { 361 input.val(data.value); 362 } else { 363 if (!isSelected) { 364 shop2.product._reload(this); 365 } 366 } 367 368 } else {
369 console.log($this); 370 var index = $this.index(); 371 372 colors.eq(index).toggleClass('shop2-color-ext-selected'); 373 shop2.filter.toggle(data.name, data.value); 374 shop2.filter.count(); 375 376 } 377 return false; 378 }); 379}, 380 381$(function() { 382 383 var $win = $(window), 384 $doc = $(document), 385 $html = $(document.documentElement), 386 isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), 387 isApple = /iPod|iPad|iPhone/i.test(navigator.userAgent), 388 clickStart = (isMobile) ? 'touchend' : 'click'; 389 if (document.location.search.indexOf('mobile') != -1) {isMobile = true}; 390 391 $('table').wrap('<div class="table-wrapper"></div>'); 392 393 // Menu block begin 394 var menuTopClone = $('.menu_top').clone().addClass('clone'), 395 mobileTitle = $('.cat_bl_title').text(); 396 397 $('.fixed_menu_mobile').prepend('<div class="mobile_menu_title"><span></span>' + mobileTitle + '</div>'); 398 $('.fixed_menu_mobile').append(menuTopClone); 399 $('.fixed_menu_mobile .menu_top').wrap('<div class="mobile_top_wrap"></div>'); 400 $win.scroll(function() { 401 if ($win.scrollTop() > 0) { 402 $('.fixed_menu_mobile, .shop2-block.login-form').addClass('fixed'); 403 $('.cart_items_wr').addClass('not_top'); 404 } else { 405 $('.fixed_menu_mobile, .shop2-block.login-form').removeClass('fixed'); 406 $('.cart_items_wr').removeClass('not_top'); 407 } 408 }); 409 if ($win.scrollTop() > 0) { 410 $('.fixed_menu_mobile, .shop2-block.login-form').addClass('fixed'); 411 $('.cart_items_wr').addClass('not_top'); 412 } 413 var waSlideLang = ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') ? 'back' : 'Ðазад'; 414 $('.fixed_menu_mobile .mobile_cat_wrap').waSlideMenu({ 415 backOnTop: true, 416 scrollToTopSpeed: 100, 417 minHeightMenu: 0, 418 slideSpeed: 100, 419 backLinkContent: waSlideLang, 420 afterSlide : function(){ 421 var menuOffsetTop = $('.fixed_panel_wrap').offset().top; 422 $('.fixed_menu_mobile').animate({ 423 scrollTop: 0 424 }, 300); 425 426 $(document).on('click', '.mobile_menu > li > ul > li.waSlideMenu-back', function(){ 427 setTimeout(function(){ 428 $('.mobile_menu > li').removeClass('opened'); 429 }, 310); 430 }); 431 432 //if($('.sublevel').find('> ul').length ){ 433 // $('li.sublevel').removeClass('sublevel'); 434 //} 435 } 436 }); 437 438 439 $('.mobile_menu li').each(function(){ 440 441 var $this = $(this), 442 $ul = $this.find('ul').length; 443 444 if ($ul<1) { 445 $this.removeClass('sublevel'); 446 } 447 }); 448 449 450 $('.mobile_menu > li').on('touchend', function(){ 451 $(this).addClass('opened') 452 }); 453 454 455 $('.fixed_mobile_close, .mobile_menu_title').on('click', function(){ 456 $('.fixed_menu_mobile').removeClass('opened'); 457 $('.site_shadow4').removeClass('active'); 458 $('html').removeClass('overflowHidden'); 459 }); 460 461 $(document).on(clickStart, function(event){ 462 if( $(event.target).closest('.cat_bl_title').length || $(event.target).closest('.fixed_menu_mobile.opened').length || $(event.target).closest('.left-nav').length) 463 return; 464 $('.fixed_menu_mobile').removeClass('opened'); 465 $('.site_shadow4').removeClass('active'); 466 $('.left-nav').hide(); 467 $('html').removeClass('overflowHidden'); 468 }); 469 470 if (isMobile) { 471 if ($win.width() > 1260) { 472 $('.site_menu_bl .menu_top').s3MenuAllIn({ 473 type: 'dropdown', 474 activateTimeout: 250, 475 showTime: 0, 476 hideTime: 0, 477 showFn: $.fn.fadeIn, 478 hideFn: $.fn.fadeOut 479 }); 480 481 $('.site_menu_bl .menu_top li a').on('click', function() { 482 if ($(this).hasClass('s3-menu-allin-open')) { 483 document.location.href = $(this).attr('href'); 484 }; 485 }); 486 487 $('.site_menu_bl .menu_top').addClass('tablet'); 488 } 489 } else { 490 $('.site_menu_bl .menu_top').s3MenuAllIn({ 491 type: 'bottom', 492 debug: false, 493 activateTimeout: 0, 494 showTime: 250, 495 hideTime: 250, 496 showFn: $.fn.fadeIn, 497 hideFn: $.fn.fadeOut 498 }); 499 } 500 $(document).on(clickStart, function(event){ 501 if( $(event.target).closest('.site_menu_bl .menu_top').length || $(event.target).closest('.site_menu_bl .menu_top ul').length || $(event.target).closest('.flexMenu-viewMore').length) 502 return; 503 $('.flexMenu-viewMore').removeClass('active'); 504 $('.site_menu_bl .menu_top li a').removeClass('s3-menu-allin-open'); 505 $('.site_menu_bl .menu_top ul').removeAttr('style'); 506 }); 507 // Menu block end 508 509 // Top slider begin 510 if($('.top_slider .top_slider_item').length>1) { 511 $('.top_slider').owlCarousel({ 512 loop: true, 513 margin: 0, 514 nav: true, 515 dots: true, 516 items: 1, 517 autoplay:false, 518 autoHeight : false 519 }); 520 } 521 // Top slider end 522 523 //Lazy load 524 if (shop2.my.gr_img_lazyload) { 525 try{
526 var myLazyLoad = new LazyLoad(); 527 myLazyLoad.update(); 528 } catch (e) { 529 console.log(e); 530 } 531 } 532 //Lazy load end 533 534 // Reviews block begin 535 if($('.rev_bl_body .rev_bl_item').length>1) { 536 $('.rev_bl_body').owlCarousel({ 537 loop: false, 538 margin: 0, 539 dots: true, 540 nav: true, 541 autoplay:false, 542 autoHeight : false, 543 responsive: { 544 0: { 545 items: 1 546 }, 547 640: { 548 items: 2 549 }, 550 1024: { 551 items: 3 552 } 553 } 554 }); 555 } 556 // Rreviews block end 557 558 // Loign form begin 559 $(".cab_icon").on('click', function(){ 560 $(this).toggleClass('active'); 561 $('.shop2-block.login-form').toggleClass('active'); 562 }); 563 564 $('.cab_icon_mobile').on('click', function(){ 565 $(this).toggleClass('active'); 566 $('.shop2-block.login-form').toggleClass('showed'); 567 $('.site_shadow2').toggleClass('active'); 568 $('.search_bl_wrap').toggleClass('index'); 569 }); 570 571 $(document).on(clickStart, function(event){ 572 if($(event.target).closest('.shop2-block.login-form').length || $(event.target).closest('.cab_icon').length || $(event.target).closest('.cab_icon_mobile').length) 573 return; 574 $('.cab_icon').removeClass('active'); 575 $('.cab_icon_mobile').removeClass('active'); 576 $('.shop2-block.login-form').removeClass('active'); 577 $('.shop2-block.login-form').removeClass('showed'); 578 $('.site_shadow2').removeClass('active'); 579 $('.search_bl_wrap').removeClass('index'); 580 }); 581 582 $('.shop2-block.login-form .block-title span').on('click', function(){ 583 $('.cab_icon').removeClass('active'); 584 $('.cab_icon_mobile').removeClass('active'); 585 $('.shop2-block.login-form').removeClass('active'); 586 $('.shop2-block.login-form').removeClass('showed'); 587 $('.site_shadow2').removeClass('active'); 588 $('.search_bl_wrap').removeClass('index'); 589 }); 590 // Login form end 591 592 if(shop2.my.gr_button_up_new){ 593 var scrollAmount = 200; 594 595 $(window).scroll(function() { 596 var scroll = $(window).scrollTop(); 597 598 if (scroll>=scrollAmount) { 599 $('.btn_up').addClass('active'); 600 } else { 601 $('.btn_up').removeClass('active'); 602 } 603 }); 604 605 606 $('.btn_up').on('click', function(){ 607 $('html, body').animate({scrollTop:0}, 1300); 608 }); 609 610 } 611 612 // Flexmenu begin 613 resizeController([0, 1260], function() { 614 $('.site_header .site_menu_bl .menu_top').flexMenu({undo: true}); 615 }); 616 617 resizeController([1024, Infinity], function() { 618 $('.site_header .site_menu_bl .menu_top').flexMenu({ 619 linkText:'' 620 }); 621 }); 622 $('.site_menu_bl .menu_top li.flexMenu-viewMore .flexMenu-popup li a').on('click', function() { 623 document.location.href = $(this).attr('href'); 624 }); 625 // Flexmenu end 626 627 // Avaz menu begin 628 if (!$('.left-nav .left-categor li ul').length) { 629 $('.left-nav').addClass('no_ul'); 630 }; 631 632 var $nav = $('.cat_bl_wrap .left-nav'); 633 $('.cat_bl_title').on('click', function() { 634 var navHeight = $('.left-nav').outerHeight(); 635 $(this).toggleClass('active'); 636 $('.site_shadow4').addClass('active'); 637 $('.fixed_menu_mobile').addClass('opened'); 638 resizeController([0, 1260], function() { 639 $('html').addClass('overflowHidden'); 640 }); 641 642 resizeController([1260, Infinity], function() { 643 $('html').removeClass('overflowHidden'); 644 }); 645 646 if($nav.is(':hidden')) { 647 $nav.fadeIn(0); 648 var navHeight = $('.left-nav').outerHeight(); 649 650 $('.left-nav ul').css({ 651 height: navHeight 652 }); 653 654 maxHeight2(); 655 } else { 656 $nav.fadeOut(0); 657 } 658 }); 659 660 var firstLi = $('.left-nav-inner .left-categor > li'), 661 liFirstLevelHas = $('.left-nav-inner .left-categor>li>a.has'); 662 663 liFirstLevelHas.on('click', function(event){ 664 if ($(this).hasClass('opened')) { 665 document.location.href = $(this).attr('href'); 666 }; 667 $(this).parents('.left-categor').toggleClass('opened'); 668 liFirstLevelHas.removeClass('opened'); 669 $(this).addClass('opened'); 670 event.preventDefault(); 671 }); 672 673 firstLi.click(function() { 674 var navHeight = $('.left-nav').outerHeight(); 675 676 firstLi.removeClass("light"); 677 $(this).addClass("light"); 678 679 $('.left-nav ul, .left-categor-subpages .firstLi-ul').css({ 680 height: 'auto', 681 }); 682 683 $('.left-categor-subpages').remove(); 684 685 if($(this).find('> ul').length ){ 686 687 var firstLi_sub_inner = $(this).find('> ul').html(); 688 689 var liClone = $(this).find('>a').clone(); 690 691 $(this).parents('.left-nav-inner').append('<div class="left-categor-subpages"></div>') 692 $('.left-categor-subpages').html('<ul class="firstLi-ul"><div class="firstLi_in"><div class="prev_title"></div>' + firstLi_sub_inner + '</div></ul>'); 693 $('.prev_title').append(liClone); 694 695 $(".firstLi-ul li").hover(function(){ 696 $('.firstLi-ul').css({ 697 height: 'auto', 698 }); 699 $(this).siblings().removeClass("light"); 700 $(this).addClass("light"); 701 if( $(this).parent().parent().find('ul').length>1 ){ 702 703 $(this).parent().nextAll().remove(); 704 705 if( $(this).find('>ul').length ){ 706 $(this).find('>ul').clone(true).appendTo($(this).parent().parent()); 707 } 708 } 709 maxHeight2(); 710 }, function(){}); 711 maxHeight2(); 712 } 713 714 var navHeight = $('.left-nav').outerHeight(); 715 $('.left-nav ul, .left-categor-subpages .firstLi-ul').css({ 716 height: navHeight 717 }); 718 719 if($(this).find('> ul').length){ 720 721 $(".firstLi-ul li").hover(function(){ 722 723 $('.firstLi-ul').css({ 724 height: navHeight 725 }); 726 727 }, function(){}); 728 } 729 }); 730 731 function maxHeight2(){ 732 var winHeight = $(window).height(); 733 $('.left-nav .left-nav-inner.desktop ul').css({ 734 maxHeight : winHeight - 74, 735 'overflow-y' : 'auto', 736 'overflow-x' : 'hidden' 737 }); 738 } 739
740 $(document).on(clickStart, function(event){ 741 if( $(event.target).closest('.left-nav-inner').length || $(event.target).closest('.cat_bl_title.active').length) 742 return; 743 liFirstLevelHas.removeClass('opened'); 744 $('.left-categor-subpages').remove(); 745 $('.left-nav').hide(0); 746 $('.left-categor').removeAttr('style'); 747 $('.cat_bl_title').removeClass('active'); 748 $('.left-nav-inner').removeClass('opened'); 749 }); 750 // Avaz menu end 751 752 // Categories block begin 753 754 resizeController([1260, Infinity], function() { 755 var top1 = $(document).scrollTop(), 756 panel = $('.fixed_panel_in'), 757 fixedMenu = $(".fixed_panel_wrapper"); 758 759 if (fixedMenu.length) { 760 if (top1 >= fixedMenu.offset().top && $(window).scrollTop() != 0) { 761 panel.addClass('fixed'); 762 }; 763 764 $(window).scroll(function() { 765 top1 = $(document).scrollTop(); 766 767 if (top1 >= fixedMenu.offset().top && $(window).scrollTop() != 0) { 768 panel.addClass('fixed'); 769 } else { 770 panel.removeClass('fixed'); 771 }; 772 }); 773 }; 774 }); 775 776 if (shop2.my.gr_header_new_style){ 777 778 resizeController([0, 1259], function() { 779 780 var headerOffset = $('.fixed_panel_wrapper').offset().top + 10; 781 var winScroll = $win.scrollTop(); 782 783 if (winScroll>=headerOffset) { 784 $('.fixed_panel_in').addClass('fixed'); 785 } else { 786 $('.fixed_panel_in').removeClass('fixed'); 787 } 788 789 $win.on('scroll', function(){ 790 791 var winScroll = $win.scrollTop(); 792 793 if (winScroll>=headerOffset) { 794 $('.fixed_panel_in').addClass('fixed'); 795 } else { 796 $('.fixed_panel_in').removeClass('fixed'); 797 } 798 799 }); 800 801 }); 802 803 } else { 804 805 resizeController([0, 1259], function() { 806 var panel = $('.fixed_panel_in'); 807 808 $(window).scroll(function() { 809 var topScroll = $(window).scrollTop(); 810 811 if (topScroll > 9) { 812 panel.addClass('fixed'); 813 } else { 814 panel.removeClass('fixed'); 815 }; 816 }); 817 818 }); 819 820 } 821 822 $('.main_folders_wrapper .main_folders_wr .main_folders li .folder_pic img').bgdSize('cover'); 823 824 if ($win.width() > 1359 && $('.main_folders_wrapper .main_folders_wr .main_folders > li').length<9) { 825 $('.all_blocks_wr').hide(); 826 } 827 828 if (($win.width() > 767 && $win.width() < 1360) && $('.main_folders_wrapper .main_folders_wr .main_folders > li').length<7) { 829 $('.all_blocks_wr').hide(); 830 } 831 832 if ($win.width() < 640 && $('.main_folders_wrapper .main_folders_wr .main_folders > li').length<4) { 833 $('.all_blocks_wr').hide(); 834 } 835 836 $('.all_blocks_but').on('click', function() { 837 $(this).toggleClass('opened'); 838 if ($(this).hasClass('opened')) { 839 if ($win.width() > 1340) { 840 $('.main_folders_wrapper .main_folders_wr .main_folders li:gt(7)').addClass('showed'); 841 } 842 if ($win.width() > 639 && $win.width() < 1340) { 843 $('.main_folders_wrapper .main_folders_wr .main_folders li:gt(5)').addClass('showed'); 844 } 845 if ($win.width() < 640) { 846 $('.main_folders_wrapper .main_folders_wr .main_folders li:gt(2)').addClass('showed'); 847 } 848 $(this).text('СвеÑнÑÑÑ'); 849 setTimeout(function(){ 850 $('.main_folders_wrapper .main_folders_wr .main_folders li .folder_pic img').bgdSize('cover'); 851 }, 250) 852 } else { 853 if ($win.width() > 1340) { 854 $('.main_folders_wrapper .main_folders_wr .main_folders li:gt(7)').removeClass('showed'); 855 } 856 if ($win.width() > 639 && $win.width() < 1340) { 857 $('.main_folders_wrapper .main_folders_wr .main_folders li:gt(5)').removeClass('showed'); 858 } 859 if ($win.width() < 640) { 860 $('.main_folders_wrapper .main_folders_wr .main_folders li:gt(2)').removeClass('showed'); 861 } 862 $(this).text('ÐÑе каÑегоÑии'); 863 864 var foldersScrollTop = $('.main_folders_wrapper').offset().top; 865 866 $('html, body').animate({ 867 scrollTop: foldersScrollTop - 74 868 }, 800); 869 }; 870 }); 871 // Categories block end 872 873 // Search block begin 874 var windowHeight = $(window).height(), 875 searchMaxHeight = windowHeight - 63, 876 cartHeight = windowHeight - 80; 877 878 if ($win.width()>1024) { 879 cartHeight = windowHeight - 260; 880 } 881 882 $('.shop2-block.search-form').css('max-height', searchMaxHeight); 883 884 $('.shop2-block.search-form select').styler(); 885 $('.shop2-block.search-form input[type="checkbox"]').styler(); 886 887 $(document).on('click', '.shop2-block.search-form .row .shop2-color-ext-select, .shop2_product_item .shop2-color-ext-select, .shop2-product .shop2-color-ext-select', function(){ 888 $(this).toggleClass('opened');
889 $this = $(this); 890 891 $('#shop2-color-ext-select').on('click', function(){ 892 $this.removeClass('opened'); 893 }); 894 }); 895 896 //$('.site_header .fixed_panel_wrapper .cart_bl_wrap .cart_items_wr').css('max-height', cartHeight); 897 898 $(document).on(clickStart, function(event){ 899 if($(event.target).closest('.shop2-block.search-form .row .shop2-color-ext-select').length || $(event.target).closest('#shop2-color-ext-select').length) 900 return; 901 $('.shop2-block.search-form .row .shop2-color-ext-select').removeClass('opened'); 902 }); 903 904 $('.search2_icon').on('click', function(){ 905 $(this).toggleClass('active'); 906 $('.shop2-block.search-form').toggleClass('active'); 907 $('form.search-form').toggleClass('active'); 908 $('.site_shadow').toggleClass('active'); 909 910 if ($(window).width() < 1260) { 911 $('html').addClass('overflowHidden2'); 912 }; 913 914 if ($(window).width() > 1260) { 915 $('html').removeClass('overflowHidden2'); 916 }; 917 }); 918 919 $('.search_icon_mobile').on('click', function(){ 920 $('form.search-form').addClass('mobile'); 921 $('#search-app').addClass('mobile'); 922 $('.shop2-block.search-form').addClass('mobile'); 923 $('html').addClass('overflowHidden2'); 924 $('.site_shadow').addClass('active'); 925 }); 926 927 $('.search3_icon').on('click', function(){ 928 $('form.search-form').removeClass('mobile'); 929 $('#search-app').removeClass('mobile'); 930 $('.shop2-block.search-form').removeClass('mobile'); 931 $('html').removeClass('overflowHidden2'); 932 $('body').removeClass('ios'); 933 //$('body').addClass('ios'); 934 $('.site_shadow').removeClass('active'); 935 }); 936 937 $('.shop2-block.search-form .block-title').on('click.sea', function(){ 938 $(this).toggleClass('active'); 939 $(this).next().slideToggle(); 940 //$('body').addClass('ios'); 941 }); 942 943 if ($win.width() > 639) { 944 $('.shop2-block.search-form .block-title').off('click.sea'); 945 } 946 947 $(document).on(clickStart, function(event){ 948 if($(event.target).closest('.shop2-block.search-form, #search-app').length || $(event.target).closest('form.search-form').length || $(event.target).closest('#shop2-color-ext-select').length || $(event.target).closest('.search_icon_mobile').length) 949 return; 950 $('.shop2-block.search-form').removeClass('active'); 951 $('form.search-form').removeClass('active'); 952 $('#search-app').removeClass('mobile'); 953 $('.site_shadow').removeClass('active'); 954 $('body').removeClass('ios'); 955 $('.search2_icon').removeClass('active'); 956 957 $('form.search-form').removeClass('mobile'); 958 $('.shop2-block.search-form').removeClass('mobile'); 959 960 if ($(window).width() < 1260) { 961 $('html').removeClass('overflowHidden2'); 962 }; 963 }); 964 // Search block end 965 966 // Bind image load begin 967 $.fn.bindImageLoad = function (callback) { 968 function isImageLoaded(img) { 969 if (!img.complete) { 970 return false; 971 } 972 if (typeof img.naturalWidth !== "undefined" && img.naturalWidth === 0) { 973 return false; 974 } 975 return true; 976 } 977 978 return this.each(function () { 979 var ele = $(this); 980 if (ele.is("img") && $.isFunction(callback)) { 981 ele.one("load", callback); 982 if (isImageLoaded(this)) { 983 ele.trigger("load"); 984 } 985 } 986 }); 987 }; 988 // Bind image load end 989 990 // Product block begin 991 992 var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 993 if (!isMobile && jQuery().zoom) { 994 $('.gr-image-zoom').zoom({ 995 magnify: 1, 996 duration: 10, 997 onZoomIn: function(){ 998 $(this).parent().addClass('hide_small_pic'); 999 }, 1000 onZoomOut: function(){ 1001 $(this).parent().removeClass('hide_small_pic'); 1002 }, 1003 callback: function(){ 1004 var $zoomImg = $(this); 1005 var zoomImgHeight = Math.floor($zoomImg.height()); 1006 var zoomImgWidth = Math.floor($zoomImg.width()); 1007 var floatHeight = Math.floor(20 * zoomImgHeight / 100); 1008 var floatWidth = Math.floor(20 * zoomImgWidth / 100); 1009 var prevWidth = Math.floor($(this).prev().outerWidth()); 1010 var prevHeight = Math.floor($(this).prev().outerHeight()); 1011 1012 var zoomFloatHeight = zoomImgHeight + floatHeight; 1013 var zoomFloatWidth = zoomImgWidth + floatWidth; 1014 var finalHeight = prevHeight+floatHeight; 1015 var finalWidth = prevWidth+floatWidth; 1016 1017 if (zoomFloatHeight<=prevHeight-floatHeight || zoomFloatWidth<=prevWidth-floatWidth) { 1018 $(this).parent().addClass('hide_big_pic'); 1019 }; 1020 1021 if (zoomImgHeight<=prevHeight || zoomImgWidth <=prevWidth) { 1022 $zoomImg.css({
1023 'width': finalWidth, 1024 'height': finalHeight 1025 }); 1026 } 1027 } 1028 }); 1029 }; 1030 1031 if ($('.product_slider .product_image').length>1) { 1032 $('.product_slider').slick({ 1033 infinite: false, 1034 slidesToShow: 1, 1035 slidesToScroll: 1, 1036 arrows: false, 1037 fade: true, 1038 asNavFor: '.product_slider_thumbs' 1039 }); 1040 1041 $('.product_slider_thumbs').slick({ 1042 infinite: false, 1043 slidesToShow: 4, 1044 slidesToScroll: 1, 1045 asNavFor: '.product_slider', 1046 dots: false, 1047 autoplay:false, 1048 autoplaySpeed:1500, 1049 focusOnSelect: true, 1050 responsive: [ 1051 { 1052 breakpoint: 1340, 1053 settings: { 1054 slidesToShow: 3, 1055 slidesToScroll: 1, 1056 vertical: false, 1057 infinite: false, 1058 } 1059 } 1060 ] 1061 }); 1062 } else { 1063 $('.product_slider_thumbs').hide(); 1064 } 1065 1066 $('.product_slider').lightGallery({ 1067 thumbnail: false, 1068 download: true, 1069 loop: false, 1070 counter: false, 1071 getCaptionFromTitleOrAlt: true, 1072 selector: '.product_image a' 1073 }); 1074 1075 $(document).on('click', '.hide_product_params', function(){ 1076 $(this).parents('.shop2_product_item').find('.product_bot_center .product-article').slideToggle('slow'); 1077 $(this).parents('.shop2_product_item').find('.product-anonce').slideToggle('slow'); 1078 $(this).parents('.shop2_product_item').find('.product_options').slideToggle('slow'); 1079 $(this).toggleClass('opened'); 1080 1081 if ($(this).hasClass('opened')) { 1082 if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') { 1083 $(this).text('Hide options'); 1084 } else { 1085 $(this).text('СкÑÑÑÑ Ð¿Ð°ÑамеÑÑÑ'); 1086 } 1087 } else { 1088 if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') { 1089 $(this).text('Show options'); 1090 } else { 1091 $(this).text('ÐоказаÑÑ Ð¿Ð°ÑамеÑÑÑ') 1092 } 1093 } 1094 }); 1095 1096 $('.product-list .shop2_product_item select').styler(); 1097 $('.shop2-product select').styler(); 1098 function bindIng() { 1099 var temp = 1; 1100 1101 $('.product-list .shop2_product_item .product-image img').bindImageLoad(function(){ 1102 temp++; 1103 1104 if($('.shop2_product_item .product-image img, .kind-image img').length) { 1105 var heights = [], 1106 maxHeight; 1107 1108 $('.shop2_product_item .product-image img, .kind-image img').css('height', 'auto'); 1109 1110 $('.shop2_product_item .product-image img, .kind-image img').each(function(){ 1111 heights.push($(this).height()); 1112 }); 1113 maxHeight = Math.max.apply(null, heights); 1114 1115 $('.shop2_product_item .product-image.no-image, .kind-image img').each(function(){ 1116 $(this).css('height', maxHeight); 1117 }); 1118 } 1119 1120 }); 1121 } 1122 1123 bindIng(); 1124 1125 $win.resize(function(event) { 1126 bindIng(); 1127 }); 1128 1129 function blocksMatchHeight(arr) { 1130 for (var i = 0; i< arr.length; i++) {
1131 $(arr[i]).matchHeight(); 1132 } 1133 } 1134 1135 var allignBlocks = function(){ 1136 blocksMatchHeight([ 1137 '.kind_det_top', 1138 '.main_block_wrap .product-list .product_list_in.product-list-thumbs .product-top .product-name', 1139 '.recent-block .recent-item__inner' 1140 ]); 1141 } 1142 allignBlocks(); 1143 1144 window.addEventListener("orientationchange", function() { 1145 setTimeout(function(){ 1146 allignBlocks(); 1147 $('.main_folders_wrapper .main_folders_wr .main_folders li .folder_pic img').bgdSize('cover'); 1148 }, 500); 1149 bindIng(); 1150 }, false); 1151 // Product block end 1152 1153 // Sorting block begin 1154 $('.sort_bl_title').on('click', function(){ 1155 $(this).toggleClass('active'); 1156 $('.sorting_in').toggleClass('active'); 1157 $('.sort_bl_wrap').slideToggle(0); 1158 }); 1159 1160 $(document).on(clickStart, function(sort){ 1161 if($(sort.target).closest('.sort_bl_title').length || $(sort.target).closest('.sort_bl_wrap').length) 1162 return; 1163 $('.sort_bl_title').removeClass('active'); 1164 $('.sorting_in').removeClass('active'); 1165 $('.sort_bl_wrap').slideUp(0); 1166 }); 1167 // Sorting block end 1168 1169 // Filter block begin 1170 $('.shop2-filter-fields select').styler(); 1171 1172 /*setTimeout(function(){ 1173 $(".shop2-color-ext-caption").click(); 1174 var colorList = $('#shop2-color-ext-popup').clone().addClass('cloned_list'); 1175 $('#shop2-color-ext-popup').remove(); 1176 $('.shop2-color-ext-popup').append(colorList); 1177 }, 300);*/ 1178 1179 $('.filter_block_title').on('click', function(){ 1180 $('.shop2-filter').toggleClass('opened'); 1181 $('.filter_block_top').toggleClass('active'); 1182 $('.filter_block_top').removeClass('opened'); 1183 $('.shop_sorting_panel').removeClass('index'); 1184 $('.filter_bg').removeClass('active'); 1185 }); 1186 1187 $('.filter_mobile_btn').on('click', function(){ 1188 $('.shop2-filter').toggleClass('opened'); 1189 $('.filter_block_top').toggleClass('opened'); 1190 $('.shop_sorting_panel').addClass('index'); 1191 $('.filter_bg').addClass('active'); 1192 }); 1193 1194 $(document).on(clickStart, function(event){ 1195 if($(event.target).closest('.filter_block_title').length || $(event.target).closest('.shop2-filter').length || $(event.target).closest('.filter_mobile_btn').length) 1196 return; 1197 $('.shop2-filter').removeClass('opened'); 1198 $('.filter_block_top').removeClass('active'); 1199 $('.filter_block_top').removeClass('opened'); 1200 $('.shop_sorting_panel').removeClass('index'); 1201 $('.filter_bg').removeClass('active'); 1202 }); 1203 // Filter block end 1204 1205 // Products block begin 1206 var $btnThumbs = $('.view-shop2 .thumbs'), 1207 $btnSimple = $('.view-shop2 .simple'), 1208 $btnPrice = $('.view-shop2 .pricelist'), 1209 $lotsWrap = $('.product_list_in'); 1210 1211 function thumbsLots() { 1212 $btnThumbs.addClass('active-view'); 1213 $btnSimple.removeClass('active-view'); 1214 $btnPrice.removeClass('active-view'); 1215 $lotsWrap.addClass('product-list-thumbs'); 1216 $lotsWrap.removeClass('product-list-simple'); 1217 $lotsWrap.removeClass('product-list-price'); 1218 $('.pricelist_titles').hide(0); 1219 } 1220 1221 function simpleLots() { 1222 $btnSimple.addClass('active-view'); 1223 $btnThumbs.removeClass('active-view'); 1224 $btnPrice.removeClass('active-view'); 1225 $lotsWrap.addClass('product-list-simple'); 1226 $lotsWrap.removeClass('product-list-thumbs'); 1227 $lotsWrap.removeClass('product-list-price'); 1228 $('.pricelist_titles').hide(0); 1229 } 1230 1231 function priceLots() { 1232 $btnPrice.addClass('active-view'); 1233 $btnThumbs.removeClass('active-view'); 1234 $btnSimple.removeClass('active-view'); 1235 $lotsWrap.addClass('product-list-price'); 1236 $lotsWrap.removeClass('product-list-thumbs'); 1237 $lotsWrap.removeClass('product-list-simple'); 1238 $('.pricelist_titles').show(0); 1239 } 1240 1241 $btnThumbs.on(clickStart, function(e) { 1242 e.preventDefault(); 1243 thumbsLots(); 1244 setTimeout(function(){ 1245 bindIng(); 1246 }, 200); 1247 eraseCookie('simple'); 1248 eraseCookie('price'); 1249 createCookie('thumbs', 1, 1); 1250 return false; 1251 1252 }); 1253 1254 $btnSimple.on(clickStart, function(e) { 1255 e.preventDefault(); 1256 simpleLots(); 1257 setTimeout(function(){ 1258 bindIng(); 1259 }, 200); 1260 eraseCookie('price'); 1261 eraseCookie('thumbs'); 1262 createCookie('simple', 1, 1); 1263 return false; 1264 1265 }); 1266 1267 $btnPrice.on(clickStart, function(e) { 1268 e.preventDefault(); 1269 priceLots(); 1270 setTimeout(function(){ 1271 bindIng(); 1272 }, 200); 1273 eraseCookie('simple'); 1274 eraseCookie('thumbs'); 1275 createCookie('price', 1, 1); 1276 return false;
1277 }); 1278 1279 function viewLots() { 1280 var $mainBlock = $('.shop2-product-item').closest('.shop-main-block-wr').length; 1281 1282 if (readCookie('thumbs') || $mainBlock == 1) { 1283 thumbsLots(); 1284 } else if (readCookie('simple') && !$mainBlock == 1) { 1285 simpleLots(); 1286 } else if (readCookie('price') && !$mainBlock == 1) { 1287 priceLots(); 1288 } 1289 1290 if ($win.width() < 768) { 1291 thumbsLots(); 1292 } 1293 1294 if (shop2.mode == 'main') { 1295 $('.product_list_in').removeClass('product-list-simple'); 1296 $('.product_list_in').removeClass('product-list-price'); 1297 $('.product_list_in').addClass('product-list-thumbs'); 1298 $('.pricelist_titles').hide(); 1299 } 1300 } 1301 1302 $(window).on('resize', viewLots).trigger('resize'); 1303 // Products block end 1304 1305 // Amount-minus-disabled begin 1306 $('.shop_cart_product, .shop2-product-item, .shop2-product').each(function(index) { 1307 var $this = $(this), 1308 $amountInput = $this.find('.shop2-product-amount input[type="text"]'), 1309 amountInputValue = $amountInput.val(), 1310 amountMax = $this.find('.shop2-product-amount input[type="text"]').attr('data-max'), 1311 amountMin = $this.find('.shop2-product-amount input[type="text"]').data('min'), 1312 amountMaxNum = +amountMax, 1313 amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(), 1314 amountInputNum = +amountInput2; 1315 1316 $this.find('.shop2-product-amount input').on('change', function(e) { 1317 amInputVal = +$(this).val(); 1318 amNumber = 1; 1319 1320 if (amInputVal <= amountMin) { 1321 $(this).val(amountMin); 1322 } 1323 }); 1324 1325 function amounMinus() { 1326 if (amountInputValue >= amountMin) { 1327 $this.find('.shop2-product-amount button.amount-minus').removeAttr('disabled'); 1328 } else { 1329 $this.find('.shop2-product-amount button.amount-minus').attr('disabled', 'disabled'); 1330 } 1331 } 1332 amounMinus(); 1333 1334 if (amountInputNum >= amountMaxNum) { 1335 $this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled'); 1336 } else { 1337 $this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled'); 1338 } 1339 1340 $this.find('.shop2-product-amount button').on('click', function(e) { 1341 setTimeout(function() { 1342 amountInputValue = $amountInput.val(); 1343 1344 amounMinus(); 1345 }, 100); 1346 setTimeout(function() { 1347 var amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(), 1348 amountInputNum = +amountInput2; 1349 if (amountInputNum == amountMaxNum) { 1350 $this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled'); 1351 } else { 1352 $this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled'); 1353 } 1354 }, 100); 1355 }); 1356 $this.find('.shop2-product-amount input').on('keyup', function(e) { 1357 setTimeout(function() { 1358 amountInputValue = $amountInput.val(); 1359 1360 amounMinus(); 1361 1362 var amountInput2 = $this.find('.shop2-product-amount input[type="text"]').val(), 1363 amountInputNum = +amountInput2; 1364 1365 if (amountInputNum >= amountMaxNum) { 1366 $this.find('.shop2-product-amount button.amount-plus').attr('disabled', 'disabled'); 1367 } else { 1368 $this.find('.shop2-product-amount button.amount-plus').removeAttr('disabled'); 1369 } 1370 }, 100); 1371 }); 1372 }); 1373 // Amount-minus-disabled end 1374 1375 // Buy-one-click begin 1376 $('.tpl-anketa.type-select select').styler(); 1377 $('.tpl-anketa input[type="checkbox"]').styler(); 1378 $('.tpl-anketa input[type="radio"]').styler(); 1379 1380 (function(){ 1381 if(!$('.buy-one-click-wr').length) return; 1382 1383 var $form = $('.buy-one-click-form-wr'), 1384 $closeFormBtn = $('.buy-one-click-form-in .close-btn'); 1385 1386 $('.buy-one-click-wr > a').on(clickStart, function(e){ 1387 e.preventDefault(); 1388 var productLink = (shop2.mode!=="product") ? (document.location.origin)+$(this).closest('.shop2-product').find('.product-name > a').attr('href') : (document.location.href); 1389 if (shop2.my.mode_catalog) { 1390 var productName = (shop2.mode!=="product") ? $(this).closest('.shop2-product').find('.product-name > a').html() : $(this).closest('.site_container').find('h1').html(); 1391 }else{ 1392 var productName = (shop2.mode!=="product") ? $(this).closest('.shop2-product').find('.product-name > a').html() + (' ÐолиÑеÑÑво:' + $(this).closest('.shop2-product').find('.shop2-product-amount input[type="text"]').val()) : $(this).closest('.site_container').find('h1').html() + (' ÐолиÑеÑÑво:' + $(this).closest('.product_side_r').find('.shop2-product-amount input[type="text"]').val()); 1393 } 1394 1395 $form.addClass('active'); 1396 setTimeout(function() { 1397 $form.find('input.productName').val(productName); 1398 $form.find('input.productLink').val(productLink); 1399 }, 800); 1400 1401 if (isApple) { 1402 $('html, body').addClass('overflowHidden3'); 1403 } else { 1404 $(document.documentElement).addClass('overflowHidden3'); 1405 } 1406 $('.site_container').addClass('z_index'); 1407 }); 1408 1409 $closeFormBtn.on(clickStart, function(e){ 1410 e.preventDefault(); 1411 1412 $form.removeClass('active'); 1413 $('.site_container').removeClass('z_index'); 1414 1415 if (isApple) { 1416 $('html, body').removeClass('overflowHidden3'); 1417 } else { 1418 $(document.documentElement).removeClass('overflowHidden3'); 1419 } 1420 }); 1421 })(); 1422 1423 $(document).on(clickStart, function(buyOnclick){ 1424 if( $(buyOnclick.target).closest('.buy-one-click-form-in').length || $(buyOnclick.target).closest('.buy-one-click').length || $(buyOnclick.target).closest('.ui-datepicker').length || $(buyOnclick.target).closest('.ui-corner-all').length || $(buyOnclick.target).closest('.upload-button').length) 1425 return; 1426 $('.buy-one-click-form-wr').removeClass('active'); 1427 $('.site_container').removeClass('z_index'); 1428 $('html, body').removeClass('overflowHidden3'); 1429 }); 1430 // Buy-one-click end 1431 1432 // Tabs block begin 1433 var $tabItem = $('#product_tabs .shop-product-tabs li'), 1434 tabItemLength = $('#product_tabs .shop-product-tabs li').length, 1435 allTabsWidth = 0, 1436 a = 0, 1437 allItemsWidth = 0, 1438 oneWidth = 0, 1439 tabWrapWidth = $('#product_tabs').outerWidth(); 1440 1441 $tabItem.each(function() { 1442 var itemWidth = $(this).width(); 1443 allItemsWidth = allItemsWidth+=itemWidth; 1444 1445 if (a < itemWidth) { 1446 a = itemWidth + 2; 1447 } 1448 return (allItemsWidth, a); 1449 }); 1450 1451 oneWidth = tabWrapWidth / tabItemLength; 1452 var sumWidth = a * tabItemLength; 1453 if (sumWidth > tabWrapWidth) { 1454 $('#product_tabs .shop_tabs_in').width(sumWidth); 1455 $('#product_tabs').addClass('active'); 1456 $tabItem.width(a); 1457 } else { 1458 $tabItem.width(oneWidth); 1459 $('#product_tabs').removeClass('active'); 1460 } 1461 1462 var $tabs = $('#product_tabs'); 1463 $tabs.responsiveTabs({ 1464 rotate: false, 1465 startCollapsed: 'accordion', 1466 collapsible: 'accordion', 1467 animation: 'slide', 1468 duration: 500, 1469 animationqueue: false, 1470 setHash: true, 1471 scrollToAccordion: true, 1472 scrollToAccordionOffset: 74 1473 }); 1474 1475 $('.tpl-form.comments_form input[type="checkbox"]').styler(); 1476 $('.tpl-form.tpl-auth .tpl_left .tpl-field input[type="checkbox"]').styler(); 1477 // Tabs block end 1478 1479 // Main blocks begin 1480 var $mainBlocks = $('.main_block_wrap .product_list_in'); 1481 1482 $mainBlocks.each(function() { 1483 var mainBlockFlag = 0; 1484 1485 if ($win.width() > 1099 && $(this).find('.shop2-product-item').length>4) { 1486 mainBlockFlag = 1; 1487 } 1488 1489 if ($win.width() > 767 && $win.width() < 1100 && $(this).find('.shop2-product-item').length>3) { 1490 mainBlockFlag = 1; 1491 } 1492 1493 if ($win.width() > 639 && $win.width() < 768 && $(this).find('.shop2-product-item').length>2) { 1494 mainBlockFlag = 1; 1495 } 1496 1497 if ($win.width() < 639 && $(this).find('.shop2-product-item').length>1) { 1498 mainBlockFlag = 1; 1499 } 1500 1501 if ($(this).find('.shop2-product-item').length>1) { 1502 $(this).owlCarousel({ 1503 loop: false, 1504 dots: mainBlockFlag, 1505 nav: mainBlockFlag, 1506 mouseDrag: mainBlockFlag, 1507 Drag: mainBlockFlag, 1508 autoplay:false, 1509 autoHeight : false, 1510 responsive: { 1511 0: { 1512 margin: 0, 1513 items: 1 1514 }, 1515 599: { 1516 margin: 10, 1517 items: 2 1518 }, 1519 768: { 1520 margin: 0, 1521 items: 3 1522 }, 1523 1100: { 1524 margin: 0, 1525 items: 4 1526 } 1527 } 1528 }); 1529 } 1530 }); 1531 // Main blocks end 1532 1533 // Collections block begin
1534 var $kindClass = $('.shop2_collections_wrap .shop2-group-kinds'); 1535 1536 $kindClass.each(function() { 1537 var kindFlag = 0; 1538 1539 if ($win.width() > 1099 && $(this).find('.shop-kind-item').length>4) { 1540 kindFlag = 1; 1541 } 1542 1543 if ($win.width() > 767 && $win.width() < 1100 && $(this).find('.shop-kind-item').length>3) { 1544 kindFlag = 1; 1545 } 1546 1547 if ($win.width() > 639 && $win.width() < 768 && $(this).find('.shop-kind-item').length>2) { 1548 kindFlag = 1; 1549 } 1550 1551 if ($win.width() < 639 && $(this).find('.shop-kind-item').length>1) { 1552 kindFlag = 1; 1553 } 1554 1555 if ($(this).find('.shop-kind-item').length>1) { 1556 $(this).owlCarousel({ 1557 loop: false, 1558 dots: kindFlag, 1559 nav: kindFlag, 1560 mouseDrag: kindFlag, 1561 touchDrag: kindFlag, 1562 autoplay:false, 1563 autoHeight : false, 1564 responsive: { 1565 0: { 1566 margin: 0, 1567 items: 1 1568 }, 1569 640: { 1570 margin: 0, 1571 items: 2 1572 }, 1573 768: { 1574 margin: 0, 1575 items: 3 1576 }, 1577 1100: { 1578 margin: 0, 1579 items: 4 1580 } 1581 } 1582 }); 1583 } 1584 }); 1585 // Collections block end 1586 1587 // Cart block begin 1588 1589 $('.hide_cart_details').on('click', function(){ 1590 var $cartParams = $(this).parents('.shop_cart_product').find('.cart_details_in'); 1591 1592 $cartParams.slideToggle(150); 1593 $(this).toggleClass('opened'); 1594 1595 if ($(this).hasClass('opened')) { 1596 if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') { 1597 $(this).text('Hide options'); 1598 } else { 1599 $(this).text('СкÑÑÑÑ Ð¿Ð°ÑамеÑÑÑ'); 1600 } 1601 } else { 1602 if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') { 1603 $(this).text('Show options'); 1604 } else { 1605 $(this).text('ÐоказаÑÑ Ð¿Ð°ÑамеÑÑÑ') 1606 } 1607 } 1608 }); 1609 1610 $('.coupon_bl_title').on('click', function(){ 1611 $('.coupon_body').toggleClass('opened'); 1612 }); 1613 1614 var $cartProduct = $('.shop_cart_product'), 1615 cartBtnShow = 'ÐоказаÑÑ Ð¿Ð°ÑамеÑÑÑ'; 1616 1617 if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') { 1618 cartBtnShow = 'Show options' 1619 } 1620 1621 $cartProduct.each(function(){ 1622 if ($(this).find('.hide_cart_details').length) { 1623 $(this).append('<div class="hide_cart_details2"><span>'+ cartBtnShow +'</span></div>') 1624 } 1625 }); 1626 1627 $('.hide_cart_details2 span').on('click', function(){ 1628 $(this).toggleClass('opened'); 1629 1630 if ($(this).hasClass('opened')) { 1631 if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') { 1632 $(this).text('Hide options'); 1633 } else { 1634 $(this).text('СкÑÑÑÑ Ð¿Ð°ÑамеÑÑÑ'); 1635 } 1636 } else { 1637 if ($html.attr('lang') == 'en' || $html.attr('lang') == 'de') { 1638 $(this).text('Show options'); 1639 } else { 1640 $(this).text('ÐоказаÑÑ Ð¿Ð°ÑамеÑÑÑ') 1641 } 1642 } 1643 1644 $(this).parents('.shop_cart_product').find('.cart-product-details').slideToggle(); 1645 }); 1646 1647 $('.shop2-delivery .option-type .option-label input[type="radio"]').styler(); 1648 if (!shop2.my.fix_deligate_select_destroy) {/*id1552*/ 1649 $('.shop2-delivery .option-type select').styler(); 1650 }; 1651 $('.shop2-delivery input[type="checkbox"]:not([name="order[personal_data]"])').styler(); 1652 1653 if(!shop2.my.gr_order_form_select){ 1654 $('.shop2-order-form select').styler(); 1655 } 1656 1657 $(document).on('click', '.option-label', function(){ 1658 setTimeout(function(){ 1659 $('.shop2-cart-order-form select').trigger('refresh'); 1660 $('.shop2-delivery select').trigger('refresh'); 1661 $('.shop2-delivery input[type="checkbox"]').trigger('refresh'); 1662 }, 300); 1663 }); 1664 // Cart block end 1665 1666 // Pagelist block begin 1667 var pageListPrev = $('.shop2_pagelist_wrap .page-prev').clone().addClass('clone'), 1668 pageListNext = $('.shop2_pagelist_wrap .page-next').clone().addClass('clone'); 1669 pageListFirst = $('.shop2_pagelist_wrap .page-first').clone().addClass('clone'), 1670 pageListLast = $('.shop2_pagelist_wrap .page-last').clone().addClass('clone'); 1671 1672 $('.shop2_pagelist_wrap .shop2_pagelist').append('<div class="pagelist_mobile"></div>'); 1673 $('.pagelist_mobile').prepend(pageListLast); 1674 $('.pagelist_mobile').prepend(pageListNext); 1675 $('.pagelist_mobile').prepend('<li class="mid_li"></li>'); 1676 $('.pagelist_mobile').prepend(pageListPrev); 1677 $('.pagelist_mobile').prepend(pageListFirst); 1678 // Pagelist block end 1679 1680 // Esc button begin 1681 $(document).on('keyup', function(keyUp){ 1682 if (keyUp.keyCode 1683 == 27) { 1684 $('.buy-one-click-form-wr').removeClass('active'); 1685 $('html, body').removeClass('overflowHidden3'); 1686 return false;
1687 }; 1688 }); 1689 $(document).on(clickStart, function(event){ 1690 if($(event.target).closest('.cart_block').length || $(event.target).closest('.cart_items_wr').length || $(event.target).closest('.cart_icon').length) {} else { 1691 $('.cart_icon').removeClass('active'); 1692 $('.cart_block').removeClass('active'); 1693 $('.cart_items_wr').removeClass('active'); 1694 $('.site_shadow3').removeClass('active'); 1695 $('.cart_bl_wrap').removeClass('active'); 1696 } 1697 }); 1698 // Esc button end 1699 1700 // Compare panel block 1701 var compPanel = $('.site_main .shop2-panel').clone(); 1702 1703 $('.site_main .shop2-panel').remove(); 1704 $('.site_wrapper').append(compPanel); 1705 // Compare panel block 1706 1707 var load_cart = false; 1708 1709 // Ajax block begin 1710 function ajaxCart(callback) { 1711 if (shop2.mode === 'cart') { 1712 return; 1713 } 1714 $.ajax({ 1715 url: "/-/x-api/v1/public/?method=cart/getCartPreview¶m[mode]=small¶m[detail]=true", 1716 method: "get", 1717 success: function (data, statusText, xhr) { 1718 // вÑÑезаем вÑе ÑкÑипÑÑ Ð² оÑвеÑе ajax 1719 var data = data.result.html.replace(/<script[\s\S]*/, ''); 1720 1721 $(".cart_items_block").html(data); 1722 1723 if ($win.scrollTop() > 0) { 1724 $('.cart_items_wr').addClass('not_top'); 1725 } 1726 1727 //$('.site_header .fixed_panel_wrapper .cart_bl_wrap .cart_items_wr').css('max-height', cartHeight); 1728 1729 $('.cart_preview_product .cart-delete a') 1730 .off('click') 1731 .on('click', function(event){ 1732 event.preventDefault(); 1733 var url = $(this).attr('href'); 1734 var parent = $(this).closest('.cart_preview_product'); 1735 1736 parent.addClass('removeThis'); 1737 1738 $.ajax({ 1739 method : "GET", 1740 url : url, 1741 success : function() { 1742 1743 parent.slideUp(300, function(){ 1744 parent.remove(); 1745 1746 if ($('.fixed_panel_wrapper .cart_preview_product').length<1){ 1747 $('.site_shadow3').removeClass('active'); 1748 $('.cart_cleanup_btn').click(); 1749 } 1750 }); 1751 1752 } 1753 }); 1754 1755 data = undefined; 1756 }); 1757 1758 $('.cart_cleanup_btn').click(function(e) { 1759 1760 var $this = $(this), 1761 url = shop2.uri + "?mode=cart&action=cleanup", 1762 data, func; 1763 1764 shop2.trigger('beforeCartClear'); 1765 $.get(shop2.uri + '?mode=cart&action=cleanup', function(d, status) { 1766 shop2.trigger('afterCartClear', d, status); 1767 }); 1768 1769 e.preventDefault(); 1770 1771 $('.site_shadow3').removeClass('active'); 1772 1773 shop2.trigger('afterCartPreviewRemoveItem'); 1774 1775 $.get(url, function(d, status) { 1776 data = $('.cart_bl_wrap', d).html(); 1777 1778 $('#shop2-cart-preview').replaceWith(data); 1779 1780 shop2.fire('afterCartPreviewRemoveItem', func, d, status); 1781 shop2.trigger('afterCartPreviewRemoveItem', d, status); 1782 }); 1783 1784 data = undefined; 1785 1786 return false; 1787 }); 1788 load_cart = true; 1789 if (callback) { 1790 callback(); 1791 } 1792 } 1793 }); 1794 }; 1795 //ajaxCart(); 1796 shop2.on('afterCartPreviewRemoveItem', function() { 1797 load_cart = false; 1798 ajaxCart(); 1799 }); 1800 shop2.on('afterCartAddItem', function() { 1801 load_cart = false; 1802 }); 1803 1804 $.ajaxSetup({complete: function(){ 1805 $('.shop2-block.search-form .block-body .row select').styler(); 1806 $('.shop2-block.search-form .block-body .row input[type="checkbox"]').styler(); 1807 $('.shop2-delivery select').styler(); 1808 $('.shop2-delivery input[type="radio"]').styler(); 1809 $('.shop2-delivery input[type="checkbox"]').styler(); 1810 $('.shop2-delivery .option-type .option-label input[type="radio"]').styler(); 1811 } 1812 }); 1813 1814 shop2.on('afterGetFolderCustomFields', function() { 1815 $('.shop2-block.search-form .block-body .row select').styler(); 1816 $('.shop2-block.search-form .block-body .row input[type="checkbox"]').styler(); 1817 }); 1818 1819 $(document).on('click', '.cart_block.not_empty', function(){ 1820 var $this = $(this), 1821 callback = function(){ 1822 $this.toggleClass('active'); 1823 $this.next().toggleClass('active'); 1824 }; 1825 1826 if (load_cart) { 1827 callback(); 1828 } else { 1829 ajaxCart(callback); 1830 } 1831 1832 }); 1833 $(document).on('click', '.cart_icon', function(){ 1834 $(this).toggleClass('active') 1835 $('.cart_block.not_empty').toggleClass('active'); 1836 $('.cart_items_wr').toggleClass('active'); 1837 $(this).parents('.cart_bl_wrap').toggleClass('active'); 1838 if ($('.cart_block').hasClass('not_empty')) { 1839 $('.site_shadow3').toggleClass('active'); 1840 } 1841 }); 1842 1843 $(document).on('click', '.cart_close', function(){ 1844 $('.cart_block.not_empty').removeClass('active'); 1845 $('.cart_items_wr').removeClass('active'); 1846 $('.cart_bl_wrap').removeClass('active'); 1847 $('.site_shadow3').removeClass('active'); 1848 $('.cart_icon').removeClass('active'); 1849 }); 1850 // Ajax block end 1851 1852 // Resize-controller begin 1853 function resizeController() { 1854 var $win = $(window), 1855 winWidth = $win.width(), 1856 range = [], 1857 func = [], 1858 toggleState = [undefined, undefined]; 1859 1860 if (!!arguments.length) { 1861 for (var i = 0; i <= arguments.length-1; i++) { 1862 1863 if ($.isArray(arguments[i])) { 1864 range = arguments[i]; 1865 } else if ($.isNumeric(arguments[i])) { 1866 range.push(arguments[i]); 1867 } else if ($.isFunction(arguments[i])) { 1868 func.push(arguments[i]); 1869 } 1870 }; 1871 } 1872 1873 $win.resize(function(event) { 1874 winWidth = $win.width(); 1875 1876 if (range.length > 1) { 1877 if (winWidth >= range[0] && winWidth <= range[range.length-1] && typeof toggleState[0] === "undefined") { 1878 func[0](); 1879 toggleState[0] = true; 1880 toggleState[1] = undefined; 1881 } else if ((winWidth < range[0] || winWidth > range[range.length-1]) && typeof toggleState[1] === "undefined") { 1882 toggleState[0] = undefined; 1883 toggleState[1] = true; 1884 1885 if ($.isFunction(func[1])) { 1886 func[1](); 1887 } 1888 } 1889 } else if (range.length == 1) { 1890 if (winWidth <= range[0] && typeof toggleState[0] === "undefined") { 1891 func[0](); 1892 toggleState[0] = true; 1893 toggleState[1] = undefined; 1894 } else if (winWidth > range[0] && typeof toggleState[1] === "undefined") { 1895 toggleState[0] = undefined; 1896 toggleState[1] = true; 1897 1898 if ($.isFunction(func[1])) { 1899 func[1](); 1900 } 1901 } 1902 } 1903 }).trigger('resize'); 1904 }; 1905 // Resize-controller end 1906 1907 $('body').on('click', '.s3solution-themes-list__item', function(){ 1908 setTimeout(function(){ 1909 $win.resize(); 1910 }, 800); 1911 }); 1912 1913 shop2.on('afterGetFolderCustomFields', function() { 1914 $win.resize() 1915 .scroll(); 1916 }); 1917 1918 $('html').css('visibility', 'visible'); 1919}); 1920if (shop2.my.fix_folder_shared_count) { 1921 /*id1552*/ 1922 $(function() { 1923 $('.main_folders li').each(function() { 1924 var $this = $(this); 1925 var fld_id = $this.data('folder-id'); 1926 var $strong = $this.find('ins'); 1927 1928 $('.shop-folders li').each(function() { 1929 var fld_id2 = $(this).data('folder-id'); 1930 1931 if (fld_id == fld_id2 && +$(this).data('items') == 0) { 1932 1933 var sum = 0; 1934 1935 $(this).find('li').each(function() { 1936 var items = +$(this).data('items'); 1937 1938 return sum += items; 1939 }); 1940 1941 $strong.text('('+sum+')'); 1942 } 1943 }); 1944 }); 1945 }); 1946} 1947(function() { 1948 function coords(str) { 1949 return str.split(','); 1950 } 1951 function init(options) { 1952 options.center = coords(options.center); 1953 $.each(options.data, function(key, item) { 1954 item.coords = coords(item.coords); 1955 }); 1956 if (options.type == 1) { 1957 google.maps.event.addDomListener(window, 'load', function() { 1958 var map = new google.maps.Map(document.getElementById(options.id), { 1959 zoom: my_map_zoom, 1960 scrollwheel: false, 1961 center: new google.maps.LatLng(options.center[0], options.center[1]) 1962 }); 1963 var styles1 = map_style; 1964 map.setOptions({styles: styles1}); 1965 $.each(options.data, function(key, item) { 1966 var marker = new google.maps.Marker({ 1967 position: new google.maps.LatLng(item.coords[0], item.coords[1]), 1968 map: map, 1969 title: item.name, 1970 icon: marker_icon 1971 }); 1972 var infowindow = new google.maps.InfoWindow({ 1973 content: '<div class="baloon-content">' + 1974 '<h3 style="margin: 0; padding-bottom: 3px;">' + item.name + '</h3>' + 1975 item.desc + 1976 '</div>' 1977 }); 1978 google.maps.event.addListener(marker, 'click', function() { 1979 infowindow.open(map, marker); 1980 }); 1981 }); 1982 }); 1983 } else { 1984 ymaps.ready(function() { 1985 var map = new ymaps.Map(options.id, { 1986 center: options.center, 1987 zoom: options.zoom, 1988 behaviors: ['drag', 'rightMouseButtonMagnifier'], 1989 }); 1990 map.controls.add( 1991 new ymaps.control.ZoomControl() 1992 ); 1993 var MyBalloonContentLayoutClass = ymaps.templateLayoutFactory.createClass( 1994 '<div class="baloon-content" style="padding: 0 10px;">' + 1995 '<h3 style="margin: 0;">$[properties.name]</h3>' + 1996 '$[properties.desc]' + 1997 '</div>' 1998 ); 1999 var myCollection = new ymaps.GeoObjectCollection(); 2000 $.each(options.data, function(key, item) { 2001 myCollection.add(new ymaps.Placemark( 2002 item.coords, 2003 item, 2004 {balloonContentLayout: MyBalloonContentLayoutClass} 2005 )); 2006 }); 2007 map.geoObjects.add(myCollection); 2008 }); 2009 } 2010 } 2011 window.mjsMap = init; 2012})();
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.