1/** 2 * @Website: apollotheme.com - prestashop template provider 3 * @author Apollotheme <[email protected]> 4 * @copyright 2007-2018 Apollotheme 5 * @description: 6 */ 7 8/** 9 * Start block functions common for front-end 10 */ 11(function ($) { 12 $.LeoCustomAjax = function () { 13 this.leoData = 'leoajax=1'; 14 }; 15 $.LeoCustomAjax.prototype = { 16 processAjax: function () { 17 18 var myElement = this; 19 20 if (leoOption.category_qty && $(".leo-qty").length) 21 myElement.getCategoryList(); 22 else if ($(".leo-qty").length) 23 $(".leo-qty").remove(); 24 25 if (leoOption.product_list_image && $(".leo-more-info").length) 26 myElement.getProductListImage(); 27 else if ($(".leo-more-info").length) 28 $(".leo-more-info").remove(); 29 30 if (leoOption.product_one_img && $(".product-additional").length) 31 myElement.getProductOneImage(); 32 else if ($(".product-additional").length) 33 $(".product-additional").remove(); 34 35 if (leoOption.productCdown && $(".leo-more-cdown").length) 36 myElement.getProductCdownInfo(); 37 else if ($(".leo-more-cdown").length) 38 $(".leo-more-cdown").remove(); 39 40 if (leoOption.productCdown && $(".leo-more-color").length) 41 myElement.getProductColorInfo(); 42 else if ($(".leo-more-color").length) 43 $(".leo-more-color").remove(); 44 45 //find class ap-count-wishlist-compare 46 if($('.ap-total-wishlist').length || $('.ap-total-compare').length) 47 { 48 myElement.getCountWishlistCompare(); 49 } 50 51 if (myElement.leoData != "leoajax=1") { 52 $.ajax({
53 type: 'POST', 54 headers: {"cache-control": "no-cache"}, 55 url: prestashop.urls.base_url + 'modules/appagebuilder/apajax.php' + '?rand=' + new Date().getTime(), 56 async: true, 57 cache: false, 58 dataType: "json", 59 data: myElement.leoData, 60 success: function (jsonData) { 61 if (jsonData) { 62 if (jsonData.cat) { 63 for (i = 0; i < jsonData.cat.length; i++) { 64 var str = jsonData.cat[i].total; 65 var label = $(".leo-qty.leo-cat-" + jsonData.cat[i].id_category).data("str"); 66 if(typeof label != "undefined") { 67 str += "<span>" + label + "</span>"; 68 } 69 $(".leo-qty.leo-cat-" + jsonData.cat[i].id_category).html(str); 70 $(".leo-qty.leo-cat-" + jsonData.cat[i].id_category).show(); 71 } 72 73 $('.leo-qty').each(function(){ 74 if($(this).html() == '') 75 { 76 $(this).html('0'); 77 $(this).show(); 78 } 79 }) 80 } 81 if (jsonData.product_list_image) { 82 var listProduct = new Array(); 83 for (i = 0; i < jsonData.product_list_image.length; i++) { 84 listProduct[jsonData.product_list_image[i].id] = jsonData.product_list_image[i].content; 85 } 86 87 $(".leo-more-info").each(function () { 88 $(this).html(listProduct[$(this).data("idproduct")]); 89 }); 90 addEffectProducts(); 91 } 92 93 if (jsonData.pro_cdown) { 94 var listProduct = new Array(); 95 for (i = 0; i < jsonData.pro_cdown.length; i++) { 96 listProduct[jsonData.pro_cdown[i].id] = jsonData.pro_cdown[i].content; 97 } 98 99 $(".leo-more-cdown").each(function () { 100 $(this).html(listProduct[$(this).data("idproduct")]); 101 }); 102 } 103 104 if (jsonData.pro_color) { 105 var listProduct = new Array(); 106 for (i = 0; i < jsonData.pro_color.length; i++) { 107 listProduct[jsonData.pro_color[i].id] = jsonData.pro_color[i].content; 108 } 109 110 $(".leo-more-color").each(function () { 111 $(this).html(listProduct[$(this).data("idproduct")]); 112 }); 113 } 114 115 if (jsonData.product_one_img) { 116 var listProductImg = new Array(); 117 var listProductName = new Array(); 118 for (i = 0; i < jsonData.product_one_img.length; i++) { 119 listProductImg[jsonData.product_one_img[i].id] = jsonData.product_one_img[i].content; 120 listProductName[jsonData.product_one_img[i].id] = jsonData.product_one_img[i].name; 121 } 122 123 iw = 360; 124 ih = 360; 125 if (typeof leoOption.homeWidth !== 'undefined') { 126 iw = leoOption.homeWidth; 127 ih = leoOption.homeheight; 128 }else{ 129 iw = $('.product_img_link .img-fluid').first().attr('width'); 130 ih = $('.product_img_link .img-fluid').first().attr('height'); 131 } 132 $(".product-additional").each(function () { 133 if (listProductImg[$(this).data("idproduct")]) { 134 var str_image = listProductImg[$(this).data("idproduct")]; 135 if ($(this).data("image-type")) { 136 src_image = str_image.replace('home_default',$(this).data("image-type")); 137 }else{ 138 src_image = str_image.replace('home_default', 'home_default'); 139 } 140 var name_image = listProductName[$(this).data("idproduct")]; 141 $(this).html('<img class="img-fluid" title="'+name_image+'" alt="'+name_image+'" src="' + src_image
141+ '" width="'+iw+'" height="'+ih+'"/>'); 142 } 143 }); 144 //addEffOneImg(); 145 } 146 147 //wishlist 148 if (jsonData.wishlist_products) 149 { 150 $('.ap-total-wishlist').data('wishlist-total',jsonData.wishlist_products); 151 $('.ap-total-wishlist').text(jsonData.wishlist_products); 152 } 153 else 154 { 155 $('.ap-total-wishlist').data('wishlist-total',0); 156 $('.ap-total-wishlist').text('0'); 157 } 158 159 //compare 160 if (jsonData.compared_products) 161 { 162 $('.ap-total-compare').data('compare-total',jsonData.compared_products); 163 $('.ap-total-compare').text(jsonData.compared_products); 164 } 165 else 166 { 167 $('.ap-total-compare').data('compare-total',0); 168 $('.ap-total-compare').text(0); 169 } 170 171 } 172 }, 173 error: function () { 174 } 175 }); 176 } 177 }, 178 179 //check get number product of wishlist compare 180 getCountWishlistCompare: function() 181 { 182 this.leoData += '&wishlist_compare=1'; 183 }, 184 185 getCategoryList: function () { 186 //get category id 187 var leoCatList = ""; 188 $(".leo-qty").each(function () { 189 if($(this).data("id")){ 190 if (leoCatList) 191 leoCatList += "," + $(this).data("id"); 192 else 193 leoCatList = $(this).data("id"); 194 }else{ 195 if (leoCatList) 196 leoCatList += "," + $(this).attr("id"); 197 else 198 leoCatList = $(this).attr("id"); 199 } 200 }); 201 202 if (leoCatList) { 203 leoCatList = leoCatList.replace(/leo-cat-/g, ""); 204 this.leoData += '&cat_list=' + leoCatList; 205 } 206 return false; 207 }, 208 getProductListImage: function () { 209 var leoProInfo = ""; 210 $(".leo-more-info").each(function () { 211 if (!leoProInfo) 212 leoProInfo += $(this).data("idproduct"); 213 else 214 leoProInfo += "," + $(this).data("idproduct"); 215 }); 216 if (leoProInfo) { 217 this.leoData += '&product_list_image=' + leoProInfo; 218 } 219 return false; 220 }, 221 getProductCdownInfo: function () { 222 var leoProCdown = ""; 223 $(".leo-more-cdown").each(function () { 224 if (!leoProCdown) 225 leoProCdown += $(this).data("idproduct"); 226 else 227 leoProCdown += "," + $(this).data("idproduct"); 228 }); 229 if (leoProCdown) { 230 this.leoData += '&pro_cdown=' + leoProCdown; 231 } 232 return false; 233 }, 234 getProductColorInfo: function () { 235 var leoProColor = ""; 236 $(".leo-more-color").each(function () { 237 if (!leoProColor) 238 leoProColor += $(this).data("idproduct"); 239 else 240 leoProColor += "," + $(this).data("idproduct"); 241 }); 242 if (leoProColor) { 243 this.leoData += '&pro_color=' + leoProColor; 244 } 245 return false; 246 }, 247 getProductOneImage: function () { 248 //tranditional image 249 var leoAdditional = ""; 250 $(".product-additional").each(function () { 251 if (!leoAdditional) 252 leoAdditional += $(this).data("idproduct"); 253 else 254 leoAdditional += "," + $(this).data("idproduct"); 255 }); 256 if (leoAdditional) { 257 this.leoData += '&product_one_img=' + leoAdditional; 258 } 259 return false; 260 } 261 }; 262}(jQuery)); 263 264function addJSProduct(currentProduct) { 265// http://demos.flesler.com/jquery/serialScroll/ 266// if (typeof serialScroll == 'function') {
267 $('.thumbs_list_' + currentProduct).serialScroll({ 268 items: 'li:visible', 269 prev: '.view_scroll_left_' + currentProduct, 270 next: '.view_scroll_right_' + currentProduct, 271 axis: 'y', 272 offset: 0, 273 start: 0, 274 stop: true, 275 duration: 700, 276 step: 1, 277 lazy: true, 278 lock: false, 279 force: false, 280 cycle: false, 281 onBefore: function( e, elem, $pane, $items, pos ){ 282 //DONGND:: update status for button 283 if( pos == 0 ) 284 { 285 $('.view_scroll_left_' + currentProduct).addClass('disable'); 286 } 287 else if( pos == $items.length -1 ) 288 { 289 $('.view_scroll_right_' + currentProduct).addClass('disable'); 290 } 291 else 292 { 293 $('.view_scroll_left_' + currentProduct).removeClass('disable'); 294 $('.view_scroll_right_' + currentProduct).removeClass('disable'); 295 } 296 }, 297 }); 298 $('.thumbs_list_' + currentProduct).trigger('goto', 1);// SerialScroll Bug on goto 0 ? 299 $('.thumbs_list_' + currentProduct).trigger('goto', 0); 300 // } 301} 302function addEffectProducts(){ 303 304 if(typeof(leoOption) != 'undefined' && leoOption.product_list_image){ 305 $(".leo-more-info").each(function() { 306 addJSProduct($(this).data("idproduct")); 307 }); 308 addEffectProduct(); 309 } 310} 311 312function addEffectProduct() { 313 var speed = 800; 314 var effect = "easeInOutQuad"; 315 316 //$(".products_block .carousel-inner .ajax_block_product:first-child").mouseenter(function() { 317 //$(".products_block .carousel-inner").css("overflow", "inherit"); 318 //}); 319 //$(".carousel-inner").mouseleave(function() { 320 //$(".carousel-inner").css("overflow", "hidden"); 321 //}); 322 323 $(".leo-more-info").each(function() { 324 var leo_preview = this; 325 $(leo_preview).find(".leo-hover-image").each(function() { 326 $(this).mouseover(function() { 327 var big_image = $(this).attr("rel"); 328 var imgElement = $(leo_preview).parent().find(".product-thumbnail img").first(); 329 if (!imgElement.length) { 330 imgElement = $(leo_preview).parent().find(".product_image img").first(); 331 } 332 333 if (imgElement.length) { 334 $(imgElement).stop().animate({opacity: 0}, {duration: speed, easing: effect}); 335 $(imgElement).first().attr("src", big_image); 336 $(imgElement).first().attr("data-rel", big_image); 337 $(imgElement).stop().animate({opacity: 1}, {duration: speed, easing: effect}); 338 } 339 //DONGND:: change class when hover another image 340 if (!$(this).hasClass('shown')) 341 { 342 $(leo_preview).find('.shown').removeClass('shown'); 343 $(this).parent().addClass('shown'); 344 } 345 }); 346 }); 347 348 $('.thickbox-ajax-'+$(this).data("idproduct")).fancybox({ 349 helpers: { 350 overlay: { 351 locked: false 352 } 353 }, 354 'hideOnContentClick': true, 355 'transitionIn' : 'elastic', 356 'transitionOut' : 'elastic' 357 }); 358 }); 359} 360 361function addEffOneImg() { 362 var speed = 800; 363 var effect = "easeInOutQuad"; 364 365 $(".product-additional").each(function() { 366 if ($(this).find("img").length) { 367 var leo_hover_image = $(this).parent().find("img").first(); 368 var leo_preview = $(this); 369 $(this).parent().mouseenter(function() { 370 $(this).find("img").first().stop().animate({opacity: 0}, {duration: speed, easing: effect}); 371 $(leo_preview).stop().animate({opacity: 1}, {duration: speed, easing: effect}); 372 }); 373 $(this).parent().mouseleave(function() { 374 $(this).find("img").first().stop().animate({opacity: 1}, {duration: speed, easing: effect}); 375 $(leo_preview).stop().animate({opacity: 0}, {duration: speed, easing: effect}); 376 }); 377 } 378 });
379} 380function log(message) { 381 console.log(message); 382} 383 384//DONGND:: action animation 385function activeAnimation() 386{ 387 $(".has-animation").each(function() { 388 onScrollInit($(this)); 389 }); 390} 391 392function onScrollInit(items) { 393 items.each(function() { 394 var osElement = $(this); 395 var animation = $(osElement).data("animation"); 396 var osAnimationDelay = $(osElement).data("animation-delay"); 397 var osAnimationDuration = $(osElement).data("animation-duration"); 398 var osAnimationIterationCount = $(osElement).data("animation-iteration-count"); 399 var osAnimationInfinite = $(osElement).data("animation-infinite"); 400 if (osAnimationInfinite == 1) 401 { 402 var loop_animation = 'infinite'; 403 } 404 else 405 { 406 var loop_animation = osAnimationIterationCount; 407 } 408 osElement.css({ 409 "-webkit-animation-delay": osAnimationDelay, 410 "-moz-animation-delay": osAnimationDelay, 411 "animation-delay": osAnimationDelay, 412 "-webkit-animation-duration": osAnimationDuration, 413 "-moz-animation-duration": osAnimationDuration, 414 "animation-duration": osAnimationDuration, 415 "-webkit-animation-iteration-count": loop_animation, 416 "-moz-animation-iteration-count": loop_animation, 417 "animation-iteration-count": loop_animation, 418 }); 419 420 osElement.waypoint(function() { 421 if (osElement.hasClass('has-animation')) 422 { 423 osElement.addClass('animated '+ animation).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ 424 $(this).removeClass('has-animation animated ' +animation); 425 }); 426 } 427 428 this.destroy(); 429 }, { 430 triggerOnce: true, 431 offset: '100%' 432 }); 433 }); 434} 435/** 436 * End block functions common for front-end 437 */ 438 439 440/** 441 * End block for module ap_gmap 442 */ 443function synSize(name) { 444 var obj = $("#" + name); 445 var div = $(obj).closest(".gmap-cover"); 446 var gmap = $(div).find(".gmap"); 447 $(obj).height($(gmap).height()); 448 //console.log($(gmap).height()); 449} 450 451$(function() { 452 /** 453 * Start block for module ap_product_list 454 */ 455 $(".btn-show-more").click(function() { 456 var page = parseInt($(this).data('page')); 457 var use_animation = parseInt($(this).data('use-animation')); 458 var btn = $(this); 459 var config = $(this).closest(".ApProductList").find(".apconfig").val(); 460 461 // FIX 1.7 462 btn.data('reset-text', btn.html() ); 463 btn.html( btn.data('loading-text') ); 464 465 $.ajax({
466 headers: {"cache-control": "no-cache"}, 467 url: prestashop.urls.base_url + 'modules/appagebuilder/apajax.php', 468 async: true, 469 cache: false, 470 dataType: "Json", 471 data: {"config": config, "p": page, "use_animation": use_animation}, 472 success: function(response) { 473 var boxCover = $(btn).closest(".box-show-more"); 474 if(!response.is_more) { 475 $(boxCover).removeClass("open").fadeOut(); 476 } 477 if(response.html) { 478 $(boxCover).prev().append(response.html); 479 } 480 $(btn).data("page", (page + 1)); 481 482 if (typeof $.LeoCustomAjax !== "undefined" && $.isFunction($.LeoCustomAjax)) { 483 var leoCustomAjax = new $.LeoCustomAjax(); 484 leoCustomAjax.processAjax(); 485 } 486 487 //DONGND:: class function of leofeature 488 callLeoFeature(); 489 490 //DONGND:: re call run animation 491 activeAnimation(); 492 493 } 494 }).always(function () { 495 // FIX 1.7 496 btn.html( btn.data('reset-text') ); 497 }); 498 }); 499 /** 500 * End block for module ap_product_list 501 */ 502 /** 503 * Start block for module ap_image 504 */ 505 //DONGND:: call active anmation 506 activeAnimation(); 507 /** 508 * End block for module ap_image 509 */ 510}); 511(function ($) { 512 513 window.addRule = function (selector, styles, sheet) { 514 515 styles = (function (styles) { 516 if (typeof styles === "string") return styles; 517 var clone = ""; 518 for (var prop in styles) { 519 if (styles.hasOwnProperty(prop)) { 520 var val = styles[prop]; 521 prop = prop.replace(/([A-Z])/g, "-$1").toLowerCase(); // convert to dash-case 522 clone += prop + ":" + (prop === "content" ? '"' + val + '"' : val) + "; "; 523 } 524 } 525 return clone; 526 }(styles)); 527 528 529 530 try { 531 sheet = sheet || document.styleSheets[document.styleSheets.length - 1]; 532 if (sheet.insertRule) 533 { 534 // if(!(navigator.userAgent.toLowerCase().indexOf('firefox') > -1)) // FIX work on firefox 535 // { 536 if(sheet.cssRules!==null && sheet.cssRules.length!== 0) 537 sheet.insertRule(selector + " {" + styles + "}", sheet.cssRules.length); 538 // } 539 } 540 else if (sheet.addRule) sheet.addRule(selector, styles); 541 } 542 catch(err) { 543 // way 2 : https://stackoverflow.com/questions/28930846/how-to-use-cssstylesheet-insertrule-properly 544 var style = (function() { 545 var style = document.createElement("style"); 546 style.appendChild(document.createTextNode("")); 547 document.head.appendChild(style); 548 return style; 549 })(); 550 style.sheet.insertRule(selector + " {" + styles + "}", 0); 551 552 553 } 554// window.console.log(sheet); 555// window.console.log(selector); 556// window.console.log(styles); 557 return this; 558 559 }; 560 561 if ($) $.fn.addRule = function (styles, sheet) { 562 addRule(this.selector, styles, sheet); 563 return this; 564 }; 565 566}(this.jQuery || this.Zepto)); 567function apPopupForm(){ 568 if($.cookie('apnewletter')) return; 569 $.fancybox({ 570 'content' : $(".ap-popup").html(), 571 'wrapCSS' : 'ap-popup-clone', 572 afterClose: function (event, ui) { 573 574 }, 575 beforeShow: function (event, ui) { 576 this.inner.append("<div class='turnoff-popup-wrapper text-center'><input id='turnoff-popup-bt' name='turnoff-popup-bt' class='turnoff-popup' type='checkbox'><label for='turnoff-popup-bt'>
576"+turnoff_popup_text+"</label></div>"); 577 $('.turnoff-popup').click(function(){ 578 if (!$(this).hasClass('active')) 579 { 580 $.cookie('apnewletter', '1'); 581 $(this).addClass('active'); 582 } 583 else 584 { 585 $.cookie('apnewletter', null); 586 $(this).removeClass('active'); 587 } 588 }) 589 } 590 }); 591} 592 593//set background and parallax 594$(document).ready(function(){ 595 //show popup 596 if($('.ap-popup').length){ 597 if($('.ap-popup').hasClass('index-only') && $('body').attr('id') == 'index') 598 apPopupForm(); 599 else 600 apPopupForm(); 601 } 602 603 $(".has-bg.bg-fullwidth").each(function(){ 604 id = "#"+$(this).attr("id"); 605 bg = $(this).data("bg"); 606 $(id + ":before").addRule({ 607 background: bg 608 }); 609 }); 610 //stela 611 if (typeof stellar !== 'undefined' && stellar) 612 $.stellar({horizontalScrolling:false}); 613 614 //mouse 615 currentPosX = []; 616 currentPosY = []; 617 $("div[data-mouse-parallax-strength]").each(function(){ 618 currentPos = $(this).css("background-position"); 619 if (typeof currentPos == "string") 620 { 621 currentPosArray = currentPos.split(" "); 622 }else 623 { 624 currentPosArray = [$(this).css("background-position-x"),$(this).css("background-position-y")]; 625 } 626 currentPosX[$(this).data("mouse-parallax-rid")] = parseFloat(currentPosArray[0]); 627 currentPosY[$(this).data("mouse-parallax-rid")] = parseFloat(currentPosArray[1]); 628 $(this).mousemove(function(e){ 629 newPosX = currentPosX[$(this).data("mouse-parallax-rid")]; 630 newPosY = currentPosY[$(this).data("mouse-parallax-rid")]; 631 if($(this).data("mouse-parallax-axis") != "axis-y"){ 632 mparallaxPageX = e.pageX - $(this).offset().left; 633 if($(this).hasClass("full-bg-screen")) 634 { 635 mparallaxPageX = mparallaxPageX - 1000; 636 } 637 newPosX = (mparallaxPageX * $(this).data("mouse-parallax-strength") * -1) + newPosX; 638 } 639 if($(this).data("mouse-parallax-axis") !="axis-x"){ 640 mparallaxPageY = e.pageY - $(this).offset().top; 641 newPosY = mparallaxPageY * $(this).data("mouse-parallax-strength") * -1; 642 } 643 $(this).css("background-position",newPosX+"px "+newPosY+"px"); 644 }); 645 }); 646 647 var ytIframeId; var ytVideoId; 648 function onYouTubeIframeAPIReady() { 649 $("div.iframe-youtube-api-tag").each(function(){ 650 ytIframeId = $(this).attr("id"); 651 ytVideoId = $(this).data("youtube-video-id"); 652 653 new YT.Player(ytIframeId, { 654 videoId: ytVideoId, 655 width: "100%", 656 height: "100%", 657 playerVars :{autoplay:1,controls:0,disablekb:1,fs:0,cc_load_policy:0, 658 iv_load_policy:3,modestbranding:0,rel:0,showinfo:0,start:0}, 659 events: { 660 "onReady": function(event){ 661 event.target.mute(); 662 setInterval( 663 function(){event.target.seekTo(0);}, 664 (event.target.getDuration() - 1) * 1000 665 ); 666 } 667 } 668 }); 669 }); 670 } 671 onYouTubeIframeAPIReady(); 672 673 if (typeof MediaElementPlayer !== 'undefined') { 674 //add function for html5 youtube video 675 var player1 = new MediaElementPlayer('#special-youtube-video1'); 676 var player2 = new MediaElementPlayer('#special-youtube-video2'); 677 if(player1) 678 { 679 var auto_find = setInterval(function(){ 680 if($('#video-1 .mejs-overlay-play').html()) 681 { 682 $('#video-1 .mejs-overlay-play>.mejs-overlay-button').before('<div class="video-name">
682'+$('#special-youtube-video1').data('name')+'</div>'); 683 $('#video-1 .mejs-overlay-play').append('<div class="video-description">Watch video and <span>subscribe us<span></div>'); 684 clearInterval(auto_find); 685 } 686 }, 500); 687 } 688 689 if(player2) 690 { 691 var auto_find1 = setInterval(function(){ 692 if($('#video-2 .mejs-overlay-play').html()) 693 { 694 $('#video-2 .mejs-overlay-play>.mejs-overlay-button').before('<div class="video-name">'+$('#special-youtube-video2').data('name')+'</div>'); 695 $('#video-2 .mejs-overlay-play').append('<div class="video-description">Watch video and <span>subscribe us<span></div>'); 696 clearInterval(auto_find1); 697 } 698 }, 500); 699 } 700 } 701 //js for select header, footer, content in demo 702 current_url = window.location.href; 703 $('.apconfig').each(function(){ 704 var enableJS = $(this).data('enablejs'); 705 if(enableJS == false){ 706 return; 707 } 708 var leochange = '&leopanelchange'; 709 var current_url = $(this).data('url'); 710 if( !current_url ){ 711 current_url = window.location.href; 712 current_url = current_url.replace(leochange, ""); 713 } 714 715 var param = $(this).data('type'); 716 var value = $(this).data('id'); 717 var re = new RegExp("([?|&])" + param + "=.*?(&|$)","i"); 718 if (current_url.match(re)) 719 $(this).attr('href', current_url.replace(re,'$1' + param + "=" + value + '$2') + leochange); 720 else{ 721 if(current_url.indexOf('?') == -1) 722 $(this).attr('href', current_url + '?' + param + "=" + value + leochange); 723 else 724 $(this).attr('href', current_url + '&' + param + "=" + value + leochange); 725 726 } 727 }); 728 729 //DONGND:: fix owl carousel in tab load delay when resize. 730 $(window).resize(function(){ 731 if($('.tab-pane .owl-carousel').length) 732 { 733 $('.tab-pane .owl-carousel').each(function(index, element){ 734 if(!$(element).parents('.tab-pane').hasClass('active') && typeof ($(element).data('owlCarousel')) !== "undefined") 735 { 736 var w_owl_active_tab = $(element).parents('.tab-pane').siblings('.active').find('.owl-carousel').width(); 737 738 $(element).width(w_owl_active_tab); 739 $(element).data('owlCarousel').updateVars(); 740 $(element).width('100%'); 741 } 742 }); 743 } 744 }) 745 746 //DONGND:: loading owl carousel fake item 747 var check_window_w = parseInt($(window).width()); 748 749 if (check_window_w >= 992 && check_window_w < 1200) 750 { 751 addClassLoading('lg'); 752 } 753 else if (check_window_w >= 768 && check_window_w < 992) 754 { 755 addClassLoading('md'); 756 } 757 else if (check_window_w >= 576 && check_window_w < 768) 758 { 759 addClassLoading('sm'); 760 } 761 else if (check_window_w < 576) 762 { 763 addClassLoading('m'); 764 } 765 else 766 { 767 addClassLoading('xl'); 768 } 769 770 771 // // Slick Carousel 772 // $( ".slick-carousel-parent" ).each(function( index ) { 773 // var slick_config = $(this).data("slick-config"); 774 // if(slick_config){ 775 776 // $(this).on('init', function() { 777 // $(this).css("display", "block"); 778 // }); 779 780 // $(this).slick({ 781 // dots: parseInt(slick_config.dot)?true:false, 782 // //infinite: parseInt(slick_config.dot)?false:true, 783 // infinite: parseInt(slick_config.infinite)?true:false, 784 // vertical: parseInt(slick_config.vertical)?true:false, 785 // autoplay: parseInt(slick_config.autoplay)?true:false, 786 // pauseonhover: parseInt(slick_config.autoplay)?true:false, 787 // autoplaySpeed: 2000, 788 // arrows: parseInt(slick_config.arrows)?true:false, 789 // row: parseInt(slick_config.row), 790 // slidesToShow: parseInt(slick_config.slidestoshow), 791 // slidesToScroll: parseInt(slick_config.slidestoscroll), 792 // responsive: [ 793 // { 794 // breakpoint: 1024, 795 // settings: { 796 // row: parseInt(slick_config.row_1024), 797 // slidesToShow: parseInt(slick_config.slidestoshow_1024), 798 // } 799 // }, 800 // { 801 // breakpoint: 768, 802 // settings: { 803 // row: parseInt(slick_config.row_768), 804 // slidesToShow: parseInt(slick_config.slidestoshow_768), 805 // } 806 // }, 807 // { 808 // breakpoint: 600, 809 // settings: { 810 // row: parseInt(slick_config.row_600), 811 // slidesToShow: parseInt(slick_config.slidestoshow_600), 812 // } 813 // }, 814 // { 815 // breakpoint: 450, 816 // settings: { 817 // row: parseInt(slick_config.row_450), 818 // slidesToShow: parseInt(slick_config.slidestoshow_450), 819 // } 820 // } 821 // ] 822 // }); 823 824 // $(this).on('init', function(slick){ 825 // console.log("123"); 826 // }); 827 828 // } 829 // }); 830 831}); 832 833//DONGND:: add class loading by width of window 834function addClassLoading($type) 835{ 836 $('.timeline-wrapper').each(function(){ 837 if ($(this).data($type) <= $(this).data('item')) 838 { 839 var num_remove_item = $(this).data('item') - $(this).data($type); 840 if ($(this).data($type) < $(this).data('item')) 841 { 842 var num_remove_item = $(this).data('item') - $(this).data($type); 843 $(this).find('.timeline-parent').slice(-num_remove_item).remove(); 844 } 845 846 if (12%$(this).data($type) == 0) 847 { 848 if ($type == 'm') 849 { 850 $(this).find('.timeline-parent').addClass('col-xs-'+12/$(this).data($type)); 851 } 852 else 853 { 854 $(this).find('.timeline-parent').addClass('col-'+$type+'-'+12/$(this).data($type)); 855 } 856 } 857 else 858 { 859 $(this).find('.timeline-parent').css({'width': 100/$(this).data($type)+'%', 'float': 'left'}) 860 } 861 862 $('.timeline-wrapper').removeClass('prepare'); 863 } 864 }) 865} 866 867//DONGND:: call function from leofeature 868function callLeoFeature() 869{ 870 if(typeof (leoBtCart) != 'undefined') 871 { 872 leoBtCart(); 873 } 874 if(typeof (leoSelectAttr) != 'undefined') 875 { 876 leoSelectAttr(); 877 } 878 if(typeof (LeoWishlistButtonAction) != 'undefined') 879 { 880 LeoWishlistButtonAction(); 881 } 882 if(typeof (LeoCompareButtonAction) != 'undefined') 883 { 884 LeoCompareButtonAction(); 885 } 886 if(typeof (actionQuickViewLoading) != 'undefined') 887 { 888 actionQuickViewLoading(); 889 } 890} 891 892function SetOwlCarouselFirstLast(el){ 893 el.find(".owl-item").removeClass("first"); 894 el.find(".owl-item.active").first().addClass("first"); 895 896 el.find(".owl-item").removeClass("last"); 897 el.find(".owl-item.active").last().addClass("last"); 898} 899/** 900 * List functions will run when document.ready() 901 */ 902$(document).ready(function() 903{ 904 if(typeof (ap_list_functions) != 'undefined') 905 { 906 for (var i = 0; i < ap_list_functions.length; i++) { 907 ap_list_functions[i]();
908 } 909 } 910}); 911 912/** 913 * List functions will run when window.load() 914 */ 915$(window).load(function(){ 916 if(typeof (ap_list_functions_loaded) != 'undefined') 917 { 918 for (var i = 0; i < ap_list_functions_loaded.length; i++) { 919 ap_list_functions_loaded[i](); 920 } 921 } 922}) 923 924$(document).ready(function(){ 925 // REPLACE URL IN BLOCKLANGUAGES 926 if(typeof approfile_multilang_url != "undefined") { 927 $.each(approfile_multilang_url, function(index, profile){ 928 var url_search = prestashop.urls.base_url + profile.iso_code; 929 var url_change = prestashop.urls.base_url + profile.iso_code + '/' + profile.friendly_url + '.html'; 930 931 //console.log(url_change); 932 933 //DONGND:: update for module blockgrouptop and default 934 if ($('#leo_block_top').length) 935 { 936 var parent_o = $('#leo_block_top .language-selector'); 937 } 938 else 939 { 940 var parent_o = $('.language-selector-wrapper'); 941 } 942 943 parent_o.find('li a').each(function(){ 944 945 var lang_href = $(this).attr('href'); 946 947 if(lang_href.indexOf(url_search) > -1 ) 948 { 949 //window.console.log('--' + url_change); 950 $(this).attr('href', url_change); 951 //window.console.log(url_change); 952 } 953 }); 954 955 }); 956 } 957 958 //DONGND:: update for module blockgrouptop and default 959 if ($('#leo_block_top').length) 960 { 961 var parent_o_currency = $('#leo_block_top .currency-selector'); 962 } 963 else 964 { 965 var parent_o_currency = $('.currency-selector'); 966 } 967 968 // REPLACE URL IN BLOCKLANGUAGES 969 parent_o_currency.find('li a').each(function(){ 970 971 var url_link = $(this).attr('href'); 972 var id_currency = getParamFromURL("id_currency", url_link); 973 var SubmitCurrency = getParamFromURL("SubmitCurrency", url_link); 974 975 var current_url = window.location.href; 976 //DONGND:: fix for only product page, url has # 977 if (prestashop.page.page_name == 'product') 978 { 979 var current_url = prestashop.urls.current_url; 980 } 981 var current_url = removeParamFromURL('SubmitCurrency',current_url); 982 var current_url = removeParamFromURL('id_currency',current_url); 983 984 if(current_url.indexOf('?') == -1){ 985 var new_url = current_url + '?SubmitCurrency=' + SubmitCurrency + "&id_currency=" +id_currency; 986 $(this).attr('href', new_url); 987 } 988 else{ 989 var new_url = current_url + '&SubmitCurrency=' + SubmitCurrency + "&id_currency=" +id_currency; 990 $(this).attr('href', new_url); 991 } 992 }); 993 994 995 prestashop.on('updateProductList', function() { 996 // FIX BUG : FILTER PRODUCT NOT SHOW MORE IMAGE 997 if (typeof $.LeoCustomAjax !== "undefined" && $.isFunction($.LeoCustomAjax)) { 998 var leoCustomAjax = new $.LeoCustomAjax(); 999 leoCustomAjax.processAjax(); 1000 } 1001 }); 1002 1003 //DONGND:: auto get link product and add to demo link on megamenu to show multi product detail 1004 if ($('.demo-product-detail a').length && prestashop.page.page_name != 'product') 1005 { 1006 $.ajax({ 1007 type: 'POST', 1008 headers: {"cache-control": "no-cache"}, 1009 url: prestashop.urls.base_url + 'modules/appagebuilder/apajax.php' + '?rand=' + new Date().getTime(), 1010 async: true, 1011 cache: false, 1012 dataType: "json", 1013 data: {"action": "get-product-link"}, 1014 success: function (jsonData) { 1015 if (jsonData) 1016 { 1017 $('.demo-product-detail a').each(function(){ 1018 var original_url = $(this).attr('href'); 1019 var layout_key = original_url.substring(original_url.indexOf('?layout=')); 1020 1021 var new_url = jsonData.replace('.html', '.html'+layout_key); 1022 $(this).attr('href',new_url).addClass('updated'); 1023 }); 1024 } 1025 1026 }, 1027 error: function () { 1028 } 1029 }); 1030 } 1031}); 1032 1033function removeParamFromURL(key, sourceURL) { 1034 1035 var rtn = sourceURL.split("?")[0], 1036 param, 1037 params_arr = [], 1038 queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : ""; 1039 1040 1041 if (queryString !== "") { 1042 params_arr = queryString.split("&"); 1043 for (var i = params_arr.length - 1; i >= 0; i -= 1) { 1044 param = params_arr[i].split("=")[0]; 1045 if (param === key) { 1046 params_arr.splice(i, 1); 1047 } 1048 } 1049 if(params_arr.length > 0){ 1050 rtn = rtn + "?" + params_arr.join("&"); 1051 } 1052 } 1053 return rtn; 1054} 1055 1056function getParamFromURL(key, sourceURL) { 1057 1058 var rtn = sourceURL.split("?")[0], 1059 param, 1060 params_arr = [], 1061 queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : ""; 1062 1063 if (queryString !== "") { 1064 params_arr = queryString.split("&"); 1065 1066 for (var i = params_arr.length - 1; i >= 0; i -= 1) { 1067 param = params_arr[i].split("=")[0]; 1068 if (param === key) { 1069 return params_arr[i].split("=")[1]; 1070 } 1071 } 1072 } 1073 return false; 1074}
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.