17. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2020-08-14 00:01:30 +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.

17.1 Files compared

#LocationFileLast Modified
1Porto v3.2.3/Magento 2.x/Porto Theme/app/code/Mageplaza/AjaxLayer/view/frontend/web/js/viewlayer.js2018-10-10 20:33:22 +0000
2Porto v3.2.4/Magento 2.x/Porto Theme/app/code/Mageplaza/AjaxLayer/view/frontend/web/js/viewlayer.js2020-06-26 11:11:14 +0000

17.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged2442
Changed00
Inserted113
Removed00

17.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

17.4 Active regular expressions

No regular expressions were active.

17.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 that is 6  * This source file is subject to the Mageplaza.com license that 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_AjaxLayer 16  * @package     Mageplaza_AjaxLayer
17  * @copyright   Copyright (c) Mageplaza (http://www.mageplaza.com/) 17  * @copyright   Copyright (c) Mageplaza (http://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     'jquery/ui', 25     'jquery/ui',
26     'accordion', 26     'accordion',
27     'productListToolbarForm' 27     'productListToolbarForm'
28 ], function ($, submitFilterAction, ultil) { 28 ], function ($, submitFilterAction, ultil) {
29     "use strict"; 29     "use strict";
30  30 
31     $.widget('mageplaza.layer', $.mage.accordion, { 31     $.widget('mageplaza.layer', $.mage.accordion, {
32         options: { 32         options: {
33             openedState: 'active', 33             openedState: 'active',
34             collapsible: true, 34             collapsible: true,
35             multipleCollapsible: true, 35             multipleCollapsible: true,
36             animate: 200, 36             animate: 200,
37             mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', 37             mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]',
38             collapsibleElement: '[data-role=ln_collapsible]', 38             collapsibleElement: '[data-role=ln_collapsible]',
39             header: '[data-role=ln_title]', 39             header: '[data-role=ln_title]',
40             content: '[data-role=ln_content]', 40             content: '[data-role=ln_content]',
41             isCustomerLoggedIn: false, 41             isCustomerLoggedIn: false,
42             params: [], 42             params: [],
43             active: [] 43             active: []
44         }, 44         },
45  45 
46         _create: function () { 46         _create: function () {
47             this.initActiveItems(); 47             this.initActiveItems();
48  48 
49             this._super(); 49             this._super();
50  50 
51             this.initProductListUrl(); 51             this.initProductListUrl();
52             this.initObserve(); 52             this.initObserve();
53             this.initWishlistCompare(); 53             this.initWishlistCompare();
54         }, 54         },
55  55 
56         initActiveItems: function () { 56         initActiveItems: function () {
57             var layerActives = this.options.active, 57             var layerActives = this.options.active,
58                 actives = []; 58                 actives = [];
59  59 
60             if (typeof window.layerActiveTabs !== 'undefined') { 60             if (typeof window.layerActiveTabs !== 'undefined') {
61                 layerActives = window.layerActiveTabs; 61                 layerActives = window.layerActiveTabs;
62             } 62             }
63             if (layerActives.length) { 63             if (layerActives.length) {
64                 this.element.find('.filter-options-item').each(function (index) { 64                 this.element.find('.filter-options-item').each(function (index) {
65                     if (~$.inArray($(this).attr('attribute'), layerActives)) { 65                     if (~$.inArray($(this).attr('attribute'), layerActives)) {
66                         actives.push(index); 66                         actives.push(index);
67                     } 67                     }
68                 }); 68                 });
69             } 69             }
70  70 
71             this.options.active = actives; 71             this.options.active = actives;
72  72 
73             return this; 73             return this;
74         }, 74         },
75  75 
76         initProductListUrl: function () { 76         initProductListUrl: function () {
77             var isProcessToolbar = false; 77             var isProcessToolbar = false;
78             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { 78             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) {
79                 if (isProcessToolbar) { 79                 if (isProcessToolbar) {
80                     return; 80                     return;
81                 } 81                 }
82                 isProcessToolbar = true; 82                 isProcessToolbar = true;
83  83 
84                 var urlPaths = this.options.url.split('?'), 84                 var urlPaths = this.options.url.split('?'),
85                     baseUrl = urlPaths[0], 85                     baseUrl = urlPaths[0],
86                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], 86                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [],
87                     paramData = {}, 87                     paramData = {},
88                     parameters; 88                     parameters;
89                 for (var i = 0; i < urlParams.length; i++) { 89                 for (var i = 0; i < urlParams.length; i++) {
90                     parameters = urlParams[i].split('='); 90                     parameters = urlParams[i].split('=');
91                     paramData[parameters[0]] = parameters[1] !== undefined 91                     paramData[parameters[0]] = parameters[1] !== undefined
92                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) 92                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20'))
93                         : ''; 93                         : '';
94                 } 94                 }
95                 paramData[paramName] = paramValue; 95                 paramData[paramName] = paramValue;
96                 if (paramValue === defaultValue) { 96                 if (paramValue === defaultValue) {
97                     delete paramData[paramName]; 97                     delete paramData[paramName];
98                 } 98                 }
99                 paramData = $.param(paramData); 99                 paramData = $.param(paramData);
100                 submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); 100                 submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : ''));
101             } 101             }
102         }, 102         },
103  103 
104         initObserve: function () { 104         initObserve: function () {
105             var self = this; 105             var self = this;
106  106 
    107             // fix browser back, forward button
    108             if (typeof window.history.replaceState === "function") {
    109                 window.history.replaceState({url: document.URL}, document.title);
    110 
    111                 setTimeout(function () {
    112                     window.onpopstate = function (e) {
    113                         if (e.state) {
    114                             submitFilterAction(e.state.url, 1);
    115                         }
    116                     };
    117                 }, 0)
    118             }
    119 
107             var pageElements = $('#layer-product-list').find('.pages a'); 120             var pageElements = $('#layer-product-list').find('.pages a');
108             pageElements.each(function () { 121             pageElements.each(function () {
109                 var el = $(this), 122                 var el = $(this),
110                     link = self.checkUrl(el.prop('href')); 123                     link = self.checkUrl(el.prop('href'));
111                 if (!link) { 124                 if (!link) {
112                     return; 125                     return;
113                 } 126                 }
114  127 
115                 el.bind('click', function (e) { 128                 el.bind('click', function (e) {
116                     submitFilterAction(link); 129                     submitFilterAction(link);
117                     e.stopPropagation(); 130                     e.stopPropagation();
118                     e.preventDefault(); 131                     e.preventDefault();
119                 }) 132                 })
120             }); 133             });
121  134 
122             var currentElements = this.element.find('.filter-current a, .filter-actions a'); 135             var currentElements = this.element.find('.filter-current a, .filter-actions a');
123             currentElements.each(function (index) { 136             currentElements.each(function (index) {
124                 var el = $(this), 137                 var el = $(this),
125                     link = self.checkUrl(el.prop('href')); 138                     link = self.checkUrl(el.prop('href'));
126                 if (!link) { 139                 if (!link) {
127                     return; 140                     return;
128                 } 141                 }
129  142 
130                 el.bind('click', function (e) { 143                 el.bind('click', function (e) {
131                     submitFilterAction(link); 144                     submitFilterAction(link);
132                     e.stopPropagation(); 145                     e.stopPropagation();
133                     e.preventDefault(); 146                     e.preventDefault();
134                 }); 147                 });
135             }); 148             });
136  149 
137             var optionElements = this.element.find('.filter-options a'); 150             var optionElements = this.element.find('.filter-options a');
138             optionElements.each(function (index) { 151             optionElements.each(function (index) {
139                 var el = $(this), 152                 var el = $(this),
140                     link = self.checkUrl(el.prop('href')); 153                     link = self.checkUrl(el.prop('href'));
141                 if (!link) { 154                 if (!link) {
142                     return; 155                     return;
143                 } 156                 }
144  157 
145                 el.bind('click', function (e) { 158                 el.bind('click', function (e) {
146                     if (el.hasClass('swatch-option-link-layered')) { 159                     if (el.hasClass('swatch-option-link-layered')) {
147                         self.selectSwatchOption(el); 160                         self.selectSwatchOption(el);
148                     } 161                     }
149  162 
150                     self.ajaxSubmit(link); 163                     self.ajaxSubmit(link);
151                     e.stopPropagation(); 164                     e.stopPropagation();
152                     e.preventDefault(); 165                     e.preventDefault();
153                 }); 166                 });
154             }); 167             });
155  168 
156             var swatchElements = this.element.find('.swatch-attribute'); 169             var swatchElements = this.element.find('.swatch-attribute');
157             swatchElements.each(function (index) { 170             swatchElements.each(function (index) {
158                 var el = $(this); 171                 var el = $(this);
159                 var attCode = el.attr('attribute-code'); 172                 var attCode = el.attr('attribute-code');
160                 if (attCode) { 173                 if (attCode) {
161                     if (self.options.params.hasOwnProperty(attCode)) { 174                     if (self.options.params.hasOwnProperty(attCode)) {
162                         var attValues = self.options.params[attCode].split(","); 175                         var attValues = self.options.params[attCode].split(",");
163                         var swatchOptions = el.find('.swatch-option'); 176                         var swatchOptions = el.find('.swatch-option');
164                         swatchOptions.each(function (option) { 177                         swatchOptions.each(function (option) {
165                             var elOption = $(this); 178                             var elOption = $(this);
166                             if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { 179                             if ($.inArray(elOption.attr('option-id'), attValues) !== -1) {
167                                 elOption.addClass('selected'); 180                                 elOption.addClass('selected');
168                             } 181                             }
169                         }); 182                         });
170                     } 183                     }
171                 } 184                 }
172             }); 185             });
173         }, 186         },
174  187 
175         selectSwatchOption: function (el) { 188         selectSwatchOption: function (el) {
176             var childEl = el.find('.swatch-option'); 189             var childEl = el.find('.swatch-option');
177             if (childEl.hasClass('selected')) { 190             if (childEl.hasClass('selected')) {
178                 childEl.removeClass('selected'); 191                 childEl.removeClass('selected');
179             } else { 192             } else {
180                 childEl.addClass('selected'); 193                 childEl.addClass('selected');
181             } 194             }
182         }, 195         },
183  196 
184         ajaxSubmit: function (submitUrl) { 197         ajaxSubmit: function (submitUrl) {
185             this.element.find(this.options.mobileShopbyElement).trigger('click'); 198             this.element.find(this.options.mobileShopbyElement).trigger('click');
186  199 
187             return submitFilterAction(submitUrl); 200             return submitFilterAction(submitUrl);
188         }, 201         },
189  202 
190         checkUrl: function (url) { 203         checkUrl: function (url) {
191             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; 204             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
192  205 
193             return regex.test(url) ? url : null; 206             return regex.test(url) ? url : null;
194         }, 207         },
195  208 
196         //Handling 'add to wishlist' & 'add to compare' event 209         //Handling 'add to wishlist' & 'add to compare' event
197         initWishlistCompare: function () { 210         initWishlistCompare: function () {
198             var isCustomerLoggedIn = this.options.isCustomerLoggedIn, 211             var isCustomerLoggedIn = this.options.isCustomerLoggedIn,
199                 elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); 212                 elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : '');
200             $(elClass).each(function () { 213             $(elClass).each(function () {
201                 var el = $(this); 214                 var el = $(this);
202                 $(el).bind('click', function (e) { 215                 $(el).bind('click', function (e) {
203                     var dataPost = $(el).data('post'), 216                     var dataPost = $(el).data('post'),
204                         formKey = $('input[name="form_key"]').val(); 217                         formKey = $('input[name="form_key"]').val();
205                     if (formKey) { 218                     if (formKey) {
206                         dataPost.data.form_key = formKey; 219                         dataPost.data.form_key = formKey;
207                     } 220                     }
208  221 
209                     var paramData = $.param(dataPost.data), 222                     var paramData = $.param(dataPost.data),
210                         url = dataPost.action + (paramData.length ? '?' + paramData : ''); 223                         url = dataPost.action + (paramData.length ? '?' + paramData : '');
211  224 
212                     submitFilterAction(url, true); 225                     submitFilterAction(url, true);
213                     e.stopPropagation(); 226                     e.stopPropagation();
214                     e.preventDefault(); 227                     e.preventDefault();
215                 }); 228                 });
216             }) 229             })
217         } 230         }
218     }); 231     });
219  232 
220     return $.mageplaza.layer; 233     return $.mageplaza.layer;
221 }); 234 });