1var $loading_text = '<i class="fad fa-spinner-third fa-spin" style="margin: 0 !important;"></i>', 2 $animate_speed = 300, 3 $notification_element = $('#notification'); 4 5var add_to_cart_data; 6 7$(function () { 8 // prepÃnanie jazykov v hlaviÄke 9 if ($('#language', 'header').length) 10 { 11 $('.language-select', '#language').click(function () { 12 var $code = $(this).attr('name'); 13 14 $('input[name="code"]', '#language').val($code).parents('form').submit(); 15 }); 16 } 17 18 // slideshow na úvodnej stránke 19 if ($('.module-slideshow').length) 20 { 21 $('.slick-slideshow', '.module-slideshow').slick({ 22 infinite: true, 23 slidesToShow: 1, 24 arrows: false, 25 dots: true, 26 autoplay: true, 27 autoplay: true, 28 autoplaySpeed: 4000 29 }); 30 } 31 32 // slick pre produkty 33 if ($('.slick-product').length) 34 { 35 $('.slick-product').slick({ 36 infinite: true, 37 slidesToShow: 4, 38 arrows: true, 39 dots: false, 40 prevArrow: '<button type="button" class="slick-prev"><i class="fal fa-chevron-left"></i></button>', 41 nextArrow: '<button type="button" class="slick-next"><i class="fal fa-chevron-right"></i></button>', 42 responsive: [ 43 { 44 breakpoint: 991, 45 settings: { 46 slidesToShow: 3 47 } 48 }, 49 { 50 breakpoint: 767, 51 settings: { 52 slidesToShow: 2 53 } 54 }, 55 { 56 breakpoint: 575, 57 settings: { 58 slidesToShow: 1 59 } 60 } 61 ] 62 }); 63 } 64 65 // newsletter modul 66 if ($('.module-newsletter').length) 67 { 68 $('.close', '.module-newsletter').click(function () { 69 var CookieDate = new Date; 70 CookieDate.setFullYear(CookieDate.getFullYear() +10); 71 72 $('.module-newsletter').slideUp(300, function () { 73 $(this).remove(); 74 }); 75 76 document.cookie = 'newsletterbar=1; expires=' + CookieDate.toUTCString() + ';'; 77 }); 78 79 $('form#form-newsletter', '.module-newsletter').submit(function () { 80 var $form = $(this), 81 $btn = $('button[type="submit"]', $form); 82 83 $.ajax({
84 url: $form.attr('action'), 85 data: $form.serialize(), 86 beforeSend: function () { 87 $btn.width($btn.width()).data('original-text', $btn.html()).html($loading_text).prop('disabled', true); 88 }, 89 method: 'POST', 90 dataType: 'JSON' 91 }).done(function (json) { 92 var html = ''; 93 94 $('.alert', '.module-newsletter').remove(); 95 96 $btn.html($btn.data('original-text')).prop('disabled', false); 97 98 if (json.error) 99 { 100 html += '<div class="alert alert-danger">' + json.error + '</div>'; 101 } else if (json.success) 102 { 103 html += '<div class="alert alert-success">' + json.success + '</div>'; 104 } 105 106 $('.module-newsletter > .container').prepend(html); 107 }); 108 109 return false; 110 }); 111 } 112 113 // galéria ostatných obrázkov na detailovej stránke produktu 114 if ($('.slick-gallery').length) 115 { 116 $('.slick-gallery').slick({ 117 infinite: true, 118 slidesToShow: 3, 119 arrows: false, 120 dots: true 121 }); 122 } 123 124 // carousel obrázok na blogu 125 if ($('.slick-blog').length) 126 { 127 $('.slick-blog').slick({ 128 infinite: true, 129 slidesToShow: 6, 130 slidesToScroll: 1, 131 prevArrow:"<button type='button' class='slick-prev pull-left'><i class='fal fa-chevron-left' aria-hidden='true'></i></button>", 132 nextArrow:"<button type='button' class='slick-next pull-right'><i class='fal fa-chevron-right' aria-hidden='true'></i></button>", 133 responsive: [ 134 { 135 breakpoint: 1199, 136 settings: { 137 slidesToShow: 5 138 } 139 }, 140 { 141 breakpoint: 991, 142 settings: { 143 slidesToShow: 4 144 } 145 }, 146 { 147 breakpoint: 767, 148 settings: { 149 slidesToShow: 3 150 } 151 }, 152 { 153 breakpoint: 575, 154 settings: { 155 slidesToShow: 2 156 } 157 } 158 ] 159 }); 160 } 161 162 // vyhľadávanie odoslanie po stlaÄenà tlaÄidla "enter" 163 $('input', '#search').keydown(function (e) { 164 if (e.which == 13) 165 { 166 $(this).parent().find('.btn-search').trigger('click'); 167 } 168 }); 169 170 // po kliknutàna tlaÄÃÂtko vyhľadávania v hlaviÄke je treba vykonaÅ¥ presmerovanie na stránku hľadania 171 $('.btn-search', '#search').click(function () { 172 var $search = $('input[name="search"]', '#search').val(); 173 174 if ($search == '') 175 { 176 $('input[name="search"]', '#search').focus(); 177 } else { 178 window.location = 'index.php?route=product/search&search=' + $search; 179 } 180 }); 181 182 // quantity picker input aby mal len ÄÃselnú hodnotu 183 $('input', '.item-quantity-picker').change(function () { 184 var value = $(this).val(), 185 minimum = $(this).data('minimum'), 186 intValue = parseInt(value); 187 188 if (value != intValue) 189 { 190 $(this).val(minimum); 191 } else { 192 var number = (value / minimum); 193 194 if (!Number.isInteger(number)) 195 { 196 $(this).val(minimum); 197 } 198 } 199 }); 200 201 // quantity picker tlaÄÃtka +/- 202 $('.btn', '.item-quantity-picker').click(function () { 203 var element = $(this).parents('.item-quantity-picker').find('input'), 204 minimum = parseInt(element.data('minimum')), 205 quantity = parseInt(element.val()); 206 207 if ($(this).hasClass('btn-increase')) 208 { 209 quantity = quantity + minimum; 210 } else if ($(this).hasClass('btn-decrease') && quantity > minimum) 211 { 212 quantity = quantity - minimum; 213 } 214 215 element.val(quantity).trigger('change'); 216 }); 217 218 // pekné "selecty" 219 $('body').on('click', '.dropdown.-fake_select .dropdown-item', function () { 220 var $parent = $(this).parents('.dropdown'), 221 $text = $(this).html(), 222 $value = $(this).data('value'); 223 224 $(this).addClass('active').siblings().removeClass('active'); 225 226 $('.btn-dropdown', $parent).html($text); 227 $('input[type="hidden"]', $parent).val($value).trigger('change'); 228 });
229 230 // zoradenie custom fields, ak sú nejaké na zoradenie 231 if ($('.form-group[data-sort]').length) 232 { 233 $('.form-group[data-sort]').detach().each(function() { 234 if ($(this).attr('data-sort') >= 0 && $(this).attr('data-sort') <= $('.form-group').length-2) { 235 $('.form-group').eq(parseInt($(this).attr('data-sort'))+2).before(this); 236 } 237 238 if ($(this).attr('data-sort') > $('.form-group').length-2) { 239 $('.form-group:last').after(this); 240 } 241 242 if ($(this).attr('data-sort') == $('.form-group').length-2) { 243 $('.form-group:last').after(this); 244 } 245 246 if ($(this).attr('data-sort') < -$('.form-group').length-2) { 247 $('.form-group:first').before(this); 248 } 249 }); 250 } 251 252 // options na detaile produktu 253 $('body').on('change', 'input[name^="option"]', function () { 254 var $value = parseInt($(this).val()), 255 $element = $(this).prev().children('a[data-value="' + $value + '"]'), 256 $product = $('#product'), 257 $model = $element.data('model'), 258 $price = $element.data('price'), 259 $special = $element.data('special'), 260 $tax = $element.data('tax'), 261 $stock_status = $element.data('stock_status'), 262 $stock_status_color = $element.data('stock_status_color'), 263 $reward = $element.data('reward'), 264 $delivery_text = $element.data('delivery_text'), 265 $price_mj = $element.data('price_mj'), 266 $price_mj_unit = $element.data('price_mj_unit'); 267 268 $('[data-value="model"]', $product).text($model); 269 $('[data-value="reward"]', $product).text($reward); 270 $('[data-value="price"]', $product).html($price); 271 $('[data-value="tax"]', $product).html($tax); 272 $('[data-value="special"]', $product).html($special); 273 $('[data-value="stock"]', $product).html('<i class="fas fa-warehouse"></i>' + $stock_status).css({ color: $stock_status_color }); 274 $('[data-value="delivery"]', $product).html('<i class="fas fa-history"></i>' + $delivery_text); 275 276 if ($price_mj && $price_mj_unit) 277 { 278 $('[data-value="price_mj"]', $product).show().html($price_mj + '/' + $price_mj_unit); 279 } else { 280 $('[data-value="price_mj"]', $product).hide(); 281 } 282 }); 283 284 // pridanie produktu do koÅ¡Ãka z výpisu 285 $('body').on('click', '.module-product_listing .item-product .btn-cart, .module-bestseller .item-bestseller .btn-cart', function () { 286 var $btn = $(this), 287 $product_id = parseInt($btn.data('product_id')), 288 $quantity = 1; 289 290 $.ajax({
291 url: 'index.php?route=checkout/cart/add', 292 data: { 293 product_id: $product_id, 294 quantity: $quantity 295 }, 296 method: 'POST', 297 dataType: 'JSON', 298 beforeSend: function () { 299 $btn.width($btn.width()).data('original-text', $btn.html()).html($loading_text).prop('disabled', true); 300 } 301 }).done(function (json) { 302 if (json['error']) 303 { 304 window.location = $btn.attr('href'); 305 } else if (json['success']) 306 { 307 $('#cart-total', '#cart').html(json['total']); 308 309 $btn.html(text_added + '<i class="far fa-check"></i>').addClass('btn-success'); 310 311 setTimeout(function () { 312 $btn.html($btn.data('original-text')).prop('disabled', false).width('').removeClass('btn-success'); 313 }, 4000); 314 315 if (json.out_of_stock) 316 { 317 html = '<div class="modal fade" id="outOfStockModal" tabindex="-1" role="dialog" aria-hidden="true">'; 318 html += ' <div class="modal-dialog modal-dialog-centered" role="document">'; 319 html += ' <div class="modal-content">'; 320 html += ' <div class="modal-header">'; 321 html += ' <h5 class="modal-title" id="exampleModalLabel">' + json.text_oos_title + '</h5>'; 322 html += ' <button type="button" class="close" data-dismiss="modal">'; 323 html += ' <span aria-hidden="true">×</span>'; 324 html += ' </button>'; 325 html += ' </div>'; 326 html += ' <div class="modal-body">'; 327 html += ' <div class="alert alert-info" style="margin-bottom: 17px;">' + json.text_oos_alert + '</div>'; 328 html += ' <p>' + json.text_oos_text + '<br /><br /><strong>' + json.text_oos_text3 + '</strong></p>'; 329 html += ' </div>'; 330 html += ' <div class="modal-footer">'; 331 html += ' <div class="row">'; 332 html += ' <div class="col-12 col-md-6">'; 333 html += ' <button type="button" class="btn btn-primary btn-block btn-success_cart" data-dismiss="modal">' + json.text_oos_back2 + '</button>'; 334 html += ' </div>'; 335 html += ' <div class="col-12 col-md-6">'; 336 html += ' <a href="' + json.href + '" class="btn btn-success btn-block btn-success_cart">' + json.text_oos_cart + '</a>'; 337 html += ' </div>'; 338 html += ' </div>'; 339 html += ' </div>'; 340 html += ' </div>'; 341 html += ' </div>'; 342 html += '</div>'; 343 344 $('body').append(html); 345 346 $('#outOfStockModal').modal('show'); 347 348 $('#outOfStockModal').on('hidden.bs.modal', function () { 349 $(this).remove(); 350 }); 351 } 352 353 window.dataLayer = window.dataLayer || []; 354 355 /*window.dataLayer.push({ 356 event: 'eec.add', 357 ecommerce: { 358 add: { 359 actionField: { 360 list: 'shopping-cart' 361 }, 362 products: [{ 363 id: json['product_id'], 364 name: json['product_name'], 365 quantity: json['product_quantity'] 366 }] 367 } 368 } 369 });*/ 370 371 /*if (json['add_to_cart_data']) 372 { 373 add_to_cart_data = json['add_to_cart_data']; 374 375 gtag("event", "add_to_cart", json['add_to_cart_data']); 376 }*/ 377 378 if (json['custom_analytics_code']) 379 { 380 eval(json['custom_analytics_code']); 381 } 382 383 if (json['datalayer_code']) 384 { 385 eval(json['datalayer_code']); 386 } 387 } 388 }); 389 390 return false; 391 });
392 393 // naÄÃtanie pagination tlaÄÃtkom 394 $('body').on('click', '#btn-pagination-load_more', function () { 395 var $btn = $(this), 396 $pagination_url = $('li.active', '.module-pagination').next().find('a').attr('href'); 397 398 $.ajax({ 399 url: $pagination_url, 400 beforeSend: function () { 401 $btn.width($btn.width()).data('original-text', $btn.html()).html($loading_text).prop('disabled', true); 402 } 403 }).done(function (html) { 404 var $html = $(html).find('.row.row-product').children(), 405 $pagination = $(html).find('.module-pagination'); 406 407 // prvému produktu z nového zoznamu produktov pridáme CSS triedu aby sme naÅho vedeli zascrollovaÅ¥ 408 $html.eq(0).addClass('scroll-here'); 409 410 // do zoznamu produktov pridáme nové produkty z ÄalÅ¡ej stránky 411 $html.appendTo('.row.row-product', '.module-product_listing'); 412 413 // zascrollujeme na produkt, ktorý sme si predtým urÄili ako prvý z nového zoznamu 414 $('html, body').animate({ 415 scrollTop: $('.scroll-here', '.module-product_listing').offset().top 416 }, $animate_speed, function () { 417 $('.scroll-here', '.module-product_listing').removeClass('scroll-here') 418 }); 419 420 // stránkovanie nahradÃme novým stránkovanÃm 421 $('.module-pagination').replaceWith($pagination); 422 423 // spracujeme datalayer z hlaviÄky 424 regex = new RegExp(/<script.*?id="code-dataLayer".*?>(.+?)<\/script>/gi); 425 426 matches = html.match(regex); 427 428 for (i in matches) 429 { 430 parts = regex.exec(matches[i]); 431 432 eval(parts[1]); 433 } 434 }); 435 }); 436 437 // tlaÄÃtko pridania tovaru do koÅ¡Ãka 438 $('#button-cart').click(function () { 439 var $btn = $(this), 440 $product = $('#product'); 441 442 $.ajax({
443 url: 'index.php?route=checkout/cart/add', 444 data: $('input', $product), 445 method: 'POST', 446 dataType: 'JSON', 447 beforeSend: function () { 448 $btn.width($btn.width()).data('original-text', $btn.html()).html($loading_text).prop('disabled', true); 449 } 450 }).done(function (json) { 451 $btn.html($btn.data('original-text')).prop('disabled', false); 452 453 $('.alert-dismissible, .text-danger', $product).remove(); 454 455 if (json['error']) 456 { 457 if (json['error']['option']) 458 { 459 for (i in json['error']['option']) 460 { 461 var element = $('#input-option' + i.replace('_', '-')); 462 463 element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>'); 464 } 465 } 466 } 467 468 if (json['success']) 469 { 470 $('#cart-total', '#cart').html(json['total']); 471 472 if (json.out_of_stock) 473 { 474 html = '<div class="modal fade" id="outOfStockModal" tabindex="-1" role="dialog" aria-hidden="true">'; 475 html += ' <div class="modal-dialog modal-dialog-centered" role="document">'; 476 html += ' <div class="modal-content">'; 477 html += ' <div class="modal-header">'; 478 html += ' <h5 class="modal-title" id="exampleModalLabel">' + json.text_oos_title + '</h5>'; 479 html += ' <button type="button" class="close" data-dismiss="modal">'; 480 html += ' <span aria-hidden="true">×</span>'; 481 html += ' </button>'; 482 html += ' </div>'; 483 html += ' <div class="modal-body">'; 484 html += ' <div class="alert alert-info" style="margin-bottom: 17px;">' + json.text_oos_alert + '</div>'; 485 html += ' <p>' + json.text_oos_text + '<br /><br /><strong>' + json.text_oos_text3 + '</strong></p>'; 486 html += ' </div>'; 487 html += ' <div class="modal-footer">'; 488 html += ' <div class="row">'; 489 html += ' <div class="col-12 col-md-6">'; 490 html += ' <button type="button" class="btn btn-primary btn-block btn-success_cart" data-dismiss="modal">' + json.text_oos_back + '</button>'; 491 html += ' </div>'; 492 html += ' <div class="col-12 col-md-6">'; 493 html += ' <a href="' + json.href + '" class="btn btn-success btn-block btn-success_cart">' + json.text_oos_cart + '</a>'; 494 html += ' </div>'; 495 html += ' </div>'; 496 html += ' </div>'; 497 html += ' </div>'; 498 html += ' </div>'; 499 html += '</div>'; 500 501 $('body').append(html); 502 503 $('#outOfStockModal').modal('show'); 504 505 $('#outOfStockModal').on('hidden.bs.modal', function () { 506 $(this).remove(); 507 }); 508 } else { 509 $notification_element.html('<div class="alert alert-success"><div class="row align-items-center"><div class="col">' + json['success'] + '</div><div class="col-auto"><a href="' + json['href'] + '" class="btn btn-primary btn-success_cart">' + json['button_cart'] + '</a></div></div></div>'); 510 511 $('html, body').animate({ scrollTop: $notification_element.offset().top }, $animate_speed); 512 } 513 514 window.dataLayer = window.dataLayer || []; 515 516 /*window.dataLayer.push({ 517 event: 'eec.add', 518 ecommerce: { 519 add: { 520 actionField: { 521 list: 'shopping-cart' 522 }, 523 products: [{ 524 id: json['product_id'], 525 name: json['product_name'], 526 quantity: json['product_quantity'] 527 }] 528 } 529 } 530 });*/ 531 532 /*if (json['add_to_cart_data']) 533 { 534 add_to_cart_data = json['add_to_cart_data']; 535 536 gtag("event", "add_to_cart", json['add_to_cart_data']); 537 }*/ 538 539 if (json['custom_analytics_code']) 540 { 541 eval(json['custom_analytics_code']); 542 } 543 544 if (json['datalayer_code']) 545 { 546 eval(json['datalayer_code']); 547 } 548 } 549 }); 550 });
551 552 // nová otázka k produktu 553 $('form#collapseQuestionForm').submit(function () { 554 var $form = $(this), 555 $btn = $('button[type="submit"]', $form); 556 557 $.ajax({ 558 url: $form.attr('action'), 559 data: $form.serialize(), 560 method: 'POST', 561 dataType: 'JSON', 562 beforeSend: function () { 563 $btn.width($btn.width()).data('original-text', $btn.html()).html($loading_text).prop('disabled', true); 564 } 565 }).done(function (json) { 566 $('.has-error', $form).removeClass('has-error'); 567 568 if (json['success']) 569 { 570 $form.replaceWith($('<div class="alert alert-success">' + json['success'] + '</div>')); 571 } else { 572 $btn.html($btn.data('original-text')).prop('disabled', false); 573 574 if (json['error_text']) 575 { 576 $('textarea[name="text"]', $form).parents('.form-group').addClass('has-error'); 577 } 578 579 if (json['error_email']) 580 { 581 $('input[name="email"]', $form).parents('.form-group').addClass('has-error'); 582 } 583 } 584 }); 585 586 return false; 587 }); 588 589 // tooltipy 590 $('[data-toggle="tooltip"]').tooltip(); 591 592 // responzÃvne menu v hlaviÄke 593 $('#btn-header_menu', 'header').click(function () { 594 $(this).toggleClass('-clicked').next().slideToggle(300); 595 }); 596 597 // responzÃvny modul kategórià (kategórie eshopu, kategórie blogu a kategórie úÄtu) 598 $('#btn-category', '.module-category').click(function () { 599 $(this).next().slideToggle(300); 600 }); 601 602 // responzÃvny modul filtrácie 603 $('#btn-filter', '.module-filter').click(function () { 604 $(this).toggleClass('-clicked').next().slideToggle(300); 605 }); 606 607 // cookie bar 608 $('.cookie .btn').click(function() { 609 var CookieDate = new Date; 610 CookieDate.setFullYear(CookieDate.getFullYear() +10); 611 612 $('.cookie').fadeOut(); 613 614 document.cookie = 'cookiebar=1; expires=' + CookieDate.toUTCString() + ';'; 615 616 return false; 617 }); 618 619 // automatické otvorenie tabu s poradÅou 620 if (window.location.hash) 621 { 622 var hash = window.location.hash.substring(1); 623 624 if (hash == 'show-tab-disquss' && $('#tab-disquss').length) 625 { 626 $('a[href="#tab-disquss"]').tab('show'); 627 628 $('body, html').animate({ 629 scrollTop: $('a[href="#tab-disquss"]').offset().top 630 }, $animate_speed); 631 } 632 } 633 634 $('input[name*="custom_field"][name*="[3]"], input[name="personal_confirm[set_company_vat_pay]"]').change(function () { 635 var $this = $(this), 636 $modal = $('#dph0Modal'); 637 638 if ($modal.length && $this.is(':checked')) 639 { 640 $modal.modal('show'); 641 } 642 }); 643}); 644 645var onProductQuestionSubmit = function(response) { 646 $('#collapseQuestionForm').submit(); 647}; 648 649/* 650** MEGAMENU 651*/ 652 653$(function () { 654 $('li.-with-submenu', 'header').hover(function () { 655 $('header').addClass('show-body-overlay'); 656 }, function () { 657 $('header').removeClass('show-body-overlay'); 658 }); 659 660 $('#menuToggle', 'header').click(function () { 661 $('body').toggleClass('menuToggled'); 662 663 $('#menu', 'header').slideToggle($animate_speed); 664 }); 665 666 $('.-expand', 'header #menu').click(function () { 667 $(this).toggleClass('-expanded').parent().next().slideToggle($animate_speed); 668 669 return false; 670 }); 671});
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.