PageSourceSearch

https://www.bijoux-meli-melow.com/modules/appagebuilder/views/js/script.js

js bijoux-meli-melow.com collected 2026-10-09 00:59:48 UTC 60,503 bytes, 1,479 lines download raw bytes

1/**
2 *  @Website: apollotheme.com - prestashop template provider
3 *  @author Apollotheme <[email protected]>
4 *  @copyright  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            if(typeof leo_allow_ajax !== "undefined" && !leo_allow_ajax){
18                return;
19            }
20            var myElement = this;
21            
22            if (leoOption.category_qty && $(".leo-qty").length)
23                myElement.getCategoryList();
24            else if ($(".leo-qty").length)
25                $(".leo-qty").remove();
26            
27            if (leoOption.product_list_image && $(".leo-more-info").length)
28                myElement.getProductListImage();
29            else if ($(".leo-more-info").length)
30                $(".leo-more-info").remove();
31            
32            if (leoOption.product_one_img && $(".product-additional").length)
33                myElement.getProductOneImage();
34            else if ($(".product-additional").length)
35                $(".product-additional").remove();
36            
37            if (leoOption.product_one_img && $(".product-attribute-additional").length)
38                myElement.getProductAttributeOneImage();
39            else if ($(".product-attribute-additional").length)
40                $(".product-attribute-additional").remove();
41            
42            if (leoOption.product_one_img && $(".product-all-additional").length)
43                myElement.getProductAllOneImage();
44            else if ($(".product-all-additional").length)
45                $(".product-all-additional").remove();
46            
47            if (leoOption.productCdown && $(".leo-more-cdown").length)
48                myElement.getProductCdownInfo();
49            else if ($(".leo-more-cdown").length)
50                $(".leo-more-cdown").remove();
51            
52            if (leoOption.productCdown && $(".leo-more-color").length)
53                myElement.getProductColorInfo();
54            else if ($(".leo-more-color").length)
55                $(".leo-more-color").remove();
56
57            if($(".product-item-size").length)
58                myElement.getSizeContent();
59
60            if($(".product-item-attribute").length)
61                myElement.getAttributeContent();
62
63            if($(".product-item-manufacture").length)
64                myElement.getManufactureName();
65
66            if($(".leo-ajax-tabs").length)
67                myElement.getTabContent();
68
69            //find class ap-count-wishlist-compare
70            if($('.ap-total-wishlist').length || $('.ap-total-compare').length)
71            {
72                myElement.getCountWishlistCompare();
73            }
74            
75            if (myElement.leoData != "leoajax=1") {
76                $.ajax({
77                    type: 'POST',
78                    headers: {"cache-control": "no-cache"},
79                    url: prestashop.urls.base_url + 'modules/appagebuilder/apajax.php' + '?rand=' + new Date().getTime(),
80                    async: true,
81                    cache: false,
82                    dataType: "json",
83                    data: myElement.leoData,
84                    success: function (jsonData) {
85                        if (jsonData) {
86                            if (jsonData.cat) {
87                                for (i = 0; i < jsonData.cat.length; i++) {
88                                    var str = jsonData.cat[i].total;
89                                    var label = $(".leo-qty.leo-cat-" + jsonData.cat[i].id_category).data("str");
90                                    if(typeof label != "undefined") {
91                                        str += "<span>" + label + "</span>";
92                                    }
93                                    $(".leo-qty.leo-cat-" + jsonData.cat[i].id_category).html(str);
94                                    $(".leo-qty.leo-cat-" + jsonData.cat[i].id_category).show();
95                                }
96								
97                                $('.leo-qty').each(function(){
98                                        if($(this).html() == '')
99                                        {
100                                                $(this).html('0');
101                                                $(this).show();
102                                        }
103                                })
104                            }
105                            if (jsonData.product_list_image) {
106                                var listProduct = new Array();
107                                for (i = 0; i < jsonData.product_list_image.length; i++) {
108                                    listProduct[jsonData.product_list_image[i].id] = jsonData.product_list_image[i].content;
109                                }
110
111                                $(".leo-more-info").each(function () {
112                                    $(this).html(listProduct[$(this).data("idproduct")]);
113                                });
114                                addEffectProducts();
115                            }
116
117                            if (jsonData.pro_cdown) {
118                                var listProduct = new Array();
119                                for (i = 0; i < jsonData.pro_cdown.length; i++) {
120                                    listProduct[jsonData.pro_cdown[i].id] = jsonData.pro_cdown[i].content;
121                                }
122
123                                $(".leo-more-cdown").each(function () {
124                                    $(this).html(listProduct[$(this).data("idproduct")]);
125                                });
126                            }
127
128                            if (jsonData.pro_color) {
129                                var listProduct = new Array();
130                                for (i = 0; i < jsonData.pro_color.length; i++) {
131                                    listProduct[jsonData.pro_color[i].id] = jsonData.pro_color[i].content;
132                                }
133
134                                $(".leo-more-color").each(function () {
135                                    $(this).html(listProduct[$(this).data("idproduct")]);
136                                });
137                            }
138                                                        
139                            if (jsonData.product_one_img) {
140                                var listProductImg = new Array();
141								var listProductName = new Array();
142                                for (i = 0; i < jsonData.product_one_img.length; i++) {
143                                    listProductImg[jsonData.product_one_img[i].id] = jsonData.product_one_img[i].content;
144									listProductName[jsonData.product_one_img[i].id] = jsonData.product_one_img[i].name;
145                                }
146								
147								iw = 360;
148								ih = 360;
149								if (typeof leoOption.homeWidth !== 'undefined') {
150										iw = leoOption.homeWidth;
151										ih = leoOption.homeheight;
152								}else{
153										iw = $('.product_img_link .img-fluid').first().attr('width');
154										ih = $('.product_img_link .img-fluid').first().attr('height');
155								}
156                                $(".product-additional").each(function () {
157                                    if (listProductImg[$(this).data("idproduct")]) {
158                                        var str_image = listProductImg[$(this).data("idproduct")];
159                                        if ($(this).data("image-type")) {
160                                            src_image = str_image.replace('home_default',$(this).data("image-type"));
161                                        }else{
162                                            src_image = str_image.replace('home_default', 'home_default');
163                                        }
164										var name_image = listProductName[$(this).data("idproduct")];
165                                        $(this).html('<img loading="lazy"  class="img-fluid" title="'+name_image+'" alt="'+name_image+'" src="' + src_image 
165+ '" width="'+iw+'" height="'+ih+'"/>');
166                                    }
167                                });
168                                //addEffOneImg();
169                            }
170                                                        
171                            if (jsonData.product_attribute_one_img) {
172                                var listProductImg = new Array();
173                                var listProductName = new Array();
174                                for (i = 0; i < jsonData.product_attribute_one_img.length; i++) {
175                                    listProductImg[jsonData.product_attribute_one_img[i].id] = jsonData.product_attribute_one_img[i].content;
176                                    listProductName[jsonData.product_attribute_one_img[i].id] = jsonData.product_attribute_one_img[i].name;
177                                }
178
179                                iw = 360;
180                                ih = 360;
181                                if (typeof leoOption.homeWidth !== 'undefined') {
182                                    iw = leoOption.homeWidth;
183                                    ih = leoOption.homeheight;
184                                }else{
185                                    iw = $('.product_img_link .img-fluid').first().attr('width');
186                                    ih = $('.product_img_link .img-fluid').first().attr('height');
187                                }
188                                $(".product-attribute-additional").each(function () {
189                                    if (listProductImg[$(this).closest('.js-product-miniature').data("id-product")]) {
190                                        var str_image = listProductImg[$(this).closest('.js-product-miniature').data("id-product")];
191                                        if ($(this).data("image-type")) {
192                                            src_image = str_image.replace('home_default',$(this).data("image-type"));
193                                        }else{
194                                            src_image = str_image.replace('home_default', 'home_default');
195                                        }
196                                            var name_image = listProductName[$(this).closest('.js-product-miniature').data("id-product")];
197                                        $(this).html('<img loading="lazy"  class="img-fluid" title="'+name_image+'" alt="'+name_image+'" src="' + src_image + '" width="'+iw+'" height="'+ih+'"/>');
198                                    }
199                                });
200                                //addEffOneImg();
201                            }
202                            if (jsonData.product_attribute) {
203                                if (typeof jsonData.product_attribute.attribute !== 'undefined') {
204                                    $.each( jsonData.product_attribute.attribute, function( key, value ) {
205                                        $('.product-attribute-'+key).html(value);
206                                        $('.product-attribute-'+key).removeClass('product-item-attribute');
207                                    });
208                                }
209                                if (typeof jsonData.product_attribute.size !== 'undefined') {
210                                    $.each( jsonData.product_attribute.size, function( key, value ) {
211                                        $('.product-size-'+key).html(value);
212                                        $('.product-size-'+key).removeClass('product-item-size');
213                                    });
214                                }
215                            }
216                            if (jsonData.product_manufacture) {
217                                $.each( jsonData.product_manufacture, function( key, value ) {
218                                    $('.product-manufacture-'+key).html(value);
219                                    $('.product-manufacture-'+key).removeClass('product-item-manufacture');
220                                });
221                            }
222                            
223                            if (jsonData.product_all_one_img) {
224                                var listProductImg = new Array();
225                                var listProductName = new Array();
226                                for (i = 0; i < jsonData.product_all_one_img.length; i++) {
227                                    listProductImg[jsonData.product_all_one_img[i].id] = jsonData.product_all_one_img[i].c
227ontent;
228                                    listProductName[jsonData.product_all_one_img[i].id] = jsonData.product_all_one_img[i].name;
229                                }
230
231                                iw = 360;
232                                ih = 360;
233                                if (typeof leoOption.homeWidth !== 'undefined') {
234                                    iw = leoOption.homeWidth;
235                                    ih = leoOption.homeheight;
236                                }else{
237                                    iw = $('.product_img_link .img-fluid').first().attr('width');
238                                    ih = $('.product_img_link .img-fluid').first().attr('height');
239                                }
240                                $(".product-all-additional").each(function () {
241                                    if (listProductImg[$(this).closest('.js-product-miniature').data("id-product")]) {
242                                        var str_image = listProductImg[$(this).closest('.js-product-miniature').data("id-product")];
243                                        if ($(this).data("image-type")) {
244                                            src_image = str_image.replace('home_default',$(this).data("image-type"));
245                                        }else{
246                                            src_image = str_image.replace('home_default', 'home_default');
247                                        }
248                                            var name_image = listProductName[$(this).closest('.js-product-miniature').data("id-product")];
249                                        $(this).html('<img loading="lazy" class="img-fluid" title="'+name_image+'" alt="'+name_image+'" src="' + src_image + '" width="'+iw+'" height="'+ih+'"/>');
250                                    }
251                                });
252                                //addEffOneImg();
253                            }
254                            
255                            //wishlist 
256                            if (jsonData.wishlist_products)
257                            {
258								$('.ap-total-wishlist').data('wishlist-total',jsonData.wishlist_products);
259                                $('.ap-total-wishlist').text(jsonData.wishlist_products);
260                            }
261                            else
262                            {
263								$('.ap-total-wishlist').data('wishlist-total',0);
264                                $('.ap-total-wishlist').text('0');
265                            }
266                            
267                            //compare
268                            if (jsonData.compared_products)
269                            {
270								$('.ap-total-compare').data('compare-total',jsonData.compared_products);
271                                $('.ap-total-compare').text(jsonData.compared_products);
272                            }
273                            else
274                            {
275								$('.ap-total-compare').data('compare-total',0);
276                                $('.ap-total-compare').text(0);
277                            }
278
279                            if (jsonData.ajaxTab) {
280                                callshowmore = callajaxcontent = 0;
281                                $(".leo-ajax-tabs").addClass('loaded');
282                                $.each( jsonData.ajaxTab, function( key, value ) {
283                                    $("#"+key).html(value);
284                                    if(value.indexOf('ApProductList') >= 0){
285                                        callshowmore = 1;
286                                    }
287                                    if(value.indexOf('product_list') >= 0){
288                                        callajaxcontent = 1;
289                                    }
290                                });
291                                if(callshowmore){
292                                    apshowmore();
293                                }
294                                if(callajaxcontent){
295                                    if (typeof $.LeoCustomAjax !== "undefined" && $.isFunction($.LeoCustomAjax)) {
296                                        var leoCustomAjax = new $.LeoCustomAjax();
297                                        leoCustomAjax.processAjax();
298                                    }
299                                    
300                                    //DONGND:: class function of leofeature
301                                    callLeoFeature();
302                                    
303                                    //DONGND:: re call run animation
304                                    activeAnimation();
305                                }
306                            }
307                        }
308                    },
309                    error: function () {
310                    }
311                });
312            }
313        },
314        
315        //check get number product of wishlist compare
316        getCountWishlistCompare: function()
317        {
318            this.leoData += '&wishlist_compare=1';
319        },
320        
321        getCategoryList: function () {
322            //get category id
323            var leoCatList = "";
324            $(".leo-qty").each(function () {
325                if($(this).data("id")){
326                    if (leoCatList)
327                        leoCatList += "," + $(this).data("id");
328                    else
329                        leoCatList = $(this).data("id");
330                }else{
331                    if (leoCatList)
332                        leoCatList += "," + $(this).attr("id");
333                    else
334                        leoCatList = $(this).attr("id");
335                }
336            });
337
338            if (leoCatList) {
339                leoCatList = leoCatList.replace(/leo-cat-/g, "");
340                this.leoData += '&cat_list=' + leoCatList;
341            }
342            return false;
343        },
344        getProductListImage: function () {
345            var leoProInfo = "";
346            $(".leo-more-info").each(function () {
347                if (!leoProInfo)
348                    leoProInfo += $(this).data("idproduct");
349                else
350                    leoProInfo += "," + $(this).data("idproduct");
351            });
352            if (leoProInfo) {
353                this.leoData += '&product_list_image=' + leoProInfo;
354            }
355            return false;
356        },
357        getProductCdownInfo: function () {
358            var leoProCdown = "";
359            $(".leo-more-cdown").each(function () {
360                if (!leoProCdown)
361                    leoProCdown += $(this).data("idproduct");
362                else
363                    leoProCdown += "," + $(this).data("idproduct");
364            });
365            if (leoProCdown) {
366                this.leoData += '&pro_cdown=' + leoProCdown;
367            }
368            return false;
369        },
370        getProductColorInfo: function () {
371            var leoProColor = "";
372            $(".leo-more-color").each(function () {
373                if (!leoProColor)
374                    leoProColor += $(this).data("idproduct");
375                else
376                    leoProColor += "," + $(this).data("idproduct");
377            });
378            if (leoProColor) {
379                this.leoData += '&pro_color=' + leoProColor;
380            }
381            return false;
382        },
383        getTabContent: function () {
384            var tabshortcode = "";
385            var tabshortcodekey = "";
386            $(".leo-ajax-tabs").each(function () {
387                if(!$(this).hasClass('loaded')){
388                    if (!tabshortcode)
389                        tabshortcode += $(this).data("shortcode");
390                    else
391                        tabshortcode += "@|@" + $(this).data("shortcode");
392                    if (!tabshortcodekey)
393                        tabshortcodekey += $(this).attr("id");
394                    else
395                        tabshortcodekey += "@|@" + $(this).attr("id");
396                    if(!$(this).find('slick-loading').length){
397                        $(this).html('<div class="slick-loading" style="display: block;"><div class="slick-list" style="height: 600px;"> </div></div>');
398                    }
399                }
400            });
401            if (tabshortcode) {
402                this.leoData += '&tabshortcode=' + tabshortcode;
403            }
404            if (tabshortcode) {
405                this.leoData += '&tabshortcodekey=' + tabshortcodekey;
406                //get category
407                if (tabshortcode && $('input:radio[name=ajaxtabcate]').length && $('input:radio[name=ajaxtabcate]:checked').val()) {
408                    this.leoData += '&ajaxtabcate=' + $('input:radio[name=ajaxtabcate]:checked').val();
409                }
410            }
411            return false;
412        },
413        getSizeContent: function () {
414            //tranditional image
415            var leoAdditional = "";
416            $(".product-item-size").each(function () {
417                if (!leoAdditional)
418                    leoAdditional += $(this).data("idproduct");
419                else
420                    leoAdditional += "," + $(this).data("idproduct");
421            });
422            if (leoAdditional) {
423                this.leoData += '&product_size=' + leoAdditional;
424            }
425            return false;
426        },
427        getAttributeContent: function () {
428            //tranditional image
429            var leoAdditional = "";
430            $(".product-item-attribute").each(function () {
431                if (!leoAdditional)
432                    leoAdditional += $(this).data("idproduct");
433                else
434                    leoAdditional += "," + $(this).data("idproduct");
435            });
436            if (leoAdditional) {
437                this.leoData += '&product_attribute=' + leoAdditional;
438            }
439            return false;
440        },
441        getManufactureName: function () {
442            //tranditional image
443            var leoAdditional = "";
444            var testArray = [];
445            $(".product-item-manufacture").each(function () {
446                if (!leoAdditional){
447                    leoAdditional += $(this).data("idmanufacturer");
448                    testArray.push($(this).data("idmanufacturer"));
449                }
450                else{
451                    if(testArray.indexOf($(this).data("idmanufacturer")) < 0){
452                        leoAdditional += "," + $(this).data("idmanufacturer");
453                        testArray.push($(this).data("idmanufacturer"));
454                    }
455                }
456            });
457            if (leoAdditional) {
458                this.leoData += '&product_manufacture=' + leoAdditional;
459            }
460            return false;
461        },
462        getProductOneImage: function () {
463            //tranditional image
464            var leoAdditional = "";
465            $(".product-additional").each(function () {
466                if (!leoAdditional)
467                    leoAdditional += $(this).data("idproduct");
468                else
469                    leoAdditional += "," + $(this).data("idproduct");
470            });
471            if (leoAdditional) {
472                this.leoData += '&product_one_img=' + leoAdditional;
473            }
474            return false;
475        },
476        getProductAttributeOneImage: function () {
477            //tranditional image
478            var leoAdditionalattribute = "0-0";
479            $(".product-attribute-additional").each(function () {
480                leoAdditionalattribute += "," + $(this).closest('.js-product-miniature').data("id-product") + '-' + $(this).closest('.js-product-miniature').data("id-product-attribute");
481            });
482            if (leoAdditionalattribute && leoAdditionalattribute != '0-0') {
483                this.leoData += '&product_attribute_one_img=' + leoAdditionalattribute;
484            }
485            return false;
486        },
487        getProductAllOneImage: function () {
488            //tranditional image
489            var leoAdditional = "0";
490            var image_product = "0";
491            $(".product-all-additional").each(function () {
492                leoAdditional += "," + $(this).closest('.js-product-miniature').data("id-product");
493                image_product += "," + $(this).data("id-image");
494            });
495            if (leoAdditional) {
496                this.leoData += '&product_all_one_img=' + leoAdditional + '&image_product=' + image_product;;
497            }
498            return false;
499        },
500    };
501}(jQuery));
502
503function addJSProduct(currentProduct) {
504// http://demos.flesler.com/jquery/serialScroll/
505//    if (typeof serialScroll == 'function') { 
506        $('.thumbs_list_' + currentProduct).serialScroll({
507            items: 'li:visible',
508            prev: '.view_scroll_left_' + currentProduct,
509            next: '.view_scroll_right_' + currentProduct,
510            axis: 'y',
511            offset: 0,
512            start: 0,
513            stop: true,
514            duration: 700,
515            step: 1,
516            lazy: true,
517            lock: false,
518            force: false,
519            cycle: false,
520			onBefore: function( e, elem, $pane, $items, pos ){
521				//DONGND:: update status for button
522				if( pos == 0 )
523				{
524					$('.view_scroll_left_' + currentProduct).addClass('disable');					
525				}
526                else if( pos == $items.length -1 )
527				{
528					$('.view_scroll_right_' + currentProduct).addClass('disable');
529				}
530				else
531				{
532					$('.view_scroll_left_' + currentProduct).removeClass('disable');
533					$('.view_scroll_right_' + currentProduct).removeClass('disable');
534				}
535			},
536        });
537        $('.thumbs_list_' + currentProduct).trigger('goto', 1);// SerialScroll Bug on goto 0 ?
538        $('.thumbs_list_' + currentProduct).trigger('goto', 0);
539 //   }   
540}
541function addEffectProducts(){
542    
543    if(typeof(leoOption) != 'undefined' && leoOption.product_list_image){
544        $(".leo-more-info").each(function() {
545            addJSProduct($(this).data("idproduct"));
546        });
547        addEffectProduct();
548    }
549}
550
551function addEffectProduct() {
552    var speed = 800;
553    var effect = "easeInOutQuad";
554
555    //$(".products_block .carousel-inner .ajax_block_product:first-child").mouseenter(function() {
556        //$(".products_block .carousel-inner").css("overflow", "inherit");
557    //});
558    //$(".carousel-inner").mouseleave(function() {
559        //$(".carousel-inner").css("overflow", "hidden");
560    //});
561
562    $(".leo-more-info").each(function() {
563        var leo_preview = this;
564        $(leo_preview).find(".leo-hover-image").each(function() {
565            $(this).mouseover(function() {
566                var big_image = $(this).attr("rel");
567                var imgElement = $(leo_preview).parent().find(".product-thumbnail img").first();
568                if (!imgElement.length) {
569                    imgElement = $(leo_preview).parent().find(".product_image img").first();
570                }
571
572                if (imgElement.length) {
573                    $(imgElement).stop().animate({opacity: 0}, {duration: speed, easing: effect});
574                    $(imgElement).first().attr("src", big_image);
575                    $(imgElement).first().attr("data-rel", big_image);
576                    $(imgElement).stop().animate({opacity: 1}, {duration: speed, easing: effect});
577                }
578				//DONGND:: change class when hover another image
579				if (!$(this).hasClass('shown'))
580				{
581					$(leo_preview).find('.shown').removeClass('shown');
582					$(this).parent().addClass('shown');
583				}
584            });
585        });
586
587        $('.thickbox-ajax-'+$(this).data("idproduct")).fancybox({
588            helpers: {
589                overlay: {
590                    locked: false
591                }
592            },
593            'hideOnContentClick': true,
594            'transitionIn'  : 'elastic',
595            'transitionOut' : 'elastic'
596        });
597    });
598}
599
600function addEffOneImg() {
601    var speed = 800;
602    var effect = "easeInOutQuad";
603
604    $(".product-additional").each(function() {
605        if ($(this).find("img").length) {
606            var leo_hover_image = $(this).parent().find("img").first();
607            var leo_preview = $(this);
608            $(this).parent().mouseenter(function() {
609                $(this).find("img").first().stop().animate({opacity: 0}, {duration: speed, easing: effect});
610                $(leo_preview).stop().animate({opacity: 1}, {duration: speed, easing: effect});
611            });
612            $(this).parent().mouseleave(function() {
613                $(this).find("img").first().stop().animate({opacity: 1}, {duration: speed, easing: effect});
614                $(leo_preview).stop().animate({opacity: 0}, {duration: speed, easing: effect});
615            });
616        }
617    });
618}
619function log(message) {
620    console.log(message);
621}
622
623//DONGND:: action animation
624function activeAnimation()
625{
626	$(".has-animation").each(function() {
627		onScrollInit($(this));
628	});
629}
630
631function onScrollInit(items) {
632    items.each(function() {
633        var osElement = $(this);
634        var animation = $(osElement).data("animation");
635        var osAnimationDelay = $(osElement).data("animation-delay");
636		var osAnimationDuration = $(osElement).data("animation-duration");
637		var osAnimationIterationCount = $(osElement).data("animation-iteration-count");
638		var osAnimationInfinite = $(osElement).data("animation-infinite");
639		if (osAnimationInfinite == 1)
640		{
641			var loop_animation = 'infinite';
642		}
643		else
644		{
645			var loop_animation = osAnimationIterationCount;
646		}
647        osElement.css({
648            "-webkit-animation-delay": osAnimationDelay,
649            "-moz-animation-delay": osAnimationDelay,
650            "animation-delay": osAnimationDelay,
651			"-webkit-animation-duration": osAnimationDuration,
652            "-moz-animation-duration": osAnimationDuration,
653            "animation-duration": osAnimationDuration,
654			"-webkit-animation-iteration-count": loop_animation,
655            "-moz-animation-iteration-count": loop_animation,
656            "animation-iteration-count": loop_animation,
657        });
658        
659        osElement.waypoint(function() {		
660			if (osElement.hasClass('has-animation'))
661			{					
662				osElement.addClass('animated '+ animation).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){					
663					$(this).removeClass('has-animation animated ' +animation);					
664				});			
665			}            
666	
667			this.destroy();
668        }, {
669            triggerOnce: true,
670            offset: '100%'
671        });
672    });
673}
674/**
675 * End block functions common for front-end
676 */
677
678
679/**
680 * End block for module ap_gmap
681 */
682function synSize(name) {
683    var obj = $("#" + name);
684    var div = $(obj).closest(".gmap-cover");
685    var gmap = $(div).find(".gmap");
686    $(obj).height($(gmap).height());
687    //console.log($(gmap).height());
688}
689function apshowmore(){
690    /**
691     * Start block for module ap_product_list
692     */
693    $(".btn-show-more").click(function() {
694        var page = parseInt($(this).data('page'));
695        var use_animation = parseInt($(this).data('use-animation'));
696        var btn = $(this);
697        var config = $(this).closest(".ApProductList").find(".apconfig").val();
698
699        // FIX 1.7
700        btn.data('reset-text', btn.html() );
701        btn.html(  btn.data('loading-text') );
702        
703        $.ajax({
704            headers: {"cache-control": "no-cache"},
705            url: prestashop.urls.base_url + 'modules/appagebuilder/apajax.php',
706            async: true,
707            cache: false,
708            dataType: "Json",
709            data: {"config": config, "p": page, "use_animation": use_animation},
710            success: function(response) {
711                var boxCover = $(btn).closest(".box-show-more");
712                if(!response.is_more) {
713                    $(boxCover).removeClass("open").fadeOut();
714                }
715                if(response.html) {
716                    $(boxCover).prev().append(response.html);
717                }
718                $(btn).data("page", (page + 1));
719                
720                if (typeof $.LeoCustomAjax !== "undefined" && $.isFunction($.LeoCustomAjax)) {
721                    var leoCustomAjax = new $.LeoCustomAjax();
722                    leoCustomAjax.processAjax();
723                }
724                
725                //DONGND:: class function of leofeature
726                callLeoFeature();
727                
728                //DONGND:: re call run animation
729                activeAnimation();
730                
731                //run swipe image after load image
732                btn.parents('.ApProductList').find('.product-list-images-mobile').each(function(){
733                    if ($(this).children().length > 1 && !$(this).hasClass('slick-slider')) {
734                        $(this).slick({
735                            slidesToShow: 1,
736                            slidesToScroll: 1,
737                            arrows: true,
738                            dots: true,
739                            infinite: false,
740                            rtl: $('body').hasClass('lang-rtl') ? true : false,
741                        });
742                    }
743                });
744            }
745        }).always(function () {
746            // FIX 1.7
747            btn.html(  btn.data('reset-text') );
748        });
749    });
750    /**
751     * End block for module ap_product_list
752     */
753    /**
754     * Start block for module ap_image
755     */     
756    /**
757     * End block for module ap_image
758     */
759}
760
761(function ($) {
762
763    window.addRule = function (selector, styles, sheet) {
764
765        styles = (function (styles) {
766            if (typeof styles === "string") return styles;
767            var clone = "";
768            for (var prop in styles) {
769                if (styles.hasOwnProperty(prop)) {
770                    var val = styles[prop];
771                    prop = prop.replace(/([A-Z])/g, "-$1").toLowerCase(); // convert to dash-case
772                    clone += prop + ":" + (prop === "content" ? '"' + val + '"' : val) + "; ";
773                }
774            }
775            return clone;
776        }(styles));
777        
778
779
780        try {
781            sheet = sheet || document.styleSheets[document.styleSheets.length - 1];
782            if (sheet.insertRule)
783            {
784                // if(!(navigator.userAgent.toLowerCase().indexOf('firefox') > -1))		// FIX work on firefox
785                            // {
786                    if(sheet.cssRules!==null && sheet.cssRules.length!== 0)
787                        sheet.insertRule(selector + " {" + styles + "}", sheet.cssRules.length);
788                // }
789            }
790            else if (sheet.addRule) sheet.addRule(selector, styles);
791        }
792        catch(err) {
793            // way 2 : https://stackoverflow.com/questions/28930846/how-to-use-cssstylesheet-insertrule-properly
794            var style = (function() {
795                var style = document.createElement("style");
796                style.appendChild(document.createTextNode(""));
797                document.head.appendChild(style);
798                return style;
799            })();
800            style.sheet.insertRule(selector + " {" + styles + "}", 0);
801            
802            
803        }
804//        window.console.log(sheet);
805//        window.console.log(selector);
806//        window.console.log(styles);
807        return this;
808
809    };
810
811    if ($) $.fn.addRule = function (styles, sheet) {
812        addRule(this.selector, styles, sheet);
813        return this;
814    };
815
816}(this.jQuery || this.Zepto));
817function apPopupForm(){
818    if($.cookie('apnewletter')) return;
819    $.fancybox({
820            'content' : $(".ap-popup").html(),
821            'wrapCSS' : 'ap-popup-clone',
822            afterClose: function (event, ui) {
823				
824            },
825			beforeShow: function (event, ui) {
826                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'>
826"+turnoff_popup_text+"</label></div>");			
827				$("body").find("#turnoff-popup-bt").trigger('click');
828                $.cookie('apnewletter', '1');
829                $('.turnoff-popup').addClass('active');
830                $('.turnoff-popup').click(function(){
831                    if (!$(this).hasClass('active'))
832                    {
833                        $.cookie('apnewletter', '1');
834                        $(this).addClass('active');
835                    }
836                    else
837                    {
838                        $.cookie('apnewletter', null);
839                        $(this).removeClass('active');
840                    }
841                })
842            }
843    });
844}
845//set background and parallax
846$(document).ready(function(){
847    //ap product list show more
848    if($(".btn-show-more").length) apshowmore();
849	//DONGND:: call active anmation	
850    activeAnimation();
851    if($(".ajaxtabcate").length){
852        $('input:radio[name=ajaxtabcate]').click(function() {
853            $(".leo-ajax-tabs").each(function(){
854                //if have product
855                if($(this).find(".product-image").length || $(this).find(".product-title").length){
856                    $(this).removeClass('loaded');
857                    if (typeof $.LeoCustomAjax !== "undefined" && $.isFunction($.LeoCustomAjax)) {
858                        var leoCustomAjax = new $.LeoCustomAjax();
859                        leoCustomAjax.processAjax();
860                    }
861                }
862            });
863        });
864    }
865    if($(".tabs-dropdown-menu").length){
866        $(".tabs-dropdown-menu").each(function(){
867            wraper = $(this).parent();
868            tabdrop = $(this);
869            if($(this).hasClass("selecttext")){
870                nav_active = $(wraper).find(".nav-link").first();
871                $(this).find('button').html($(nav_active).find("span").html());
872            }
873            $(this).find('.dropdown-item').first().addClass('active');
874            $(wraper).find('.nav-link').click(function(){
875                if($(this).hasClass('active')){
876                    return;
877                }
878                $(tabdrop).find('.dropdown-item').removeClass('active');
879                cclass = $(this).attr('class');
880                var strArray = cclass.split(" ");
881                formClass = "";
882                for(var i = 0; i < strArray.length; i++){
883                    if(strArray[i].indexOf('form') >=0 ){
884                        formClass = strArray[i];
885                        break;
886                    }
887                }
888                $(wraper).find('.dropdown-item.'+formClass).addClass('active');
889            });
890
891            $(tabdrop).find('.dropdown-item').click(function(){
892                $(wraper).find('.nav-link').removeClass('active');
893                cclass = $(this).attr('class');
894                var strArray = cclass.split(" ");
895                formClass = "";
896                for(var i = 0; i < strArray.length; i++){
897                    if(strArray[i].indexOf('form') >=0 ){
898                        formClass = strArray[i];
899                        break;
900                    }
901                }
902                $(wraper).find('.nav-link.'+formClass).trigger('click');
903            });
904
905        });
906    }
907    
908    //show popup
909    if($('.ap-popup').length){
910        if($('.ap-popup').hasClass('index-only') && $('body').attr('id') == 'index')
911            apPopupForm();
912        else
913            apPopupForm();
914    }
915
916    $(".has-bg.bg-fullwidth").each(function(){
917        id = "#"+$(this).attr("id");
918        bg = "";
919        if ($(this).data("src") !== undefined) bg = "url("+$(this).data("src")+")";
920        bg += $(this).data("bg_data");
921        $(id + ":before").addRule({
922            background: bg
923        });
924    });
925    //stela
926    if (typeof stellar !== 'undefined' && stellar)
927            $.stellar({horizontalScrolling:false});
928
929    //mouse
930    currentPosX = [];
931    currentPosY = [];
932    $("div[data-mouse-parallax-strength]").each(function(){
933        currentPos = $(this).css("background-position");
934        if (typeof currentPos == "string")
935        {
936            currentPosArray = currentPos.split(" ");
937        }else
938        {
939            currentPosArray = [$(this).css("background-position-x"),$(this).css("background-position-y")];
940        }
941        currentPosX[$(this).data("mouse-parallax-rid")] = parseFloat(currentPosArray[0]);
942        currentPosY[$(this).data("mouse-parallax-rid")] = parseFloat(currentPosArray[1]);
943        $(this).mousemove(function(e){
944            newPosX = currentPosX[$(this).data("mouse-parallax-rid")];
945            newPosY = currentPosY[$(this).data("mouse-parallax-rid")];
946            if($(this).data("mouse-parallax-axis") != "axis-y"){
947                mparallaxPageX = e.pageX - $(this).offset().left;
948                if($(this).hasClass("full-bg-screen"))
949                {
950                    mparallaxPageX = mparallaxPageX - 1000;
951                }
952                newPosX = (mparallaxPageX * $(this).data("mouse-parallax-strength") * -1) + newPosX;
953            }
954            if($(this).data("mouse-parallax-axis") !="axis-x"){
955                mparallaxPageY = e.pageY - $(this).offset().top;
956                newPosY = mparallaxPageY * $(this).data("mouse-parallax-strength") * -1;
957            }
958            $(this).css("background-position",newPosX+"px "+newPosY+"px");
959        });
960    });
961
962    var ytIframeId; var ytVideoId;
963    function onYouTubeIframeAPIReady() {
964        $("div.iframe-youtube-api-tag").each(function(){
965            ytIframeId = $(this).attr("id");
966            ytVideoId = $(this).data("youtube-video-id");
967
968            new YT.Player(ytIframeId, {
969                videoId: ytVideoId,
970                width: "100%",
971                height: "100%",
972                playerVars :{autoplay:1,controls:0,disablekb:1,fs:0,cc_load_policy:0,
973                            iv_load_policy:3,modestbranding:0,rel:0,showinfo:0,start:0},
974                events: {
975                    "onReady": function(event){
976                        event.target.mute();
977                        setInterval(
978                            function(){event.target.seekTo(0);},
979                            (event.target.getDuration() - 1) * 1000
980                        );
981                    }
982                }
983            });
984        });
985    }
986    onYouTubeIframeAPIReady();
987    
988    if (typeof MediaElementPlayer !== 'undefined') {
989        //add function for html5 youtube video
990        var player1 = new MediaElementPlayer('#special-youtube-video1');
991        var player2 = new MediaElementPlayer('#special-youtube-video2');
992        if(player1)
993        {
994            var auto_find = setInterval(function(){
995                if($('#video-1 .mejs-overlay-play').html())
996                {
997                    $('#video-1 .mejs-overlay-play>.mejs-overlay-button').before('<div class="video-name">
997'+$('#special-youtube-video1').data('name')+'</div>');
998                    $('#video-1 .mejs-overlay-play').append('<div class="video-description">Watch video and <span>subscribe us<span></div>');   
999                    clearInterval(auto_find);
1000                }
1001            }, 500);
1002        }
1003        
1004        if(player2)
1005        {
1006            var auto_find1 = setInterval(function(){        
1007                if($('#video-2 .mejs-overlay-play').html())
1008                {
1009                    $('#video-2 .mejs-overlay-play>.mejs-overlay-button').before('<div class="video-name">'+$('#special-youtube-video2').data('name')+'</div>');
1010                    $('#video-2 .mejs-overlay-play').append('<div class="video-description">Watch video and <span>subscribe us<span></div>');   
1011                    clearInterval(auto_find1);              
1012                }
1013            }, 500);
1014        }
1015    }
1016    //js for select header, footer, content in demo
1017    current_url = window.location.href;
1018    $('.apconfig').each(function(){
1019        var enableJS = $(this).data('enablejs');
1020        if(enableJS == false){
1021            return;
1022        }
1023        var leochange = '&leopanelchange';
1024        var current_url = $(this).data('url');
1025        if( !current_url ){
1026            current_url = window.location.href;
1027            current_url = current_url.replace(leochange, "");
1028        }
1029        
1030        var param = $(this).data('type');
1031        var value = $(this).data('id');
1032        var re = new RegExp("([?|&])" + param + "=.*?(&|$)","i");
1033        if (current_url.match(re))
1034            $(this).attr('href', current_url.replace(re,'$1' + param + "=" + value + '$2') + leochange);
1035        else{
1036            if(current_url.indexOf('?') == -1)
1037                $(this).attr('href', current_url + '?' + param + "=" + value + leochange);
1038            else
1039                 $(this).attr('href', current_url + '&' + param + "=" + value + leochange);
1040                
1041        }
1042    });
1043	
1044	//DONGND:: fix owl carousel in tab load delay when resize.
1045	$(window).resize(function(){
1046		if($('.tab-pane .owl-carousel').length)
1047		{
1048			$('.tab-pane .owl-carousel').each(function(index, element){
1049				if(!$(element).parents('.tab-pane').hasClass('active') && typeof ($(element).data('owlCarousel')) !== "undefined")
1050				{
1051					var w_owl_active_tab = $(element).parents('.tab-pane').siblings('.active').find('.owl-carousel').width();
1052			
1053					$(element).width(w_owl_active_tab);
1054					$(element).data('owlCarousel').updateVars();
1055					$(element).width('100%');
1056				}
1057			});
1058		}
1059	})
1060	
1061	//DONGND:: loading owl carousel fake item
1062	var check_window_w = parseInt($(window).width());
1063	
1064	if (check_window_w >= 992 && check_window_w < 1200)
1065	{	   
1066	   addClassLoading('lg');
1067	}
1068	else if (check_window_w >= 768 && check_window_w < 992)
1069	{	  
1070	   addClassLoading('md');
1071	}
1072	else if (check_window_w >= 576 && check_window_w < 768)
1073	{	   
1074	   addClassLoading('sm');
1075	}
1076	else if (check_window_w < 576)
1077	{	   
1078	   addClassLoading('m');
1079	}
1080	else
1081	{		
1082		addClassLoading('xl');
1083	}
1084
1085	// swiper in mobile
1086    if($('.list-images-mobile').length && $('.list-images-mobile').children().length > 1) {
1087        $('.list-images-mobile').slick({
1088            slidesToShow: 1,
1089            slidesToScroll: 1,
1090            arrows: true,
1091            dots: true,
1092    	    infinite: false,
1093            rtl: $('body').hasClass('lang-rtl') ? true : false			
1094        });
1095    }
1096
1097    if($('.product-list-images-mobile').length) {
1098        if ($('body').hasClass('lang-rtl')) {
1099            $('.product-list-images-mobile').each(function(){
1100                if ($(this).children().length > 1) {
1101                    $(this).slick({
1102                        slidesToShow: 1,
1103                        slidesToScroll: 1,
1104                        arrows: true,
1105                        dots: true,
1106		        infinite: false,						
1107                        rtl: true
1108                    });
1109                }
1110            });
1111        } else{
1112            $('.product-list-images-mobile').each(function(){
1113                if ($(this).children().length > 1) {
1114                    $(this).slick({
1115                        slidesToShow: 1,
1116                        slidesToScroll: 1,
1117                        arrows: true,
1118                        dots: true,
1119		        infinite: false,						
1120                    });
1121                }
1122            });
1123        }
1124        
1125        //turn off swipe mode of owl-carousel when slide active on mobile
1126		$( document ).ajaxComplete(function( event, xhr, settings ) {
1127			if (settings.url.indexOf('apajax') > 0) {
1128				$('.product-list-images-mobile').each(function(){
1129					if($('.product-list-images-mobile').hasClass('slick-slider')){
1130						function offSlideCarousel(selector){
1131							selector.parents('.owl-item').on("touchstart mousedown", function(e) {
1132								// Prevent carousel swipe
1133								e.stopPropagation();
1134							});
1135						}
1136						if (window.addEventListener) {
1137							window.addEventListener("load", offSlideCarousel($(this)), false);
1138						}
1139						else if (window.attachEvent){
1140							window.attachEvent("onload", offSlideCarousel($(this)));
1141						}
1142						else {
1143							window.onload = offSlideCarousel($(this));
1144						}
1145					}
1146					
1147				});
1148			}
1149            //fix swipe after ajax in category
1150            if (settings.url.indexOf('from-xhr') > 0) {
1151                if ($('body').hasClass('lang-rtl')) {
1152                    $('.product-list-images-mobile').each(function(){
1153                        if ($(this).children().length > 1) {
1154                            $(this).slick({
1155                                slidesToShow: 1,
1156                                slidesToScroll: 1,
1157                                arrows: true,
1158                                dots: true,
1159                        infinite: false,                        
1160                                rtl: true
1161                            });
1162                        }
1163                    });
1164                } else{
1165                    $('.product-list-images-mobile').each(function(){
1166                        if ($(this).children().length > 1) {
1167                            $(this).slick({
1168                                slidesToShow: 1,
1169                                slidesToScroll: 1,
1170                                arrows: true,
1171                                dots: true,
1172                        infinite: false,                        
1173                            });
1174                        }
1175                    });
1176                }
1177            }
1178		});
1179    }
1180    if($("body").attr("id") == "product") {
1181        $( document ).ajaxComplete(function( event, xhr, settings ) {
1182            if (settings.url.indexOf('controller=product') > 0) {
1183                if($('.list-images-mobile').length && $('.list-images-mobile').children().length > 1) {
1184                    $('.list-images-mobile').slick({
1185                        slidesToShow: 1,
1186                        slidesToScroll: 1,
1187                        arrows: true,
1188                        dots: true, 
1189                        rtl: $('body').hasClass('lang-rtl') ? true : false
1190                    });
1191                }
1192            }
1193        });
1194    }
1195});
1196
1197//DONGND:: add class loading by width of window
1198function addClassLoading($type)
1199{
1200	$('.timeline-wrapper').each(function(){		
1201		if ($(this).data($type) <= $(this).data('item'))
1202		{			
1203			var num_remove_item = $(this).data('item') - $(this).data($type);
1204			if ($(this).data($type) < $(this).data('item'))
1205			{
1206				var num_remove_item = $(this).data('item') - $(this).data($type);
1207				$(this).find('.timeline-parent').slice(-num_remove_item).remove();
1208			}
1209			
1210			if (12%$(this).data($type) == 0)
1211			{
1212				if ($type == 'm')
1213				{
1214					$(this).find('.timeline-parent').addClass('col-xs-'+12/$(this).data($type));
1215				}
1216				else
1217				{
1218					$(this).find('.timeline-parent').addClass('col-'+$type+'-'+12/$(this).data($type));
1219				}
1220			}
1221			else
1222			{				
1223				$(this).find('.timeline-parent').css({'width': 100/$(this).data($type)+'%', 'float': 'left'})
1224			}
1225				
1226			$('.timeline-wrapper').removeClass('prepare');
1227		}
1228	})
1229}
1230
1231//DONGND:: call function from leofeature
1232function callLeoFeature()
1233{
1234	if(typeof (leoBtCart) != 'undefined')
1235	{		
1236		leoBtCart();
1237	}
1238	if(typeof (leoSelectAttr) != 'undefined')
1239	{
1240		leoSelectAttr();		
1241	}
1242	if(typeof (LeoWishlistButtonAction) != 'undefined')
1243	{	
1244		LeoWishlistButtonAction();		
1245	}
1246	if(typeof (LeoCompareButtonAction) != 'undefined')
1247	{		
1248		LeoCompareButtonAction();
1249	}
1250	if(typeof (actionQuickViewLoading) != 'undefined')
1251	{
1252		actionQuickViewLoading();
1253	}
1254}
1255
1256function SetOwlCarouselFirstLast(el){
1257    el.find(".owl-item").removeClass("first");
1258    el.find(".owl-item.active").first().addClass("first");
1259
1260    el.find(".owl-item").removeClass("last");
1261    el.find(".owl-item.active").last().addClass("last");
1262}
1263/**
1264 * List functions will run when document.ready()
1265 */
1266$(document).ready(function()
1267{
1268    if(typeof (ap_list_functions) != 'undefined')
1269    {
1270        $.each(ap_list_functions, function(i, val) {
1271            val();
1272            ap_list_functions[i] = null;
1273        });
1274    }
1275    //call function when ajax filter complete
1276    if ($("body").attr("id") == "category" && $('#search_filters').length) {
1277        $('.facet-label').on('click',function(){
1278            $( document ).ajaxComplete(function( event, xhr, settings ) {
1279                //click on filter call function
1280                if(typeof xhr != "undefined" && typeof xhr.responseJSON != "undefined" && typeof xhr.responseJSON.products != "undefined"){
1281                    if(typeof (ap_list_functions) != 'undefined')
1282                    {
1283                        $.each(ap_list_functions, function(i, val) {
1284                            if(typeof val != "undefined" && val != null){
1285                                val();    
1286                                ap_list_functions[i] = null;
1287                            }
1288                        });
1289                    }
1290                }                
1291            });
1292        });
1293    }
1294});
1295
1296/**
1297 * List functions will run when window.load()
1298 */
1299$(window).load(function(){
1300	if(typeof (ap_list_functions_loaded) != 'undefined')
1301    {
1302        for (var i = 0; i < ap_list_functions_loaded.length; i++) {
1303            ap_list_functions_loaded[i]();
1304        }
1305    }
1306})
1307
1308$(document).ready(function() {
1309    if ($('#sitemap').length > 0) {
1310       $('#sitemap .sitemap').prepend(leo_site_map); 
1311    }
1312
1313    if($('.lazy').length && jQuery().lazy) {
1314        $(function() {
1315            $('.lazy').lazy({effect: 'fadeIn'});
1316        });
1317           
1318        $( document ).ajaxComplete(function() {          
1319            if($('.lazy').length) {                
1320                $('.lazy').lazy({effect: 'fadeIn'});
1321            }
1322        }); 
1323    }
1324    
1325    // REPLACE URL IN BLOCKLANGUAGES
1326    if(typeof approfile_multilang_url != "undefined") {
1327         $.each(approfile_multilang_url, function(index, profile){
1328            var url_search = prestashop.urls.base_url + profile.iso_code;
1329            var url_change = prestashop.urls.base_url + profile.iso_code + '/' + profile.friendly_url + '.html';
1330            
1331            //console.log(url_change);
1332                        
1333			//DONGND:: update for module blockgrouptop and default
1334			if ($('#leo_block_top').length)
1335			{
1336				var parent_o = $('#leo_block_top .language-selector');
1337			}
1338			else
1339			{
1340				var parent_o = $('.language-selector-wrapper');
1341			}
1342			
1343			parent_o.find('li a').each(function(){
1344				
1345				var lang_href = $(this).attr('href');
1346				
1347				if(lang_href.indexOf(url_search) > -1 )
1348				{
1349					//window.console.log('--' + url_change);
1350					$(this).attr('href', url_change);
1351					//window.console.log(url_change);
1352				}
1353			});
1354			
1355        });
1356    }
1357    
1358	//DONGND:: update for module blockgrouptop and default
1359	if ($('#leo_block_top').length)
1360	{
1361		var parent_o_currency = $('#leo_block_top .currency-selector');
1362	}
1363	else
1364	{
1365		var parent_o_currency = $('.currency-selector');
1366	}
1367    
1368    // REPLACE URL IN BLOCKLANGUAGES
1369	parent_o_currency.find('li a').each(function(){
1370		
1371        var url_link = $(this).attr('href');
1372        var id_currency = getParamFromURL("id_currency", url_link);
1373        var SubmitCurrency = getParamFromURL("SubmitCurrency", url_link);
1374        
1375        var current_url = window.location.href;
1376		//DONGND:: fix for only product page, url has #
1377		if (prestashop.page.page_name == 'product')
1378		{			
1379			var current_url = prestashop.urls.current_url;		
1380		}
1381        var current_url = removeParamFromURL('SubmitCurrency',current_url);
1382        var current_url = removeParamFromURL('id_currency',current_url);
1383        
1384        if(current_url.indexOf('?') == -1){
1385            var new_url = current_url + '?SubmitCurrency=' + SubmitCurrency + "&id_currency=" +id_currency;
1386            $(this).attr('href', new_url);
1387        }
1388        else{
1389            var new_url = current_url + '&SubmitCurrency=' + SubmitCurrency + "&id_currency=" +id_currency;
1390            $(this).attr('href', new_url);
1391        }
1392    });
1393    
1394    
1395    prestashop.on('updateProductList', function() {
1396        // FIX BUG : FILTER PRODUCT NOT SHOW MORE IMAGE
1397        if (typeof $.LeoCustomAjax !== "undefined" && $.isFunction($.LeoCustomAjax)) {
1398            var leoCustomAjax = new $.LeoCustomAjax();
1399            leoCustomAjax.processAjax();
1400        }
1401    });
1402	
1403    // auto get link product and add to demo link on megamenu to show multi product detail
1404    if ($('.demo-product-detail[data-menu-type=url] a').length && prestashop.page.page_name != 'product')
1405    {
1406        $.ajax({
1407            type: 'POST',
1408            headers: {"cache-control": "no-cache"},
1409            url: prestashop.urls.base_url + 'modules/appagebuilder/apajax.php' + '?rand=' + new Date().getTime(),
1410            async: true,
1411            cache: false,
1412            dataType: "json",
1413            data: {"action": "get-product-link"},
1414            success: function (jsonData) {				
1415                if (jsonData)
1416                {
1417                    $('.demo-product-detail[data-menu-type=url] a').each(function(){						
1418                        var original_url = $(this).attr('href');
1419                        var layout_key = original_url.substring(original_url.indexOf('?layout='));
1420
1421                        var new_url = jsonData.replace('.html', '.html'+layout_key);
1422                        $(this).attr('href',new_url).addClass('updated');
1423                    });
1424                    if($('.lazy').length && jQuery().lazy) {
1425                        if (lazyLoadInstance) {
1426                            lazyLoadInstance.update();
1427                        }
1428                    }
1429                }
1430
1431            },
1432            error: function () {
1433            }
1434        });
1435    }
1436});
1437
1438function removeParamFromURL(key, sourceURL) {
1439
1440    var rtn = sourceURL.split("?")[0],
1441        param,
1442        params_arr = [],
1443        queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
1444
1445    
1446    if (queryString !== "") {
1447        params_arr = queryString.split("&");
1448        for (var i = params_arr.length - 1; i >= 0; i -= 1) {
1449            param = params_arr[i].split("=")[0];
1450            if (param === key) {
1451                params_arr.splice(i, 1);
1452            }
1453        }
1454        if(params_arr.length > 0){
1455            rtn = rtn + "?" + params_arr.join("&");
1456        }
1457    }
1458    return rtn;
1459}
1460
1461function getParamFromURL(key, sourceURL) {
1462
1463    var rtn = sourceURL.split("?")[0],
1464        param,
1465        params_arr = [],
1466        queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
1467
1468    if (queryString !== "") {
1469        params_arr = queryString.split("&");
1470        
1471        for (var i = params_arr.length - 1; i >= 0; i -= 1) {
1472            param = params_arr[i].split("=")[0];
1473            if (param === key) {
1474                return params_arr[i].split("=")[1];
1475            }
1476        }
1477    }
1478    return false;
1479}

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.