312. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2023-07-12 04:43:09 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

312.1 Files compared

#LocationFileLast Modified
1Porto v4.0.5/Theme Files/Porto Theme/app/design/frontend/Smartwave/porto/Mageplaza_LayeredNavigation/web/js/viewlayer.js2023-03-07 10:58:50 +0000
2Porto v4.0.6/Theme Files/Porto Theme/app/design/frontend/Smartwave/porto/Mageplaza_LayeredNavigation/web/js/viewlayer.js2023-07-02 09:00:31 +0000

312.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged121044
Changed622
Inserted326
Removed214

312.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

312.4 Active regular expressions

No regular expressions were active.

312.5 Comparison detail

1 /** 1 /**
2  * Mageplaza 2  * Mageplaza
3  * 3  *
4  * NOTICE OF LICENSE 4  * NOTICE OF LICENSE
5  * 5  *
6  * This source file is subject to the Mageplaza.com license sliderConfig is 6  * This source file is subject to the Mageplaza.com license sliderConfig is
7  * available through the world-wide-web at this URL: 7  * available through the world-wide-web at this URL:
8  * https://www.mageplaza.com/LICENSE.txt 8  * https://www.mageplaza.com/LICENSE.txt
9  * 9  *
10  * DISCLAIMER 10  * DISCLAIMER
11  * 11  *
12  * Do not edit or add to this file if you wish to upgrade this extension to newer 12  * Do not edit or add to this file if you wish to upgrade this extension to newer
13  * version in the future. 13  * version in the future.
14  * 14  *
15  * @category    Mageplaza 15  * @category    Mageplaza
16  * @package     Mageplaza_LayeredNavigation 16  * @package     Mageplaza_LayeredNavigation
17  * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/) 17  * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/)
18  * @license     https://www.mageplaza.com/LICENSE.txt 18  * @license     https://www.mageplaza.com/LICENSE.txt
19  */ 19  */
20  20 
21 define([ 21 define([
22     'jquery', 22     'jquery',
23     'Mageplaza_AjaxLayer/js/action/submit-filter', 23     'Mageplaza_AjaxLayer/js/action/submit-filter',
24     'Magento_Catalog/js/price-utils', 24     'Magento_Catalog/js/price-utils',
25     'accordion', 25     'accordion',
26     'productListToolbarForm', 26     'productListToolbarForm',
27     'jquery/jquery-ui' 27     'jquery/jquery-ui'
28 ], function ($, submitFilterAction, ultil) { 28 ], function ($, submitFilterAction, ultil) {
29     "use strict"; 29     "use strict";
30     var next_page = ""; 30     var next_page = "";
31     var loading = false; 31     var loading = false;
32     var infinite_loaded_count = 0; 32     var infinite_loaded_count = 0;
33     var active = false; 33     var active = false;
34  34 
35     $.widget('mageplaza.layer', $.mage.accordion, { 35     $.widget('mageplaza.layer', $.mage.accordion, {
36         options: { 36         options: {
37             openedState: 'active', 37             openedState: 'active',
38             collapsible: true, 38             collapsible: true,
39             multipleCollapsible: true, 39             multipleCollapsible: true,
40             animate: 200, 40             animate: 200,
41             productsListSelector: '#layer-product-list', 41             productsListSelector: '#layer-product-list',
42             mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', 42             mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]',
43             collapsibleElement: '[data-role=ln_collapsible]', 43             collapsibleElement: '[data-role=ln_collapsible]',
44             header: '[data-role=ln_title]', 44             header: '[data-role=ln_title]',
45             content: '[data-role=ln_content]', 45             content: '[data-role=ln_content]',
46             isCustomerLoggedIn: false, 46             isCustomerLoggedIn: false,
47             isAjax: true, 47             isAjax: true,
48             params: [], 48             params: [],
49             active: [], 49             active: [],
    50             activeDesktop: [],
    51             activeMobile: [],
50             checkboxEl: 'input[type=checkbox], input[type=radio]', 52             checkboxEl: 'input[type=checkbox], input[type=radio]',
51             sliderElementPrefix: '#ln_slider_', 53             sliderElementPrefix: '#ln_slider_',
52             sliderTextElementPrefix: '#ln_slider_text_' 54             sliderTextElementPrefix: '#ln_slider_text_'
53         }, 55         },
54  56 
    57         _create: function () {
    58             this.initActiveItems();
    59 
    60             this._super();
    61 
    62             this.initProductListUrl();
    63             this.initObserve();
    64             this.initSlider();
    65             this.initWishlistCompare();
    66             this.selectedAttr();
    67             this.renderCategoryTree();
    68         },
    69 
55         inFinite: function() { 70         inFinite: function() {
56             var self = this; 71             var self = this;
57             next_page = ""; 72             next_page = "";
58             if($(self.options.productsListSelector +' .infinite-loader').length > 0){ 73             if($(self.options.productsListSelector +' .infinite-loader').length > 0){
59                 active = true; 74                 active = true;
60             } 75             }
61             $(".pages-items li > a.next").each(function(){ 76             $(".pages-items li > a.next").each(function(){
62                 next_page = $(this).attr("href"); 77                 next_page = $(this).attr("href");
63             }); 78             });
64             if(!next_page){ 79             if(!next_page){
65                 $('.infinite-loader').hide(); 80                 $('.infinite-loader').hide();
66             } 81             }
67             $(window).scroll(function(){ 82             $(window).scroll(function(){
68                 if(!loading && next_page && active && $(".infinite-loader").hasClass('scrolling') && $(window).scrollTop() >= $(".infinite-loader").offset().top-$(window).height()+100){ 83                 if(!loading && next_page && active && $(".infinite-loader").hasClass('scrolling') && $(window).scrollTop() >= $(".infinite-loader").offset().top-$(window).height()+100){
69                     loading = true; 84                     loading = true;
70                     $(".pages-items li > a.next").each(function(){ 85                     $(".pages-items li > a.next").each(function(){
71                         next_page = $(this).attr("href"); 86                         next_page = $(this).attr("href");
72                     }); 87                     });
73                     self.ajaxInfinite(next_page); 88                     self.ajaxInfinite(next_page);
74                 } 89                 }
75             }); 90             });
76             $(".infinite-loader .btn-load-more").click(function(){ 91             $(".infinite-loader .btn-load-more").click(function(){
77                 if(!loading && next_page){ 92                 if(!loading && next_page){
78                     loading = true; 93                     loading = true;
79                     self.ajaxInfinite(next_page); 94                     self.ajaxInfinite(next_page);
80                 } 95                 }
81             }); 96             });
82         }, 97         },
83  98 
84         ajaxInfinite: function (submitUrl) { 99         ajaxInfinite: function (submitUrl) {
85             var self = this; 100             var self = this;
86             infinite_loaded_count++; 101             infinite_loaded_count++;
87             $('.infinite-loader .btn-load-more').hide(); 102             $('.infinite-loader .btn-load-more').hide();
88             $('.infinite-loader .loading').hide(); 103             $('.infinite-loader .loading').hide();
89             $.ajax({ 104             $.ajax({
90                 url: submitUrl, 105                 url: submitUrl,
91                 type: 'get', 106                 type: 'get',
92                 beforeSend: function () { 107                 beforeSend: function () {
93                     $('.infinite-loader .btn-load-more').hide(); 108                     $('.infinite-loader .btn-load-more').hide();
94                     $('.infinite-loader .loading').show(); 109                     $('.infinite-loader .loading').show();
95                 }, 110                 },
96                 success: function (res) { 111                 success: function (res) {
97                     loading = false; 112                     loading = false;
98                     var $products = $(res.products); 113                     var $products = $(res.products);
99                     if (res.backUrl) { 114                     if (res.backUrl) {
100                         window.location = res.backUrl; 115                         window.location = res.backUrl;
101                         return; 116                         return;
102                     } 117                     }
103                     if($products){ 118                     if($products){
104                         $products.each(function(i,el){ 119                         $products.each(function(i,el){
105                             if($(el).hasClass('products-grid')){ 120                             if($(el).hasClass('products-grid')){
106                                 var items_grid = $(this).find('.product-items .item'); 121                                 var items_grid = $(this).find('.product-items .item');
107                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); 122                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid);
108                                 $(self.options.productsListSelector).trigger('contentUpdated'); 123                                 $(self.options.productsListSelector).trigger('contentUpdated');
109                             } 124                             }
110                             if($(el).hasClass('products-list')){ 125                             if($(el).hasClass('products-list')){
111                                 var items_list = $(this).find('.product-items .item'); 126                                 var items_list = $(this).find('.product-items .item');
112                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); 127                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list);
113                                 $(self.options.productsListSelector).trigger('contentUpdated'); 128                                 $(self.options.productsListSelector).trigger('contentUpdated');
114                             } 129                             }
115                             if($(el).hasClass('toolbar-products')){ 130                             if($(el).hasClass('toolbar-products')){
116                                 if($(this).find('.pages a.next').length > 0){ 131                                 if($(this).find('.pages a.next').length > 0){
117                                     $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href')); 132                                     $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href'));
118                                 }else{ 133                                 }else{
119                                     $(self.options.productsListSelector + ' .pages a.next').remove(); 134                                     $(self.options.productsListSelector + ' .pages a.next').remove();
120                                 } 135                                 }
121                             } 136                             }
122                         }); 137                         });
123                         if($("form[data-role=tocart-form]").length > 0 && !redirect_cart) { 138                         if($("form[data-role=tocart-form]").length > 0 && !redirect_cart) {
124                             $("form[data-role=tocart-form]").catalogAddToCart(); 139                             $("form[data-role=tocart-form]").catalogAddToCart();
125                         } 140                         }
126                         $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); 141                         $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n');
127                         $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); 142                         $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1');
128                         $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); 143                         $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n');
129                         $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); 144                         $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1');
130                         $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); 145                         $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n');
131                         $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); 146                         $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1');
132                         $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); 147                         $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n');
133                         $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); 148                         $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1');
134                         $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); 149                         $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n');
135                         $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); 150                         $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1');
136                         $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); 151                         $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n');
137                         $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); 152                         $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1');
138                         $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); 153                         $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n');
139                         $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); 154                         $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1');
140                         var hist = submitUrl; 155                         var hist = submitUrl;
141                         if(submitUrl.indexOf("p=") > -1){ 156                         if(submitUrl.indexOf("p=") > -1){
142                             var len = submitUrl.length-submitUrl.indexOf("p="); 157                             var len = submitUrl.length-submitUrl.indexOf("p=");
143                             var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); 158                             var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len);
144                             var page_param = ""; 159                             var page_param = "";
145                             if(str_temp.indexOf("&") == -1){ 160                             if(str_temp.indexOf("&") == -1){
146                                 page_param = str_temp; 161                                 page_param = str_temp;
147                             } else { 162                             } else {
148                                 page_param = str_temp.substr(0,str_temp.indexOf("&")); 163                                 page_param = str_temp.substr(0,str_temp.indexOf("&"));
149                             } 164                             }
150                             hist = submitUrl.replace(page_param, ""); 165                             hist = submitUrl.replace(page_param, "");
151                         } 166                         }
152                         if (typeof window.history.pushState === 'function') { 167                         if (typeof window.history.pushState === 'function') {
153                             window.history.pushState({url: hist}, '', hist); 168                             window.history.pushState({url: hist}, '', hist);
154                         } 169                         }
155                         if(typeof enable_quickview != 'undefined' && enable_quickview == true) { 170                         if(typeof enable_quickview != 'undefined' && enable_quickview == true) {
156                             requirejs(['jquery', 'weltpixel_quickview' ], 171                             requirejs(['jquery', 'weltpixel_quickview' ],
157                                 function($, quickview) { 172                                 function($, quickview) {
158                                     $('.weltpixel-quickview').off('click').on('click', function() { 173                                     $('.weltpixel-quickview').off('click').on('click', function() {
159                                         var prodUrl = $(this).attr('data-quickview-url'); 174                                         var prodUrl = $(this).attr('data-quickview-url');
160                                         if (prodUrl.length) { 175                                         if (prodUrl.length) {
161                                             quickview.displayContent(prodUrl); 176                                             quickview.displayContent(prodUrl);
162                                         } 177                                         }
163                                     }); 178                                     });
164                                 }); 179                                 });
165                         } 180                         }
166                         $(".products-grid .weltpixel-quickview").each(function(){ 181                         $(".products-grid .weltpixel-quickview").each(function(){
167                             $(this).appendTo($(this).parent().parent().children(".product-item-photo")); 182                             $(this).appendTo($(this).parent().parent().children(".product-item-photo"));
168                         }); 183                         });
169                         $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); 184                         $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"});
170                         if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { 185                         if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) {
171                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { 186                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() {
172                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); 187                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');
173                             }); 188                             });
174                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { 189                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() {
175                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); 190                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');
176                             }); 191                             });
177                         } 192                         }
178                         self.initWishlistCompare(); 193                         self.initWishlistCompare();
179                         next_page = ""; 194                         next_page = "";
180                         $(".pages-items li > a.next").each(function(){ 195                         $(".pages-items li > a.next").each(function(){
181                             next_page = $(this).attr("href"); 196                             next_page = $(this).attr("href");
182                         }); 197                         });
183                         $('.infinite-loader .loading').hide(); 198                         $('.infinite-loader .loading').hide();
184                         if(next_page){ 199                         if(next_page){
185                             $('.infinite-loader .btn-load-more').show(); 200                             $('.infinite-loader .btn-load-more').show();
186                             $(".infinite-loader .btn-load-more").unbind("click").click(function(){ 201                             $(".infinite-loader .btn-load-more").unbind("click").click(function(){
187                                 if(!loading && next_page){ 202                                 if(!loading && next_page){
188                                     loading = true; 203                                     loading = true;
189                                     self.ajaxInfinite(next_page); 204                                     self.ajaxInfinite(next_page);
190                                 } 205                                 }
191                             }); 206                             });
192                         } 207                         }
193                     } 208                     }
194  209 
195                 }, 210                 },
196                 error: function () { 211                 error: function () {
197                     window.location.reload(); 212                     window.location.reload();
198                 } 213                 }
199             }); 214             });
200         }, 215         },
201  216 
202         _create: function () {    
203             this.initActiveItems();    
204     
205             this._super();    
206     
207             this.initProductListUrl();    
208             this.initObserve();    
209             this.initSlider();    
210             this.initWishlistCompare();    
211             this.selectedAttr();    
212             this.renderCategoryTree();    
213         },    
214     
215         initActiveItems: function () { 217         initActiveItems: function () {
216             var layerActives = this.options.active, 218             var layerActivesDesktop = this.options.activeDesktop,
217                 actives = []; 219                 layerActivesMobile  = this.options.activeMobile,
    220                 activesDesktop = [],
    221                 activesMobile = [];
218             if ($(".page-layout-1column").length){ 222             if ($(".page-layout-1column").length){
219                 this.options.multipleCollapsible = false; 223                 this.options.multipleCollapsible = false;
220             } 224             }
221  225 
222             if (typeof window.layerActiveTabs !== 'undefined') { 226             if (typeof window.layerActiveTabs !== 'undefined') {
223                 layerActives = window.layerActiveTabs; 227                 layerActivesDesktop, layerActivesMobile = window.layerActiveTabs;
224             } 228             }
225             if (layerActives.length) { 229             if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
    230                 || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) {
    231                 if (layerActivesMobile.length) {
226                 this.element.find('.filter-options-item').each(function (index) { 232                     this.element.find('.filter-options-item').each(function (index) {
227                     if (~$.inArray($(this).attr('attribute')layerActives)) { 233                         if (~$.inArray($(this).attr('attribute')layerActivesMobile)) {
228                         actives.push(index); 234                             activesMobile.push(index);
229                     } 235                         }
230                 }); 236                     });
231             } 237                 }
232  238                 this.options.active activesMobile;
233             this.options.active actives;    
234     
235             return this; 239                 return this;
    240             }else{
    241                 if (layerActivesDesktop.length) {
    242                     this.element.find('.filter-options-item').each(function (index) {
    243                         if (~$.inArray($(this).attr('attribute'), layerActivesDesktop)) {
    244                             activesDesktop.push(index);
    245                         }
    246                     });
    247                 }
    248                 this.options.active = activesDesktop;
    249                 return this;
    250             }
236         }, 251         },
237  252 
238         initProductListUrl: function () { 253         initProductListUrl: function () {
239             var isProcessToolbar = false, 254             var isProcessToolbar = false,
240                 isAjax = this.options.isAjax; 255                 isAjax = this.options.isAjax;
241             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { 256             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) {
242                 if (isProcessToolbar) { 257                 if (isProcessToolbar) {
243                     return; 258                     return;
244                 } 259                 }
245                 if (isAjax) { 260                 if (isAjax) {
246                     isProcessToolbar = true; 261                     isProcessToolbar = true;
247                 } 262                 }
248  263 
249                 var urlPaths = this.options.url.split('?'), 264                 var urlPaths = this.options.url.split('?'),
250                     baseUrl = urlPaths[0], 265                     baseUrl = urlPaths[0],
251                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], 266                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [],
252                     paramData = {}, 267                     paramData = {},
253                     parameters; 268                     parameters;
254                 for (var i = 0; i < urlParams.length; i++) { 269                 for (var i = 0; i < urlParams.length; i++) {
255                     parameters = urlParams[i].split('='); 270                     parameters = urlParams[i].split('=');
256                     paramData[parameters[0]] = parameters[1] !== undefined 271                     paramData[parameters[0]] = parameters[1] !== undefined
257                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) 272                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20'))
258                         : ''; 273                         : '';
259                 } 274                 }
260                 paramData[paramName] = paramValue; 275                 paramData[paramName] = paramValue;
261                 if (paramValue === defaultValue) { 276                 if (paramValue === defaultValue) {
262                     delete paramData[paramName]; 277                     delete paramData[paramName];
263                 } 278                 }
264                 paramData = $.param(paramData); 279                 paramData = $.param(paramData);
265                 if (isAjax) { 280                 if (isAjax) {
266                     submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); 281                     submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : ''));
267                 } else location.href = baseUrl + (paramData.length ? '?' + paramData : ''); 282                 } else location.href = baseUrl + (paramData.length ? '?' + paramData : '');
268             } 283             }
269         }, 284         },
270  285 
271         initObserve: function () { 286         initObserve: function () {
272             var self = this; 287             var self = this;
273             var isAjax = this.options.isAjax; 288             var isAjax = this.options.isAjax;
274  289 
275             // fix browser back, forward button 290             // fix browser back, forward button
276             if (typeof window.history.replaceState === "function") { 291             if (typeof window.history.replaceState === "function") {
277                 window.history.replaceState({url: document.URL}, document.title); 292                 window.history.replaceState({url: document.URL}, document.title);
278  293 
279                 setTimeout(function () { 294                 setTimeout(function () {
280                     window.onpopstate = function (e) { 295                     window.onpopstate = function (e) {
281                         if (e.state) { 296                         if (e.state) {
282                             submitFilterAction(e.state.url, 1); 297                             submitFilterAction(e.state.url, 1);
283                         } 298                         }
284                     }; 299                     };
285                 }, 0) 300                 }, 0)
286             } 301             }
287  302 
288             var pageElements = $('#layer-product-list').find('.pages a'); 303             var pageElements = $('#layer-product-list').find('.pages a');
289             pageElements.each(function () { 304             pageElements.each(function () {
290                 var el = $(this), 305                 var el = $(this),
291                     link = self.checkUrl(el.prop('href')); 306                     link = self.checkUrl(el.prop('href'));
292                 if (!link) { 307                 if (!link) {
293                     return; 308                     return;
294                 } 309                 }
295  310 
296                 el.bind('click', function (e) { 311                 el.bind('click', function (e) {
297                     e.stopPropagation(); 312                     e.stopPropagation();
298                     e.preventDefault(); 313                     e.preventDefault();
299                     if (isAjax) { 314                     if (isAjax) {
300                         submitFilterAction(link); 315                         submitFilterAction(link);
301                     } else location.href = link; 316                     } else location.href = link;
302                 }) 317                 })
303             }); 318             });
304  319 
305             var currentElements = this.element.find('.filter-current a, .filter-actions a'); 320             var currentElements = this.element.find('.filter-current a, .filter-actions a');
306             currentElements.each(function (index) { 321             currentElements.each(function (index) {
307                 var el = $(this), 322                 var el = $(this),
308                     link = self.checkUrl(el.prop('href')); 323                     link = self.checkUrl(el.prop('href'));
309                 if (!link) { 324                 if (!link) {
310                     return; 325                     return;
311                 } 326                 }
312  327 
313                 el.bind('click', function (e) { 328                 el.bind('click', function (e) {
314                     e.stopPropagation(); 329                     e.stopPropagation();
315                     e.preventDefault(); 330                     e.preventDefault();
316                     if (isAjax) { 331                     if (isAjax) {
317                         submitFilterAction(link); 332                         submitFilterAction(link);
318                     } else { 333                     } else {
319                         location.href = link; 334                         location.href = link;
320                     } 335                     }
321                 }); 336                 });
322             }); 337             });
323  338 
324             var optionElements = this.element.find('.filter-options a'); 339             var optionElements = this.element.find('.filter-options a');
325             optionElements.each(function (index) { 340             optionElements.each(function (index) {
326                 var el = $(this), 341                 var el = $(this),
327                     link = self.checkUrl(el.prop('href')); 342                     link = self.checkUrl(el.prop('href'));
328                 if (!link) { 343                 if (!link) {
329                     return; 344                     return;
330                 } 345                 }
331  346 
332                 el.bind('click', function (e) { 347                 el.bind('click', function (e) {
333                     if (el.hasClass('swatch-option-link-layered')) { 348                     if (el.hasClass('swatch-option-link-layered')) {
334                         self.selectSwatchOption(el); 349                         self.selectSwatchOption(el);
335                     } else { 350                     } else {
336                         var checkboxEl = el.siblings(self.options.checkboxEl); 351                         var checkboxEl = el.siblings(self.options.checkboxEl);
337                         checkboxEl.prop('checked', !checkboxEl.prop('checked')); 352                         checkboxEl.prop('checked', !checkboxEl.prop('checked'));
338                     } 353                     }
339  354 
340                     e.stopPropagation(); 355                     e.stopPropagation();
341                     e.preventDefault(); 356                     e.preventDefault();
342                     self.ajaxSubmit(link); 357                     self.ajaxSubmit(link);
343                 }); 358                 });
344  359 
345                 var checkbox = el.siblings(self.options.checkboxEl); 360                 var checkbox = el.siblings(self.options.checkboxEl);
346                 checkbox.bind('click', function (e) { 361                 checkbox.bind('click', function (e) {
347                     e.stopPropagation(); 362                     e.stopPropagation();
348                     self.ajaxSubmit(link); 363                     self.ajaxSubmit(link);
349                 }); 364                 });
350             }); 365             });
351  366 
352             var swatchElements = this.element.find('.swatch-attribute'); 367             var swatchElements = this.element.find('.swatch-attribute');
353             swatchElements.each(function (index) { 368             swatchElements.each(function (index) {
354                 var el = $(this); 369                 var el = $(this);
355                 var attCode = el.attr('attribute-code'); 370                 var attCode = el.attr('attribute-code');
356                 if (attCode) { 371                 if (attCode) {
357                     if (self.options.params.hasOwnProperty(attCode)) { 372                     if (self.options.params.hasOwnProperty(attCode)) {
358                         var attValues = self.options.params[attCode].split(","); 373                         var attValues = self.options.params[attCode].split(",");
359                         var swatchOptions = el.find('.swatch-option'); 374                         var swatchOptions = el.find('.swatch-option');
360                         swatchOptions.each(function (option) { 375                         swatchOptions.each(function (option) {
361                             var elOption = $(this); 376                             var elOption = $(this);
362                             if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { 377                             if ($.inArray(elOption.attr('option-id'), attValues) !== -1) {
363                                 elOption.addClass('selected'); 378                                 elOption.addClass('selected');
364                             } 379                             }
365                         }); 380                         });
366                     } 381                     }
367                 } 382                 }
368             }); 383             });
369     
370             if(typeof enable_quickview != 'undefined' && enable_quickview == true) { 384             if(typeof enable_quickview != 'undefined' && enable_quickview == true) {
371                 requirejs(['jquery', 'weltpixel_quickview' ], 385                 requirejs(['jquery', 'weltpixel_quickview' ],
372                     function($, quickview) { 386                     function($, quickview) {
373                         $('.weltpixel-quickview').off('click').on('click', function() { 387                         $('.weltpixel-quickview').off('click').on('click', function() {
374                             var prodUrl = $(this).attr('data-quickview-url'); 388                             var prodUrl = $(this).attr('data-quickview-url');
375                             if (prodUrl.length) { 389                             if (prodUrl.length) {
376                                 quickview.displayContent(prodUrl); 390                                 quickview.displayContent(prodUrl);
377                             } 391                             }
378                         }); 392                         });
379                     }); 393                     });
380             } 394             }
381  395 
382             $(".products-grid .weltpixel-quickview").each(function(){ 396             $(".products-grid .weltpixel-quickview").each(function(){
383                 $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo")); 397                 $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo"));
384             }); 398             });
385             $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); 399             $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"});
386             if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { 400             if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) {
387                 $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { 401                 $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() {
388                     $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); 402                     $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');
389                 }); 403                 });
390             } 404             }
391             if(isAjax) { 405             if(isAjax) {
392                 self.inFinite(); 406                 self.inFinite();
393             }else{ 407             }else{
394                 $('.infinite-loader').hide(); 408                 $('.infinite-loader').hide();
395             } 409             }
396         }, 410         },
397  411 
398         selectSwatchOption: function (el) { 412         selectSwatchOption: function (el) {
399             var childEl = el.find('.swatch-option'); 413             var childEl = el.find('.swatch-option');
400             if (childEl.hasClass('selected')) { 414             if (childEl.hasClass('selected')) {
401                 childEl.removeClass('selected'); 415                 childEl.removeClass('selected');
402             } else { 416             } else {
403                 childEl.addClass('selected'); 417                 childEl.addClass('selected');
404             } 418             }
405         }, 419         },
406  420 
407         initSlider: function () { 421         initSlider: function () {
408             var self = this, 422             var self = this,
409                 slider = this.options.slider; 423                 slider = this.options.slider;
410  424 
411             for (var code in slider) { 425             for (var code in slider) {
412                 if (slider.hasOwnProperty(code)) { 426                 if (slider.hasOwnProperty(code)) {
413                     var sliderConfig = slider[code], 427                     var sliderConfig = slider[code],
414                         sliderElement = self.element.find(this.options.sliderElementPrefix + code), 428                         sliderElement = self.element.find(this.options.sliderElementPrefix + code),
415                         priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null; 429                         priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null;
416  430 
417                     if (sliderElement.length) { 431                     if (sliderElement.length) {
418                         sliderElement.slider({ 432                         sliderElement.slider({
419                             range: true, 433                             range: true,
420                             min: sliderConfig.minValue, 434                             min: sliderConfig.minValue,
421                             max: sliderConfig.maxValue, 435                             max: sliderConfig.maxValue,
422                             values: [sliderConfig.selectedFrom, sliderConfig.selectedTo], 436                             values: [sliderConfig.selectedFrom, sliderConfig.selectedTo],
423                             slide: function (event, ui) { 437                             slide: function (event, ui) {
424                                 self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat); 438                                 self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat);
425                             }, 439                             },
426                             change: function (event, ui) { 440                             change: function (event, ui) {
427                                 self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1])); 441                                 self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1]));
428                             } 442                             }
429                         }); 443                         });
430                     } 444                     }
431                     self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat); 445                     self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat);
432                 } 446                 }
433             } 447             }
434         }, 448         },
435  449 
436         displaySliderText: function (code, from, to, format) { 450         displaySliderText: function (code, from, to, format) {
437             var textElement = this.element.find(this.options.sliderTextElementPrefix + code); 451             var textElement = this.element.find(this.options.sliderTextElementPrefix + code);
438             if (textElement.length) { 452             if (textElement.length) {
439                 if (format !== null) { 453                 if (format !== null) {
440                     from = this.formatPrice(from, format); 454                     from = this.formatPrice(from, format);
441                     to = this.formatPrice(to, format); 455                     to = this.formatPrice(to, format);
442                 } 456                 }
443  457 
444                 textElement.html(from + ' - ' + to); 458                 textElement.html(from + ' - ' + to);
445             } 459             }
446         }, 460         },
447  461 
448         getSliderUrl: function (url, from, to) { 462         getSliderUrl: function (url, from, to) {
449             return url.replace('from-to', from + '-' + to); 463             return url.replace('from-to', from + '-' + to);
450         }, 464         },
451  465 
452         formatPrice: function (value, format) { 466         formatPrice: function (value, format) {
453             return ultil.formatPrice(value, format); 467             return ultil.formatPrice(value, format);
454         }, 468         },
455  469 
456         ajaxSubmit: function (submitUrl) { 470         ajaxSubmit: function (submitUrl) {
457             var isAjax = this.options.isAjax; 471             var isAjax = this.options.isAjax;
458             this.element.find(this.options.mobileShopbyElement).trigger('click'); 472             this.element.find(this.options.mobileShopbyElement).trigger('click');
459  473 
460             if (isAjax) {  474             if (isAjax) {
461                 return submitFilterAction(submitUrl); 475                 return submitFilterAction(submitUrl);
462             } 476             }
463             location.href = submitUrl; 477             location.href = submitUrl;
464         }, 478         },
465  479 
466         checkUrl: function (url) { 480         checkUrl: function (url) {
467             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; 481             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
468  482 
469             return regex.test(url) ? url : null; 483             return regex.test(url) ? url : null;
470         }, 484         },
471  485 
472         //Handling 'add to wishlist' & 'add to compare' event 486         //Handling 'add to wishlist' & 'add to compare' event
473         initWishlistCompare: function () { 487         initWishlistCompare: function () {
474             var isAjax = this.options.isAjax; 488             var isAjax = this.options.isAjax;
475             var isCustomerLoggedIn = this.options.isCustomerLoggedIn, 489             var isCustomerLoggedIn = this.options.isCustomerLoggedIn,
476                 elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); 490                 elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : '');
477             $(elClass).each(function () { 491             $(elClass).each(function () {
478                 var el = $(this); 492                 var el = $(this);
479                 if (isAjax){ 493                 if (isAjax){
480                     $(el).bind('click', function (e) { 494                     $(el).bind('click', function (e) {
481                         var dataPost = $(el).data('post'), 495                         var dataPost = $(el).data('post'),
482                             formKey = $('input[name="form_key"]').val(), method = 'post'; 496                             formKey = $('input[name="form_key"]').val(), method = 'post';
483                         if (formKey) { 497                         if (formKey) {
484                             dataPost.data.form_key = formKey; 498                             dataPost.data.form_key = formKey;
485                         } 499                         }
486  500 
487                         var paramData = $.param(dataPost.data), 501                         var paramData = $.param(dataPost.data),
488                             url = dataPost.action + (paramData.length ? '?' + paramData : ''); 502                             url = dataPost.action + (paramData.length ? '?' + paramData : '');
489  503 
490                         e.stopPropagation(); 504                         e.stopPropagation();
491                         e.preventDefault(); 505                         e.preventDefault();
492  506 
493                         if (el.hasClass('towishlist')) { 507                         if (el.hasClass('towishlist')) {
494                             submitFilterAction(url, true, method); 508                             submitFilterAction(url, true, method);
495                         } else{ 509                         } else{
496                             submitFilterAction(url, true, method); 510                             submitFilterAction(url, true, method);
497                         } 511                         }
498                     }); 512                     });
499                 } 513                 }
500             }) 514             })
501         }, 515         },
502  516 
503         //Selected attribute color after page load. 517         //Selected attribute color after page load.
504         selectedAttr: function () { 518         selectedAttr: function () {
505             var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value'); 519             var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value');
506  520 
507             filterCurrent.each(function(){ 521             filterCurrent.each(function(){
508                 var el         = $(this), 522                 var el         = $(this),
509                     colorLabel = el.html(), 523                     colorLabel = el.html(),
510                     swatchAttr  = $('.filter-options .filter-options-item .swatch-option-link-layered .swatch-option'); 524                     swatchAttr  = $('.filter-options .filter-options-item .swatch-option-link-layered .swatch-option');
511  525 
512                 swatchAttr.each(function(){ 526                 swatchAttr.each(function(){
513                     var elA = $(this); 527                     var elA = $(this);
514                     if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){ 528                     if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){
515                         elA.addClass('selected'); 529                         elA.addClass('selected');
516                     } 530                     }
517                 }); 531                 });
518             }); 532             });
519         }, 533         },
520  534 
521         renderCategoryTree: function () { 535         renderCategoryTree: function () {
522             var iconExpand = this.element.find('.filter-options .icon-expand'); 536             var iconExpand = this.element.find('.filter-options .icon-expand');
523  537 
524             iconExpand.each(function () { 538             iconExpand.each(function () {
525                 var el = $(this); 539                 var el = $(this);
526  540 
527                 el.nextAll('ol').each(function() { 541                 el.nextAll('ol').each(function() {
528                     if($(this).find('input[checked]').length !== 0 542                     if($(this).find('input[checked]').length !== 0
529                         && !$(this).prevAll('.icon-expand').hasClass('active') 543                         && !$(this).prevAll('.icon-expand').hasClass('active')
530                     ) { 544                     ) {
531                         $(this).show(); 545                         $(this).show();
532                         $(this).prevAll('.icon-expand').toggleClass('active'); 546                         $(this).prevAll('.icon-expand').toggleClass('active');
533                     } 547                     }
534                 }); 548                 });
535  549 
536                 el.bind('click', function (e) { 550                 el.bind('click', function (e) {
537                     el.nextAll('ol').toggle(); 551                     el.nextAll('ol').toggle();
538                     el.toggleClass('active'); 552                     el.toggleClass('active');
539                     e.stopPropagation(); 553                     e.stopPropagation();
540                 }); 554                 });
541             }); 555             });
542         } 556         }
543     }); 557     });
544  558 
545     return $.mageplaza.layer; 559     return $.mageplaza.layer;
546 }); 560 });