83. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2023-03-13 03:00:44 +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.

83.1 Files compared

#LocationFileLast Modified
1Porto v4.0.4/Porto Theme/app/code/Mageplaza/LayeredNavigation/view/frontend/web/jslayer.js2016-10-19 20:44:28 +0000
2Porto v4.0.5/Porto Theme/app/code/Mageplaza/LayeredNavigation/view/frontend/web/jslayer.js2016-10-19 20:44:28 +0000

83.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged1288
Changed00
Inserted00
Removed00

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

83.4 Active regular expressions

No regular expressions were active.

83.5 Comparison detail

1 /** 1 /**
2  * Copyright ? 2016 Mageplaza. All rights reserved. 2  * Copyright ? 2016 Mageplaza. All rights reserved.
3  * See https://www.mageplaza.com/LICENSE.txt for license details. 3  * See https://www.mageplaza.com/LICENSE.txt for license details.
4  */ 4  */
5 define([ 5 define([
6     'jquery', 6     'jquery',
7     'jquery/ui', 7     'jquery/ui',
8     'productListToolbarForm' 8     'productListToolbarForm'
9 ], function ($) { 9 ], function ($) {
10     "use strict"; 10     "use strict";
11  11 
12     $.widget('mageplaza.layer', { 12     $.widget('mageplaza.layer', {
13  13 
14         options: { 14         options: {
15             productsListSelector: '#layer-product-list', 15             productsListSelector: '#layer-product-list',
16             navigationSelector: '#layered-filter-block' 16             navigationSelector: '#layered-filter-block'
17         }, 17         },
18  18 
19         _create: function () { 19         _create: function () {
20             this.initProductListUrl(); 20             this.initProductListUrl();
21             this.initObserve(); 21             this.initObserve();
22             this.initLoading(); 22             this.initLoading();
23         }, 23         },
24  24 
25         initProductListUrl: function () { 25         initProductListUrl: function () {
26             var self = this; 26             var self = this;
27             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { 27             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) {
28                 var urlPaths = this.options.url.split('?'), 28                 var urlPaths = this.options.url.split('?'),
29                     baseUrl = urlPaths[0], 29                     baseUrl = urlPaths[0],
30                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], 30                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [],
31                     paramData = {}, 31                     paramData = {},
32                     parameters; 32                     parameters;
33                 for (var i = 0; i < urlParams.length; i++) { 33                 for (var i = 0; i < urlParams.length; i++) {
34                     parameters = urlParams[i].split('='); 34                     parameters = urlParams[i].split('=');
35                     paramData[parameters[0]] = parameters[1] !== undefined 35                     paramData[parameters[0]] = parameters[1] !== undefined
36                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) 36                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20'))
37                         : ''; 37                         : '';
38                 } 38                 }
39                 paramData[paramName] = paramValue; 39                 paramData[paramName] = paramValue;
40                 if (paramValue == defaultValue) { 40                 if (paramValue == defaultValue) {
41                     delete paramData[paramName]; 41                     delete paramData[paramName];
42                 } 42                 }
43                 paramData = $.param(paramData); 43                 paramData = $.param(paramData);
44  44 
45                 self.ajaxSubmit(baseUrl + (paramData.length ? '?' + paramData : '')); 45                 self.ajaxSubmit(baseUrl + (paramData.length ? '?' + paramData : ''));
46             } 46             }
47         }, 47         },
48  48 
49         initObserve: function () { 49         initObserve: function () {
50             var self = this; 50             var self = this;
51             var aElements = this.element.find('a'); 51             var aElements = this.element.find('a');
52             aElements.each(function (index) { 52             aElements.each(function (index) {
53                 var el = $(this); 53                 var el = $(this);
54                 var link = self.checkUrl(el.prop('href')); 54                 var link = self.checkUrl(el.prop('href'));
55                 if(!link) return; 55                 if(!link) return;
56  56 
57                 el.off('click').on('click', function (e) { 57                 el.off('click').on('click', function (e) {
58                     if (el.hasClass('swatch-option-link-layered')) { 58                     if (el.hasClass('swatch-option-link-layered')) {
59                         var childEl = el.find('.swatch-option'); 59                         var childEl = el.find('.swatch-option');
60                         childEl.addClass('selected'); 60                         childEl.addClass('selected');
61                     } else { 61                     } else {
62                         var checkboxEl = el.find('input[type=checkbox]'); 62                         var checkboxEl = el.find('input[type=checkbox]');
63                         checkboxEl.prop('checked', !checkboxEl.prop('checked')); 63                         checkboxEl.prop('checked', !checkboxEl.prop('checked'));
64                     } 64                     }
65  65 
66                     self.ajaxSubmit(link); 66                     self.ajaxSubmit(link);
67                     e.stopPropagation(); 67                     e.stopPropagation();
68                     e.preventDefault(); 68                     e.preventDefault();
69                 }); 69                 });
70  70 
71                 var checkbox = el.find('input[type=checkbox]'); 71                 var checkbox = el.find('input[type=checkbox]');
72                 checkbox.off('click').on('click', function (e) { 72                 checkbox.off('click').on('click', function (e) {
73                     self.ajaxSubmit(link); 73                     self.ajaxSubmit(link);
74                     e.stopPropagation(); 74                     e.stopPropagation();
75                 }); 75                 });
76             }); 76             });
77  77 
78             $(".filter-current a").off('click').on('click', function (e) { 78             $(".filter-current a").off('click').on('click', function (e) {
79                 var link = self.checkUrl($(this).prop('href')); 79                 var link = self.checkUrl($(this).prop('href'));
80                 if(!link) return; 80                 if(!link) return;
81  81 
82                 self.ajaxSubmit(link); 82                 self.ajaxSubmit(link);
83                 e.stopPropagation(); 83                 e.stopPropagation();
84                 e.preventDefault(); 84                 e.preventDefault();
85             }); 85             });
86  86 
87             $(".filter-actions a").off('click').on('click', function (e) { 87             $(".filter-actions a").off('click').on('click', function (e) {
88                 var link = self.checkUrl($(this).prop('href')); 88                 var link = self.checkUrl($(this).prop('href'));
89                 if(!link) return; 89                 if(!link) return;
90  90 
91                 self.ajaxSubmit(link); 91                 self.ajaxSubmit(link);
92                 e.stopPropagation(); 92                 e.stopPropagation();
93                 e.preventDefault(); 93                 e.preventDefault();
94             }); 94             });
95         }, 95         },
96  96 
97         checkUrl: function (url) { 97         checkUrl: function (url) {
98             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; 98             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
99  99 
100             return regex.test(url) ? url : null; 100             return regex.test(url) ? url : null;
101         }, 101         },
102  102 
103         initLoading: function () { 103         initLoading: function () {
104  104 
105         }, 105         },
106  106 
107         ajaxSubmit: function (submitUrl) { 107         ajaxSubmit: function (submitUrl) {
108             var self = this; 108             var self = this;
109  109 
110             $.ajax({ 110             $.ajax({
111                 url: submitUrl, 111                 url: submitUrl,
112                 data: {isAjax: 1}, 112                 data: {isAjax: 1},
113                 type: 'post', 113                 type: 'post',
114                 dataType: 'json', 114                 dataType: 'json',
115                 beforeSend: function () { 115                 beforeSend: function () {
116                     $('.ln_overlay').show(); 116                     $('.ln_overlay').show();
117                     if (typeof window.history.pushState === 'function') { 117                     if (typeof window.history.pushState === 'function') {
118                         window.history.pushState({url: submitUrl}, '', submitUrl); 118                         window.history.pushState({url: submitUrl}, '', submitUrl);
119                     } 119                     }
120                 }, 120                 },
121                 success: function (res) { 121                 success: function (res) {
122                     if (res.backUrl) { 122                     if (res.backUrl) {
123                         window.location = res.backUrl; 123                         window.location = res.backUrl;
124                         return; 124                         return;
125                     } 125                     }
126                     if (res.navigation) { 126                     if (res.navigation) {
127                         $(self.options.navigationSelector).replaceWith(res.navigation); 127                         $(self.options.navigationSelector).replaceWith(res.navigation);
128                         $(self.options.navigationSelector).trigger('contentUpdated'); 128                         $(self.options.navigationSelector).trigger('contentUpdated');
129                     } 129                     }
130                     if (res.products) { 130                     if (res.products) {
131                         $(self.options.productsListSelector).replaceWith(res.products); 131                         $(self.options.productsListSelector).replaceWith(res.products);
132                         $(self.options.productsListSelector).trigger('contentUpdated'); 132                         $(self.options.productsListSelector).trigger('contentUpdated');
133                     } 133                     }
134                     $('.ln_overlay').hide(); 134                     $('.ln_overlay').hide();
135                 }, 135                 },
136                 error: function () { 136                 error: function () {
137                     window.location.reload(); 137                     window.location.reload();
138                 } 138                 }
139             }); 139             });
140         } 140         }
141     }); 141     });
142  142 
143     return $.mageplaza.layer; 143     return $.mageplaza.layer;
144 }); 144 });