1$(document).ready(function() { 2 // Wrap selects 3 $("select").wrap("<div class='select'></div>"); 4 5 // Filter box 6 $(".mfilter-box").addClass("box-no-advanced"); 7 8 // Highlight any found errors 9 $('.text-danger').each(function() { 10 var element = $(this).parent().parent(); 11 12 if (element.hasClass('form-group')) { 13 element.addClass('has-error'); 14 } 15 }); 16 17 if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && responsive_design == 'yes' && $(window).width() < 768) { 18 var i = 0; 19 var produkty = []; 20 21 $( ".box-product .carousel .item" ).each(function() { 22 $( this ).find( ".product-grid .row > div" ).each(function() { 23 if(i > 1) { 24 produkty.push($(this).html()); 25 } 26 27 i++; 28 }); 29 for ( var s = i-3; s >= 0; s--, s-- ) { 30 var html = "<div class='item'><div class='product-grid'><div class='row'>"; 31 if (produkty[s-1] != undefined) { 32 html += "<div class='col-xs-6'>" + produkty[s-1] + "</div>"; 33 } else { 34 html += "<div class='col-xs-6'>" + produkty[s+1] + "</div>"; 35 } 36 37 if (produkty[s] != undefined) { 38 html += "<div class='col-xs-6'>" + produkty[s] + "</div>"; 39 } else { 40 html += "<div class='col-xs-6'>" + produkty[s+1] + "</div>"; 41 } 42 html += "</div></div></div>"; 43 44 $( this ).after( html ); 45 } 46 47 produkty = []; 48 i = 0; 49 }); 50 } 51 52 /* Search */ 53 $('.button-search, .header-type-3 #top .search_form, .header-type-8 .search_form').bind('click', function() { 54 url = $('base').attr('href') + 'index.php?route=product/search'; 55 56 var search = $('header input[name=\'search\']').val(); 57 58 if (search) { 59 url += '&search=' + encodeURIComponent(search); 60 } 61 62 var category_id = $('header select[name=\'category_id\']').val(); 63 64 if (category_id) { 65 url += '&category_id=' + encodeURIComponent(category_id); 66 } 67 68 location = url; 69 }); 70 71 $('header input[name=\'search\']').bind('keydown', function(e) { 72 if (e.keyCode == 13) { 73 url = $('base').attr('href') + 'index.php?route=product/search'; 74 75 var search = $('header input[name=\'search\']').val(); 76 77 if (search) { 78 url += '&search=' + encodeURIComponent(search); 79 } 80 81 location = url; 82 } 83 }); 84 85 $(window).scroll(function(){ 86 if ($(this).scrollTop() > 300) { 87 $('.scrollup').fadeIn(); 88 } else { 89 $('.scrollup').fadeOut(); 90 } 91 }); 92 93 $('.scrollup').click(function(){ 94 $("html, body").animate({ scrollTop: 0 }, 600); 95 return false; 96 }); 97 98 /* Search MegaMenu */ 99 $('#top .button-search2').bind('click', function() { 100 url = $('base').attr('href') + 'index.php?route=product/search'; 101 102 var search = $('input[name=\'search2\']').val(); 103 104 if (search) { 105 url += '&search=' + encodeURIComponent(search); 106 } 107 108 location = url; 109 }); 110 111 $('input[name=\'search2\']').bind('keydown', function(e) { 112 if (e.keyCode == 13) { 113 url = $('base').attr('href') + 'index.php?route=product/search'; 114 115 var search = $('input[name=\'search2\']').val(); 116 117 if (search) { 118 url += '&search=' + encodeURIComponent(search); 119 } 120 121 location = url; 122 } 123 }); 124 125 $('#top .button-search3').bind('click', function() { 126 url = $('base').attr('href') + 'index.php?route=product/search'; 127 128 var search = $('input[name=\'search3\']').val(); 129 130 if (search) { 131 url += '&search=' + encodeURIComponent(search); 132 } 133 134 location = url; 135 }); 136 137 $('input[name=\'search3\']').bind('keydown', function(e) { 138 if (e.keyCode == 13) { 139 url = $('base').attr('href') + 'index.php?route=product/search'; 140 141 var search = $('input[name=\'search3\']').val(); 142 143 if (search) { 144 url += '&search=' + encodeURIComponent(search); 145 } 146 147 location = url; 148 } 149 }); 150 151 // tooltips on hover 152 $('[data-toggle=\'tooltip\']').tooltip({container: 'body'}); 153 154 // Makes tooltips work on ajax generated content 155 $(document).ajaxStop(function() { 156 $('[data-toggle=\'tooltip\']').tooltip({container: 'body'}); 157 }); 158 159 // Mobile categories 160 $('.box-with-categories .box-heading').on('click', function () { 161 if($(this).parent().hasClass("active")) { 162 $(this).parent().removeClass("active"); 163 } else { 164 $(this).parent().addClass("active"); 165 } 166 return false;
167 }); 168 169 // Mobile vertical megamenu 170 $('.vertical #menuHeading').on('click', function () { 171 if($(this).parent().hasClass("active")) { 172 $(this).parent().removeClass("active"); 173 } else { 174 $(this).parent().addClass("active"); 175 } 176 }); 177 178 FixedTop(); 179}); 180 181$(window).resize(function() { 182 FixedTop(); 183}); 184 185$(window).scroll(function() { 186 FixedTop(); 187}); 188 189function FixedTop() { 190 var width = $('header #top').width(); 191 var width3 = $('header #top .background').width(); 192 var width2 = $('header').width(); 193 if(width3 != width2) { 194 $('.sticky-header').css("background", "none"); 195 } 196 $('.sticky-header').css("width", width).css("left", "50%").css("right", "auto").css("margin-left", "-" + Math.ceil(width/2) + "px").css("margin-right", "-" + Math.ceil(width/2) + "px"); 197 198 if($(window).width() >= 1160 && $(window).scrollTop() > 280) { 199 $('.sticky-header').addClass('fixed-header'); 200 } else { 201 $('.sticky-header').removeClass('fixed-header'); 202 } 203} 204 205function getURLVar(key) { 206 var value = []; 207 208 var query = String(document.location).split('?'); 209 210 if (query[1]) { 211 var part = query[1].split('&'); 212 213 for (i = 0; i < part.length; i++) { 214 var data = part[i].split('='); 215 216 if (data[0] && data[1]) { 217 value[data[0]] = data[1]; 218 } 219 } 220 221 if (value[key]) { 222 return value[key]; 223 } else { 224 return ''; 225 } 226 } 227} 228 229// Cart add remove functions 230var cart = { 231 'add': function(product_id, quantity) { 232 $.ajax({ 233 url: 'index.php?route=checkout/cart/add', 234 type: 'post', 235 data: 'product_id=' + product_id + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1), 236 dataType: 'json', 237 success: function(json) { 238 if (json['redirect']) { 239 location = json['redirect']; 240 } 241 242 if (json['success']) { 243 $.notify({ 244 message: json['success'], 245 target: '_blank' 246 },{ 247 // settings 248 element: 'body', 249 position: null, 250 type: "info", 251 allow_dismiss: true, 252 newest_on_top: false, 253 placement: { 254 from: "top", 255 align: "right" 256 }, 257 offset: 20, 258 spacing: 10, 259 z_index: 2031, 260 delay: 5000, 261 timer: 1000, 262 url_target: '_blank', 263 mouse_over: null, 264 animate: { 265 enter: 'animated fadeInDown', 266 exit: 'animated fadeOutUp' 267 }, 268 onShow: null, 269 onShown: null, 270 onClose: null, 271 onClosed: null, 272 icon_type: 'class', 273 template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-success" role="alert">' + 274 '<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×Â</button>' + 275 '<span data-notify="message"><i class="fa fa-check-circle"></i> {2}</span>' + 276 '<div class="progress" data-notify="progressbar">' + 277 '<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' + 278 '</div>' + 279 '<a href="{3}" target="{4}" data-notify="url"></a>' + 280 '</div>' 281 }); 282 283 $('#cart_block #cart_content').load('index.php?route=common/cart/info #cart_content_ajax'); 284 $('#cart_block #total_price_ajax').load('index.php?route=common/cart/info #total_price'); 285 $('#cart_block .cart-count').load('index.php?route=common/cart/info #total_count_ajax'); 286 } 287 } 288 }); 289 }, 290 'update': function(key, quantity) { 291 $.ajax({ 292 url: 'index.php?route=checkout/cart/edit', 293 type: 'post', 294 data: 'key=' + key + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1), 295 dataType: 'json', 296 success: function(json) { 297 if (getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') { 298 location = 'index.php?route=checkout/cart'; 299 } else { 300 $('#cart_block #cart_content').load('index.php?route=common/cart/info #cart_content_ajax'); 301 $('#cart_block #total_price_ajax').load('index.php?route=common/cart/info #total_price'); 302 $('#cart_block .cart-count').load('index.php?route=common/cart/info #total_count_ajax'); 303 } 304 } 305 }); 306 }, 307 'remove': function(key) { 308 $.ajax({ 309 url: 'index.php?route=checkout/cart/remove', 310 type: 'post', 311 data: 'key=' + key, 312 dataType: 'json', 313 success: function(json) { 314 if (getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') { 315 location = 'index.php?route=checkout/cart'; 316 } else { 317 $('#cart_block #cart_content').load('index.php?route=common/cart/info #cart_content_ajax'); 318 $('#cart_block #total_price_ajax').load('index.php?route=common/cart/info #total_price'); 319 $('#cart_block .cart-count').load('index.php?route=common/cart/info #total_count_ajax'); 320 } 321 } 322 }); 323 } 324} 325 326var voucher = { 327 'add': function() { 328 329 }, 330 'remove': function(key) { 331 $.ajax({ 332 url: 'index.php?route=checkout/cart/remove', 333 type: 'post', 334 data: 'key=' + key, 335 dataType: 'json', 336 beforeSend: function() { 337 $('#cart > button').button('loading'); 338 }, 339 complete: function() { 340 $('#cart > button').button('reset'); 341 }, 342 success: function(json) { 343 if (getURLVar('route') == 'checkout/cart' || getURLVar('route') == 'checkout/checkout') { 344 location = 'index.php?route=checkout/cart'; 345 } else { 346 $('#cart_block #cart_content').load('index.php?route=common/cart/info #cart_content_ajax'); 347 $('#cart_block #total_price_ajax').load('index.php?route=common/cart/info #total_price'); 348 $('#cart_block .cart-count').load('index.php?route=common/cart/info #total_count_ajax'); 349 } 350 } 351 }); 352 } 353} 354 355var wishlist = { 356 'add': function(product_id) { 357 $.ajax({ 358 url: 'index.php?route=account/wishlist/add', 359 type: 'post', 360 data: 'product_id=' + product_id, 361 dataType: 'json', 362 success: function(json) { 363 if (json['success']) { 364 $.notify({ 365 message: json['success'], 366 target: '_blank' 367 },{ 368 // settings 369 element: 'body', 370 position: null, 371 type: "info", 372 allow_dismiss: true, 373 newest_on_top: false, 374 placement: { 375 from: "top", 376 align: "right" 377 }, 378 offset: 20, 379 spacing: 10, 380 z_index: 2031, 381 delay: 5000, 382 timer: 1000, 383 url_target: '_blank', 384 mouse_over: null, 385 animate: { 386 enter: 'animated fadeInDown', 387 exit: 'animated fadeOutUp' 388 }, 389 onShow: null, 390 onShown: null, 391 onClose: null, 392 onClosed: null, 393 icon_type: 'class', 394 template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-success" role="alert">
394' + 395 '<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×Â</button>' + 396 '<span data-notify="message"><i class="fa fa-check-circle"></i> {2}</span>' + 397 '<div class="progress" data-notify="progressbar">' + 398 '<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' + 399 '</div>' + 400 '<a href="{3}" target="{4}" data-notify="url"></a>' + 401 '</div>' 402 }); 403 } 404 405 if (json['info']) { 406 $.notify({ 407 message: json['info'], 408 target: '_blank' 409 },{ 410 // settings 411 element: 'body', 412 position: null, 413 type: "info", 414 allow_dismiss: true, 415 newest_on_top: false, 416 placement: { 417 from: "top", 418 align: "right" 419 }, 420 offset: 20, 421 spacing: 10, 422 z_index: 2031, 423 delay: 5000, 424 timer: 1000, 425 url_target: '_blank', 426 mouse_over: null, 427 animate: { 428 enter: 'animated fadeInDown', 429 exit: 'animated fadeOutUp' 430 }, 431 onShow: null, 432 onShown: null, 433 onClose: null, 434 onClosed: null, 435 icon_type: 'class', 436 template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-info" role="alert">' + 437 '<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×Â</button>' + 438 '<span data-notify="message"><i class="fa fa-info"></i> {2}</span>' + 439 '<div class="progress" data-notify="progressbar">' + 440 '<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' + 441 '</div>' + 442 '<a href="{3}" target="{4}" data-notify="url"></a>' + 443 '</div>' 444 }); 445 } 446 447 $('#wishlist-total').html(json['total']); 448 } 449 }); 450 }, 451 'remove': function() { 452 453 } 454} 455 456var compare = { 457 'add': function(product_id) { 458 $.ajax({ 459 url: 'index.php?route=product/compare/add', 460 type: 'post', 461 data: 'product_id=' + product_id, 462 dataType: 'json', 463 success: function(json) { 464 if (json['success']) { 465 $.notify({ 466 message: json['success'], 467 target: '_blank' 468 },{ 469 // settings 470 element: 'body', 471 position: null, 472 type: "info", 473 allow_dismiss: true, 474 newest_on_top: false, 475 placement: { 476 from: "top", 477 align: "right" 478 }, 479 offset: 20, 480 spacing: 10, 481 z_index: 2031, 482 delay: 5000, 483 timer: 1000, 484 url_target: '_blank', 485 mouse_over: null, 486 animate: { 487 enter: 'animated fadeInDown', 488 exit: 'animated fadeOutUp' 489 }, 490 onShow: null, 491 onShown: null, 492 onClose: null, 493 onClosed: null, 494 icon_type: 'class', 495 template: '<div data-notify="container" class="col-xs-11 col-sm-3 alert alert-success" role="alert">' + 496 '<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×Â</button>' + 497 '<span data-notify="message"><i class="fa fa-check-circle"></i> {2}</span>' + 498 '<div class="progress" data-notify="progressbar">' + 499 '<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' + 500 '</div>' + 501 '<a href="{3}" target="{4}" data-notify="url"></a>' + 502 '</div>' 503 }); 504 505 $('#compare-total').html(json['total']); 506 } 507 } 508 }); 509 }, 510 'remove': function() { 511 512 } 513} 514 515/* Agree to Terms */ 516$(document).delegate('.agree', 'click', function(e) { 517 e.preventDefault(); 518 519 $('#modal-agree').remove(); 520 521 var element = this; 522 523 $.ajax({ 524 url: $(element).attr('href'), 525 type: 'get', 526 dataType: 'html', 527 success: function(data) { 528 html = '<div id="modal-agree" class="modal fade">'; 529 html += ' <div class="modal-dialog">'; 530 html += ' <div class="modal-content">'; 531 html += ' <div class="modal-header">'; 532 html += ' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>'; 533 html += ' <h4 class="modal-title">' + $(element).text() + '</h4>'; 534 html += ' </div>'; 535 html += ' <div class="modal-body">' + data + '</div>';
536 html += ' </div'; 537 html += ' </div>'; 538 html += '</div>'; 539 540 $('body').append(html); 541 542 $('#modal-agree').modal('show'); 543 } 544 }); 545}); 546 547/* Autocomplete */ 548(function($) { 549 function Autocomplete(element, options) { 550 this.element = element; 551 this.options = options; 552 this.timer = null; 553 this.items = new Array(); 554 555 $(element).attr('autocomplete', 'off'); 556 $(element).on('focus', $.proxy(this.focus, this)); 557 $(element).on('blur', $.proxy(this.blur, this)); 558 $(element).on('keydown', $.proxy(this.keydown, this)); 559 560 $(element).after('<ul class="dropdown-menu"></ul>'); 561 $(element).siblings('ul.dropdown-menu').delegate('a', 'click', $.proxy(this.click, this)); 562 } 563 564 Autocomplete.prototype = { 565 focus: function() { 566 this.request(); 567 }, 568 blur: function() { 569 setTimeout(function(object) { 570 object.hide(); 571 }, 200, this); 572 }, 573 click: function(event) { 574 event.preventDefault(); 575 576 value = $(event.target).parent().attr('data-value'); 577 578 if (value && this.items[value]) { 579 this.options.select(this.items[value]); 580 } 581 }, 582 keydown: function(event) { 583 switch(event.keyCode) { 584 case 27: // escape 585 this.hide(); 586 break; 587 default: 588 this.request(); 589 break; 590 } 591 }, 592 show: function() { 593 var pos = $(this.element).position(); 594 595 $(this.element).siblings('ul.dropdown-menu').css({ 596 top: pos.top + $(this.element).outerHeight(), 597 left: pos.left 598 }); 599 600 $(this.element).siblings('ul.dropdown-menu').show(); 601 $(this).siblings('ul.dropdown-menu').css("opacity", "1"); 602 $(this).siblings('ul.dropdown-menu').css("visibility", "visible"); 603 }, 604 hide: function() { 605 $(this.element).siblings('ul.dropdown-menu').hide(); 606 }, 607 request: function() { 608 clearTimeout(this.timer); 609 610 this.timer = setTimeout(function(object) { 611 object.options.source($(object.element).val(), $.proxy(object.response, object)); 612 }, 200, this); 613 }, 614 response: function(json) { 615 html = ''; 616 617 if (json.length) { 618 for (i = 0; i < json.length; i++) { 619 this.items[json[i]['value']] = json[i]; 620 } 621 622 for (i = 0; i < json.length; i++) { 623 if (!json[i]['category']) { 624 html += '<li data-value="' + json[i]['value'] + '"><a href="#">' + json[i]['label'] + '</a></li>'; 625 } 626 } 627 628 // Get all the ones with a categories 629 var category = new Array(); 630 631 for (i = 0; i < json.length; i++) { 632 if (json[i]['category']) { 633 if (!category[json[i]['category']]) { 634 category[json[i]['category']] = new Array(); 635 category[json[i]['category']]['name'] = json[i]['category']; 636 category[json[i]['category']]['item'] = new Array(); 637 } 638 639 category[json[i]['category']]['item'].push(json[i]); 640 } 641 } 642 643 for (i in category) { 644 html += '<li class="dropdown-header">' + category[i]['name'] + '</li>'; 645 646 for (j = 0; j < category[i]['item'].length; j++) { 647 html += '<li data-value="' + category[i]['item'][j]['value'] + '"><a href="#"> ' + category[i]['item'][j]['label'] + '</a></li>'; 648 } 649 } 650 } 651 652 if (html) { 653 this.show(); 654 } else { 655 this.hide(); 656 } 657 658 $(this.element).siblings('ul.dropdown-menu').html(html); 659 } 660 }; 661 662 $.fn.autocomplete = function(option) { 663 return this.each(function() { 664 var data = $(this).data('autocomplete'); 665 666 if (!data) { 667 data = new Autocomplete(this, option); 668 669 $(this).data('autocomplete', data); 670 } 671 }); 672 } 673})(window.jQuery); 674 675function openPopup(module_id, product_id) { 676 product_id = product_id || undefined; 677 $.magnificPopup.open({ 678 items: { 679 src: 'index.php?route=extension/module/popup/show&module_id=' + module_id + (product_id ? '&product_id=' + product_id : '') 680 }, 681 mainClass: 'popup-module mfp-with-zoom', 682 type: 'ajax', 683 removalDelay: 200 684 }); 685}
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.