Produced by Araxis Merge on 2023-11-23 04:31:25 +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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | /Users/coca/Documents/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme 4.0.6/app/design/frontend/Smartwave/porto/Mageplaza_LayeredNavigation/web/js/view | layer.js | 2023-07-02 09:00:31 +0000 |
| 2 | /Users/coca/Documents/www/Porto v4.0.2/Theme Files/Magento 2.x/Porto Theme 4.0.7/app/design/frontend/Smartwave/porto/Mageplaza_LayeredNavigation/web/js/view | layer.js | 2023-11-17 03:37:16 +0000 |
| Description | Between Files 1 and 2 | |
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1120 |
| Changed | 0 | 0 |
| Inserted | 1 | 1 |
| Removed | 0 | 0 |
| Whitespace | Consecutive whitespace is treated as a single space |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
| Active line-pairing rules |
No regular expressions were active.
| 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: [], | 50 | activeDesktop: [], | |||
| 51 | activeMobile: [], | 51 | activeMobile: [], | |||
| 52 | checkboxEl: 'input[type=checkbox], input[type=radio]', | 52 | checkboxEl: 'input[type=checkbox], input[type=radio]', | |||
| 53 | sliderElementPrefix: '#ln_slider_', | 53 | sliderElementPrefix: '#ln_slider_', | |||
| 54 | sliderTextElementPrefix: '#ln_slider_text_' | 54 | sliderTextElementPrefix: '#ln_slider_text_' | |||
| 55 | }, | 55 | }, | |||
| 56 | 56 | |||||
| 57 | _create: function () { | 57 | _create: function () { | |||
| 58 | this.initActiveItems(); | 58 | this.initActiveItems(); | |||
| 59 | 59 | |||||
| 60 | this._super(); | 60 | this._super(); | |||
| 61 | 61 | |||||
| 62 | this.initProductListUrl(); | 62 | this.initProductListUrl(); | |||
| 63 | this.initObserve(); | 63 | this.initObserve(); | |||
| 64 | this.initSlider(); | 64 | this.initSlider(); | |||
| 65 | this.initWishlistCompare(); | 65 | this.initWishlistCompare(); | |||
| 66 | this.selectedAttr(); | 66 | this.selectedAttr(); | |||
| 67 | this.renderCategoryTree(); | 67 | this.renderCategoryTree(); | |||
| 68 | }, | 68 | }, | |||
| 69 | 69 | |||||
| 70 | inFinite: function() { | 70 | inFinite: function() { | |||
| 71 | var self = this; | 71 | var self = this; | |||
| 72 | next_page = ""; | 72 | next_page = ""; | |||
| 73 | if($(self.options.productsListSelector +' .infinite-loader').length > 0){ | 73 | if($(self.options.productsListSelector +' .infinite-loader').length > 0){ | |||
| 74 | active = true; | 74 | active = true; | |||
| 75 | } | 75 | } | |||
| 76 | $(".pages-items li > a.next").each(function(){ | 76 | $(".pages-items li > a.next").each(function(){ | |||
| 77 | next_page = $(this).attr("href"); | 77 | next_page = $(this).attr("href"); | |||
| 78 | }); | 78 | }); | |||
| 79 | if(!next_page){ | 79 | if(!next_page){ | |||
| 80 | $('.infinite-loader').hide(); | 80 | $('.infinite-loader').hide(); | |||
| 81 | } | 81 | } | |||
| 82 | $(window).scroll(function(){ | 82 | $(window).scroll(function(){ | |||
| 83 | 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){ | |||
| 84 | loading = true; | 84 | loading = true; | |||
| 85 | $(".pages-items li > a.next").each(function(){ | 85 | $(".pages-items li > a.next").each(function(){ | |||
| 86 | next_page = $(this).attr("href"); | 86 | next_page = $(this).attr("href"); | |||
| 87 | }); | 87 | }); | |||
| 88 | self.ajaxInfinite(next_page); | 88 | self.ajaxInfinite(next_page); | |||
| 89 | } | 89 | } | |||
| 90 | }); | 90 | }); | |||
| 91 | $(".infinite-loader .btn-load-more").click(function(){ | 91 | $(".infinite-loader .btn-load-more").click(function(){ | |||
| 92 | if(!loading && next_page){ | 92 | if(!loading && next_page){ | |||
| 93 | loading = true; | 93 | loading = true; | |||
| 94 | self.ajaxInfinite(next_page); | 94 | self.ajaxInfinite(next_page); | |||
| 95 | } | 95 | } | |||
| 96 | }); | 96 | }); | |||
| 97 | }, | 97 | }, | |||
| 98 | 98 | |||||
| 99 | ajaxInfinite: function (submitUrl) { | 99 | ajaxInfinite: function (submitUrl) { | |||
| 100 | var self = this; | 100 | var self = this; | |||
| 101 | infinite_loaded_count++; | 101 | infinite_loaded_count++; | |||
| 102 | $('.infinite-loader .btn-load-more').hide(); | 102 | $('.infinite-loader .btn-load-more').hide(); | |||
| 103 | $('.infinite-loader .loading').hide(); | 103 | $('.infinite-loader .loading').hide(); | |||
| 104 | $.ajax({ | 104 | $.ajax({ | |||
| 105 | url: submitUrl, | 105 | url: submitUrl, | |||
| 106 | type: 'get', | 106 | type: 'get', | |||
| 107 | beforeSend: function () { | 107 | beforeSend: function () { | |||
| 108 | $('.infinite-loader .btn-load-more').hide(); | 108 | $('.infinite-loader .btn-load-more').hide(); | |||
| 109 | $('.infinite-loader .loading').show(); | 109 | $('.infinite-loader .loading').show(); | |||
| 110 | }, | 110 | }, | |||
| 111 | success: function (res) { | 111 | success: function (res) { | |||
| 112 | loading = false; | 112 | loading = false; | |||
| 113 | var $products = $(res.products); | 113 | var $products = $(res.products); | |||
| 114 | if (res.backUrl) { | 114 | if (res.backUrl) { | |||
| 115 | window.location = res.backUrl; | 115 | window.location = res.backUrl; | |||
| 116 | return; | 116 | return; | |||
| 117 | } | 117 | } | |||
| 118 | if($products){ | 118 | if($products){ | |||
| 119 | $products.each(function(i,el){ | 119 | $products.each(function(i,el){ | |||
| 120 | if($(el).hasClass('products-grid')){ | 120 | if($(el).hasClass('products-grid')){ | |||
| 121 | var items_grid = $(this).find('.product-items .item'); | 121 | var items_grid = $(this).find('.product-items .item'); | |||
| 122 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); | 122 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); | |||
| 123 | $(self.options.productsListSelector).trigger('contentUpdated'); | 123 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||
| 124 | } | 124 | } | |||
| 125 | if($(el).hasClass('products-list')){ | 125 | if($(el).hasClass('products-list')){ | |||
| 126 | var items_list = $(this).find('.product-items .item'); | 126 | var items_list = $(this).find('.product-items .item'); | |||
| 127 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); | 127 | $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); | |||
| 128 | $(self.options.productsListSelector).trigger('contentUpdated'); | 128 | $(self.options.productsListSelector).trigger('contentUpdated'); | |||
| 129 | } | 129 | } | |||
| 130 | if($(el).hasClass('toolbar-products')){ | 130 | if($(el).hasClass('toolbar-products')){ | |||
| 131 | if($(this).find('.pages a.next').length > 0){ | 131 | if($(this).find('.pages a.next').length > 0){ | |||
| 132 | $(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')); | |||
| 133 | }else{ | 133 | }else{ | |||
| 134 | $(self.options.productsListSelector + ' .pages a.next').remove(); | 134 | $(self.options.productsListSelector + ' .pages a.next').remove(); | |||
| 135 | } | 135 | } | |||
| 136 | } | 136 | } | |||
| 137 | }); | 137 | }); | |||
| 138 | if($("form[data-role=tocart-form]").length > 0 && !redirect_cart) { | 138 | if($("form[data-role=tocart-form]").length > 0 && !redirect_cart) { | |||
| 139 | $("form[data-role=tocart-form]").catalogAddToCart(); | 139 | $("form[data-role=tocart-form]").catalogAddToCart(); | |||
| 140 | } | 140 | } | |||
| 141 | $('.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'); | |||
| 142 | $('.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'); | |||
| 143 | $('.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'); | |||
| 144 | $('.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'); | |||
| 145 | $('.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'); | |||
| 146 | $('.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'); | |||
| 147 | $('.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'); | |||
| 148 | $('.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'); | |||
| 149 | $('.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'); | |||
| 150 | $('.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'); | |||
| 151 | $('.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'); | |||
| 152 | $('.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'); | |||
| 153 | $('.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'); | |||
| 154 | $('.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'); | |||
| 155 | var hist = submitUrl; | 155 | var hist = submitUrl; | |||
| 156 | if(submitUrl.indexOf("p=") > -1){ | 156 | if(submitUrl.indexOf("p=") > -1){ | |||
| 157 | var len = submitUrl.length-submitUrl.indexOf("p="); | 157 | var len = submitUrl.length-submitUrl.indexOf("p="); | |||
| 158 | var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); | 158 | var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); | |||
| 159 | var page_param = ""; | 159 | var page_param = ""; | |||
| 160 | if(str_temp.indexOf("&") == -1){ | 160 | if(str_temp.indexOf("&") == -1){ | |||
| 161 | page_param = str_temp; | 161 | page_param = str_temp; | |||
| 162 | } else { | 162 | } else { | |||
| 163 | page_param = str_temp.substr(0,str_temp.indexOf("&")); | 163 | page_param = str_temp.substr(0,str_temp.indexOf("&")); | |||
| 164 | } | 164 | } | |||
| 165 | hist = submitUrl.replace(page_param, ""); | 165 | hist = submitUrl.replace(page_param, ""); | |||
| 166 | } | 166 | } | |||
| 167 | if (typeof window.history.pushState === 'function') { | 167 | if (typeof window.history.pushState === 'function') { | |||
| 168 | window.history.pushState({url: hist}, '', hist); | 168 | window.history.pushState({url: hist}, '', hist); | |||
| 169 | } | 169 | } | |||
| 170 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | 170 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||
| 171 | requirejs(['jquery', 'weltpixel_quickview' ], | 171 | requirejs(['jquery', 'weltpixel_quickview' ], | |||
| 172 | function($, quickview) { | 172 | function($, quickview) { | |||
| 173 | $('.weltpixel-quickview').off('click').on('click', function() { | 173 | $('.weltpixel-quickview').off('click').on('click', function() { | |||
| 174 | var prodUrl = $(this).attr('data-quickview-url'); | 174 | var prodUrl = $(this).attr('data-quickview-url'); | |||
| 175 | if (prodUrl.length) { | 175 | if (prodUrl.length) { | |||
| 176 | quickview.displayContent(prodUrl); | 176 | quickview.displayContent(prodUrl); | |||
| 177 | } | 177 | } | |||
| 178 | }); | 178 | }); | |||
| 179 | }); | 179 | }); | |||
| 180 | } | 180 | } | |||
| 181 | $(".products-grid .weltpixel-quickview").each(function(){ | 181 | $(".products-grid .weltpixel-quickview").each(function(){ | |||
| 182 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | 182 | $(this).appendTo($(this).parent().parent().children(".product-item-photo")); | |||
| 183 | }); | 183 | }); | |||
| 184 | $("#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"}); | |||
| 185 | 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) { | |||
| 186 | $('#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() { | |||
| 187 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 187 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 188 | }); | 188 | }); | |||
| 189 | $('#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() { | |||
| 190 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 190 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 191 | }); | 191 | }); | |||
| 192 | } | 192 | } | |||
| 193 | self.initWishlistCompare(); | 193 | self.initWishlistCompare(); | |||
| 194 | next_page = ""; | 194 | next_page = ""; | |||
| 195 | $(".pages-items li > a.next").each(function(){ | 195 | $(".pages-items li > a.next").each(function(){ | |||
| 196 | next_page = $(this).attr("href"); | 196 | next_page = $(this).attr("href"); | |||
| 197 | }); | 197 | }); | |||
| 198 | $('.infinite-loader .loading').hide(); | 198 | $('.infinite-loader .loading').hide(); | |||
| 199 | if(next_page){ | 199 | if(next_page){ | |||
| 200 | $('.infinite-loader .btn-load-more').show(); | 200 | $('.infinite-loader .btn-load-more').show(); | |||
| 201 | $(".infinite-loader .btn-load-more").unbind("click").click(function(){ | 201 | $(".infinite-loader .btn-load-more").unbind("click").click(function(){ | |||
| 202 | if(!loading && next_page){ | 202 | if(!loading && next_page){ | |||
| 203 | loading = true; | 203 | loading = true; | |||
| 204 | self.ajaxInfinite(next_page); | 204 | self.ajaxInfinite(next_page); | |||
| 205 | } | 205 | } | |||
| 206 | }); | 206 | }); | |||
| 207 | } | 207 | } | |||
| 208 | } | 208 | } | |||
| 209 | 209 | |||||
| 210 | }, | 210 | }, | |||
| 211 | error: function () { | 211 | error: function () { | |||
| 212 | window.location.reload(); | 212 | window.location.reload(); | |||
| 213 | } | 213 | } | |||
| 214 | }); | 214 | }); | |||
| 215 | }, | 215 | }, | |||
| 216 | 216 | |||||
| 217 | initActiveItems: function () { | 217 | initActiveItems: function () { | |||
| 218 | var layerActivesDesktop = this.options.activeDesktop, | 218 | var layerActivesDesktop = this.options.activeDesktop, | |||
| 219 | layerActivesMobile = this.options.activeMobile, | 219 | layerActivesMobile = this.options.activeMobile, | |||
| 220 | activesDesktop = [], | 220 | activesDesktop = [], | |||
| 221 | activesMobile = []; | 221 | activesMobile = []; | |||
| 222 | if ($(".page-layout-1column").length){ | 222 | if ($(".page-layout-1column").length){ | |||
| 223 | this.options.multipleCollapsible = false; | 223 | this.options.multipleCollapsible = false; | |||
| 224 | } | 224 | } | |||
| 225 | 225 | |||||
| 226 | if (typeof window.layerActiveTabs !== 'undefined') { | 226 | if (typeof window.layerActiveTabs !== 'undefined') { | |||
| 227 | layerActivesDesktop, layerActivesMobile = window.layerActiveTabs; | 227 | layerActivesDesktop, layerActivesMobile = window.layerActiveTabs; | |||
| 228 | } | 228 | } | |||
| 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) | 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))) { | 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) { | 231 | if (layerActivesMobile.length) { | |||
| 232 | this.element.find('.filter-options-item').each(function (index) { | 232 | this.element.find('.filter-options-item').each(function (index) { | |||
| 233 | if (~$.inArray($(this).attr('attribute'), layerActivesMobile)) { | 233 | if (~$.inArray($(this).attr('attribute'), layerActivesMobile)) { | |||
| 234 | activesMobile.push(index); | 234 | activesMobile.push(index); | |||
| 235 | } | 235 | } | |||
| 236 | }); | 236 | }); | |||
| 237 | } | 237 | } | |||
| 238 | this.options.active = activesMobile; | 238 | this.options.active = activesMobile; | |||
| 239 | return this; | 239 | return this; | |||
| 240 | }else{ | 240 | }else{ | |||
| 241 | if (layerActivesDesktop.length) { | 241 | if (layerActivesDesktop.length) { | |||
| 242 | this.element.find('.filter-options-item').each(function (index) { | 242 | this.element.find('.filter-options-item').each(function (index) { | |||
| 243 | if (~$.inArray($(this).attr('attribute'), layerActivesDesktop)) { | 243 | if (~$.inArray($(this).attr('attribute'), layerActivesDesktop)) { | |||
| 244 | activesDesktop.push(index); | 244 | activesDesktop.push(index); | |||
| 245 | } | 245 | } | |||
| 246 | }); | 246 | }); | |||
| 247 | } | 247 | } | |||
| 248 | this.options.active = activesDesktop; | 248 | this.options.active = activesDesktop; | |||
| 249 | return this; | 249 | return this; | |||
| 250 | } | 250 | } | |||
| 251 | }, | 251 | }, | |||
| 252 | 252 | |||||
| 253 | initProductListUrl: function () { | 253 | initProductListUrl: function () { | |||
| 254 | var isProcessToolbar = false, | 254 | var isProcessToolbar = false, | |||
| 255 | isAjax = this.options.isAjax; | 255 | isAjax = this.options.isAjax; | |||
| 256 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | 256 | $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { | |||
| 257 | if (isProcessToolbar) { | 257 | if (isProcessToolbar) { | |||
| 258 | return; | 258 | return; | |||
| 259 | } | 259 | } | |||
| 260 | if (isAjax) { | 260 | if (isAjax) { | |||
| 261 | isProcessToolbar = true; | 261 | isProcessToolbar = true; | |||
| 262 | } | 262 | } | |||
| 263 | 263 | |||||
| 264 | var urlPaths = this.options.url.split('?'), | 264 | var urlPaths = this.options.url.split('?'), | |||
| 265 | baseUrl = urlPaths[0], | 265 | baseUrl = urlPaths[0], | |||
| 266 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | 266 | urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], | |||
| 267 | paramData = {}, | 267 | paramData = {}, | |||
| 268 | parameters; | 268 | parameters; | |||
| 269 | for (var i = 0; i < urlParams.length; i++) { | 269 | for (var i = 0; i < urlParams.length; i++) { | |||
| 270 | parameters = urlParams[i].split('='); | 270 | parameters = urlParams[i].split('='); | |||
| 271 | paramData[parameters[0]] = parameters[1] !== undefined | 271 | paramData[parameters[0]] = parameters[1] !== undefined | |||
| 272 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | 272 | ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) | |||
| 273 | : ''; | 273 | : ''; | |||
| 274 | } | 274 | } | |||
| 275 | paramData[paramName] = paramValue; | 275 | paramData[paramName] = paramValue; | |||
| 276 | if (paramValue === defaultValue) { | 276 | if (paramValue === defaultValue) { | |||
| 277 | delete paramData[paramName]; | 277 | delete paramData[paramName]; | |||
| 278 | } | 278 | } | |||
| 279 | paramData = $.param(paramData); | 279 | paramData = $.param(paramData); | |||
| 280 | if (isAjax) { | 280 | if (isAjax) { | |||
| 281 | submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); | 281 | submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); | |||
| 282 | } else location.href = baseUrl + (paramData.length ? '?' + paramData : ''); | 282 | } else location.href = baseUrl + (paramData.length ? '?' + paramData : ''); | |||
| 283 | } | 283 | } | |||
| 284 | }, | 284 | }, | |||
| 285 | 285 | |||||
| 286 | initObserve: function () { | 286 | initObserve: function () { | |||
| 287 | var self = this; | 287 | var self = this; | |||
| 288 | var isAjax = this.options.isAjax; | 288 | var isAjax = this.options.isAjax; | |||
| 289 | 289 | |||||
| 290 | // fix browser back, forward button | 290 | // fix browser back, forward button | |||
| 291 | if (typeof window.history.replaceState === "function") { | 291 | if (typeof window.history.replaceState === "function") { | |||
| 292 | window.history.replaceState({url: document.URL}, document.title); | 292 | window.history.replaceState({url: document.URL}, document.title); | |||
| 293 | 293 | |||||
| 294 | setTimeout(function () { | 294 | setTimeout(function () { | |||
| 295 | window.onpopstate = function (e) { | 295 | window.onpopstate = function (e) { | |||
| 296 | if (e.state) { | 296 | if (e.state) { | |||
| 297 | submitFilterAction(e.state.url, 1); | 297 | submitFilterAction(e.state.url, 1); | |||
| 298 | } | 298 | } | |||
| 299 | }; | 299 | }; | |||
| 300 | }, 0) | 300 | }, 0) | |||
| 301 | } | 301 | } | |||
| 302 | 302 | |||||
| 303 | var pageElements = $('#layer-product-list').find('.pages a'); | 303 | var pageElements = $('#layer-product-list').find('.pages a'); | |||
| 304 | pageElements.each(function () { | 304 | pageElements.each(function () { | |||
| 305 | var el = $(this), | 305 | var el = $(this), | |||
| 306 | link = self.checkUrl(el.prop('href')); | 306 | link = self.checkUrl(el.prop('href')); | |||
| 307 | if (!link) { | 307 | if (!link) { | |||
| 308 | return; | 308 | return; | |||
| 309 | } | 309 | } | |||
| 310 | 310 | |||||
| 311 | el.bind('click', function (e) { | 311 | el.bind('click', function (e) { | |||
| 312 | e.stopPropagation(); | 312 | e.stopPropagation(); | |||
| 313 | e.preventDefault(); | 313 | e.preventDefault(); | |||
| 314 | if (isAjax) { | 314 | if (isAjax) { | |||
| 315 | submitFilterAction(link); | 315 | submitFilterAction(link); | |||
| 316 | } else location.href = link; | 316 | } else location.href = link; | |||
| 317 | }) | 317 | }) | |||
| 318 | }); | 318 | }); | |||
| 319 | 319 | |||||
| 320 | var currentElements = this.element.find('.filter-current a, .filter-actions a'); | 320 | var currentElements = this.element.find('.filter-current a, .filter-actions a'); | |||
| 321 | currentElements.each(function (index) { | 321 | currentElements.each(function (index) { | |||
| 322 | var el = $(this), | 322 | var el = $(this), | |||
| 323 | link = self.checkUrl(el.prop('href')); | 323 | link = self.checkUrl(el.prop('href')); | |||
| 324 | if (!link) { | 324 | if (!link) { | |||
| 325 | return; | 325 | return; | |||
| 326 | } | 326 | } | |||
| 327 | 327 | |||||
| 328 | el.bind('click', function (e) { | 328 | el.bind('click', function (e) { | |||
| 329 | e.stopPropagation(); | 329 | e.stopPropagation(); | |||
| 330 | e.preventDefault(); | 330 | e.preventDefault(); | |||
| 331 | if (isAjax) { | 331 | if (isAjax) { | |||
| 332 | submitFilterAction(link); | 332 | submitFilterAction(link); | |||
| 333 | } else { | 333 | } else { | |||
| 334 | location.href = link; | 334 | location.href = link; | |||
| 335 | } | 335 | } | |||
| 336 | }); | 336 | }); | |||
| 337 | }); | 337 | }); | |||
| 338 | 338 | |||||
| 339 | var optionElements = this.element.find('.filter-options a'); | 339 | var optionElements = this.element.find('.filter-options a'); | |||
| 340 | optionElements.each(function (index) { | 340 | optionElements.each(function (index) { | |||
| 341 | var el = $(this), | 341 | var el = $(this), | |||
| 342 | link = self.checkUrl(el.prop('href')); | 342 | link = self.checkUrl(el.prop('href')); | |||
| 343 | if (!link) { | 343 | if (!link) { | |||
| 344 | return; | 344 | return; | |||
| 345 | } | 345 | } | |||
| 346 | 346 | |||||
| 347 | el.bind('click', function (e) { | 347 | el.bind('click', function (e) { | |||
| 348 | if (el.hasClass('swatch-option-link-layered')) { | 348 | if (el.hasClass('swatch-option-link-layered')) { | |||
| 349 | self.selectSwatchOption(el); | 349 | self.selectSwatchOption(el); | |||
| 350 | } else { | 350 | } else { | |||
| 351 | var checkboxEl = el.siblings(self.options.checkboxEl); | 351 | var checkboxEl = el.siblings(self.options.checkboxEl); | |||
| 352 | checkboxEl.prop('checked', !checkboxEl.prop('checked')); | 352 | checkboxEl.prop('checked', !checkboxEl.prop('checked')); | |||
| 353 | } | 353 | } | |||
| 354 | 354 | |||||
| 355 | e.stopPropagation(); | 355 | e.stopPropagation(); | |||
| 356 | e.preventDefault(); | 356 | e.preventDefault(); | |||
| 357 | self.ajaxSubmit(link); | 357 | self.ajaxSubmit(link); | |||
| 358 | }); | 358 | }); | |||
| 359 | 359 | |||||
| 360 | var checkbox = el.siblings(self.options.checkboxEl); | 360 | var checkbox = el.siblings(self.options.checkboxEl); | |||
| 361 | checkbox.bind('click', function (e) { | 361 | checkbox.bind('click', function (e) { | |||
| 362 | e.stopPropagation(); | 362 | e.stopPropagation(); | |||
| 363 | self.ajaxSubmit(link); | 363 | self.ajaxSubmit(link); | |||
| 364 | }); | 364 | }); | |||
| 365 | }); | 365 | }); | |||
| 366 | 366 | |||||
| 367 | var swatchElements = this.element.find('.swatch-attribute'); | 367 | var swatchElements = this.element.find('.swatch-attribute'); | |||
| 368 | swatchElements.each(function (index) { | 368 | swatchElements.each(function (index) { | |||
| 369 | var el = $(this); | 369 | var el = $(this); | |||
| 370 | var attCode = el.attr('attribute-code'); | 370 | var attCode = el.attr('attribute-code'); | |||
| 371 | if (attCode) { | 371 | if (attCode) { | |||
| 372 | if (self.options.params.hasOwnProperty(attCode)) { | 372 | if (self.options.params.hasOwnProperty(attCode)) { | |||
| 373 | var attValues = self.options.params[attCode].split(","); | 373 | var attValues = self.options.params[attCode].split(","); | |||
| 374 | var swatchOptions = el.find('.swatch-option'); | 374 | var swatchOptions = el.find('.swatch-option'); | |||
| 375 | swatchOptions.each(function (option) { | 375 | swatchOptions.each(function (option) { | |||
| 376 | var elOption = $(this); | 376 | var elOption = $(this); | |||
| 377 | if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { | 377 | if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { | |||
| 378 | elOption.addClass('selected'); | 378 | elOption.addClass('selected'); | |||
| 379 | } | 379 | } | |||
| 380 | }); | 380 | }); | |||
| 381 | } | 381 | } | |||
| 382 | } | 382 | } | |||
| 383 | }); | 383 | }); | |||
| 384 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | 384 | if(typeof enable_quickview != 'undefined' && enable_quickview == true) { | |||
| 385 | requirejs(['jquery', 'weltpixel_quickview' ], | 385 | requirejs(['jquery', 'weltpixel_quickview' ], | |||
| 386 | function($, quickview) { | 386 | function($, quickview) { | |||
| 387 | $('.weltpixel-quickview').off('click').on('click', function() { | 387 | $('.weltpixel-quickview').off('click').on('click', function() { | |||
| 388 | var prodUrl = $(this).attr('data-quickview-url'); | 388 | var prodUrl = $(this).attr('data-quickview-url'); | |||
| 389 | if (prodUrl.length) { | 389 | if (prodUrl.length) { | |||
| 390 | quickview.displayContent(prodUrl); | 390 | quickview.displayContent(prodUrl); | |||
| 391 | } | 391 | } | |||
| 392 | }); | 392 | }); | |||
| 393 | }); | 393 | }); | |||
| 394 | } | 394 | } | |||
| 395 | 395 | |||||
| 396 | $(".products-grid .weltpixel-quickview").each(function(){ | 396 | $(".products-grid .weltpixel-quickview").each(function(){ | |||
| 397 | $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo")); | 397 | $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo")); | |||
| 398 | }); | 398 | }); | |||
| 399 | $("#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"}); | |||
| 400 | 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) { | |||
| 401 | $('#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() { | |||
| 402 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | 402 | $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); | |||
| 403 | }); | 403 | }); | |||
| 404 | } | 404 | } | |||
| 405 | if(isAjax) { | 405 | if(isAjax) { | |||
| 406 | self.inFinite(); | 406 | self.inFinite(); | |||
| 407 | }else{ | 407 | }else{ | |||
| 408 | $('.infinite-loader').hide(); | 408 | $('.infinite-loader').hide(); | |||
| 409 | } | 409 | } | |||
| 410 | }, | 410 | }, | |||
| 411 | 411 | |||||
| 412 | selectSwatchOption: function (el) { | 412 | selectSwatchOption: function (el) { | |||
| 413 | var childEl = el.find('.swatch-option'); | 413 | var childEl = el.find('.swatch-option'); | |||
| 414 | if (childEl.hasClass('selected')) { | 414 | if (childEl.hasClass('selected')) { | |||
| 415 | childEl.removeClass('selected'); | 415 | childEl.removeClass('selected'); | |||
| 416 | } else { | 416 | } else { | |||
| 417 | childEl.addClass('selected'); | 417 | childEl.addClass('selected'); | |||
| 418 | } | 418 | } | |||
| 419 | }, | 419 | }, | |||
| 420 | 420 | |||||
| 421 | initSlider: function () { | 421 | initSlider: function () { | |||
| 422 | var self = this, | 422 | var self = this, | |||
| 423 | slider = this.options.slider; | 423 | slider = this.options.slider; | |||
| 424 | 424 | |||||
| 425 | for (var code in slider) { | 425 | for (var code in slider) { | |||
| 426 | if (slider.hasOwnProperty(code)) { | 426 | if (slider.hasOwnProperty(code)) { | |||
| 427 | var sliderConfig = slider[code], | 427 | var sliderConfig = slider[code], | |||
| 428 | sliderElement = self.element.find(this.options.sliderElementPrefix + code), | 428 | sliderElement = self.element.find(this.options.sliderElementPrefix + code), | |||
| 429 | priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null; | 429 | priceFormat = sliderConfig.hasOwnProperty('priceFormat') ? JSON.parse(sliderConfig.priceFormat) : null; | |||
| 430 | 430 | |||||
| 431 | if (sliderElement.length) { | 431 | if (sliderElement.length) { | |||
| 432 | sliderElement.slider({ | 432 | sliderElement.slider({ | |||
| 433 | range: true, | 433 | range: true, | |||
| 434 | min: sliderConfig.minValue, | 434 | min: sliderConfig.minValue, | |||
| 435 | max: sliderConfig.maxValue, | 435 | max: sliderConfig.maxValue, | |||
| 436 | step: 0.01, | |||||
| 436 | values: [sliderConfig.selectedFrom, sliderConfig.selectedTo], | 437 | values: [sliderConfig.selectedFrom, sliderConfig.selectedTo], | |||
| 437 | slide: function (event, ui) { | 438 | slide: function (event, ui) { | |||
| 438 | self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat); | 439 | self.displaySliderText(code, ui.values[0], ui.values[1], priceFormat); | |||
| 439 | }, | 440 | }, | |||
| 440 | change: function (event, ui) { | 441 | change: function (event, ui) { | |||
| 441 | self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1])); | 442 | self.ajaxSubmit(self.getSliderUrl(sliderConfig.ajaxUrl, ui.values[0], ui.values[1])); | |||
| 442 | } | 443 | } | |||
| 443 | }); | 444 | }); | |||
| 444 | } | 445 | } | |||
| 445 | self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat); | 446 | self.displaySliderText(code, sliderConfig.selectedFrom, sliderConfig.selectedTo, priceFormat); | |||
| 446 | } | 447 | } | |||
| 447 | } | 448 | } | |||
| 448 | }, | 449 | }, | |||
| 449 | 450 | |||||
| 450 | displaySliderText: function (code, from, to, format) { | 451 | displaySliderText: function (code, from, to, format) { | |||
| 451 | var textElement = this.element.find(this.options.sliderTextElementPrefix + code); | 452 | var textElement = this.element.find(this.options.sliderTextElementPrefix + code); | |||
| 452 | if (textElement.length) { | 453 | if (textElement.length) { | |||
| 453 | if (format !== null) { | 454 | if (format !== null) { | |||
| 454 | from = this.formatPrice(from, format); | 455 | from = this.formatPrice(from, format); | |||
| 455 | to = this.formatPrice(to, format); | 456 | to = this.formatPrice(to, format); | |||
| 456 | } | 457 | } | |||
| 457 | 458 | |||||
| 458 | textElement.html(from + ' - ' + to); | 459 | textElement.html(from + ' - ' + to); | |||
| 459 | } | 460 | } | |||
| 460 | }, | 461 | }, | |||
| 461 | 462 | |||||
| 462 | getSliderUrl: function (url, from, to) { | 463 | getSliderUrl: function (url, from, to) { | |||
| 463 | return url.replace('from-to', from + '-' + to); | 464 | return url.replace('from-to', from + '-' + to); | |||
| 464 | }, | 465 | }, | |||
| 465 | 466 | |||||
| 466 | formatPrice: function (value, format) { | 467 | formatPrice: function (value, format) { | |||
| 467 | return ultil.formatPrice(value, format); | 468 | return ultil.formatPrice(value, format); | |||
| 468 | }, | 469 | }, | |||
| 469 | 470 | |||||
| 470 | ajaxSubmit: function (submitUrl) { | 471 | ajaxSubmit: function (submitUrl) { | |||
| 471 | var isAjax = this.options.isAjax; | 472 | var isAjax = this.options.isAjax; | |||
| 472 | this.element.find(this.options.mobileShopbyElement).trigger('click'); | 473 | this.element.find(this.options.mobileShopbyElement).trigger('click'); | |||
| 473 | 474 | |||||
| 474 | if (isAjax) { | 475 | if (isAjax) { | |||
| 475 | return submitFilterAction(submitUrl); | 476 | return submitFilterAction(submitUrl); | |||
| 476 | } | 477 | } | |||
| 477 | location.href = submitUrl; | 478 | location.href = submitUrl; | |||
| 478 | }, | 479 | }, | |||
| 479 | 480 | |||||
| 480 | checkUrl: function (url) { | 481 | checkUrl: function (url) { | |||
| 481 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | 482 | var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; | |||
| 482 | 483 | |||||
| 483 | return regex.test(url) ? url : null; | 484 | return regex.test(url) ? url : null; | |||
| 484 | }, | 485 | }, | |||
| 485 | 486 | |||||
| 486 | //Handling 'add to wishlist' & 'add to compare' event | 487 | //Handling 'add to wishlist' & 'add to compare' event | |||
| 487 | initWishlistCompare: function () { | 488 | initWishlistCompare: function () { | |||
| 488 | var isAjax = this.options.isAjax; | 489 | var isAjax = this.options.isAjax; | |||
| 489 | var isCustomerLoggedIn = this.options.isCustomerLoggedIn, | 490 | var isCustomerLoggedIn = this.options.isCustomerLoggedIn, | |||
| 490 | elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); | 491 | elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); | |||
| 491 | $(elClass).each(function () { | 492 | $(elClass).each(function () { | |||
| 492 | var el = $(this); | 493 | var el = $(this); | |||
| 493 | if (isAjax){ | 494 | if (isAjax){ | |||
| 494 | $(el).bind('click', function (e) { | 495 | $(el).bind('click', function (e) { | |||
| 495 | var dataPost = $(el).data('post'), | 496 | var dataPost = $(el).data('post'), | |||
| 496 | formKey = $('input[name="form_key"]').val(), method = 'post'; | 497 | formKey = $('input[name="form_key"]').val(), method = 'post'; | |||
| 497 | if (formKey) { | 498 | if (formKey) { | |||
| 498 | dataPost.data.form_key = formKey; | 499 | dataPost.data.form_key = formKey; | |||
| 499 | } | 500 | } | |||
| 500 | 501 | |||||
| 501 | var paramData = $.param(dataPost.data), | 502 | var paramData = $.param(dataPost.data), | |||
| 502 | url = dataPost.action + (paramData.length ? '?' + paramData : ''); | 503 | url = dataPost.action + (paramData.length ? '?' + paramData : ''); | |||
| 503 | 504 | |||||
| 504 | e.stopPropagation(); | 505 | e.stopPropagation(); | |||
| 505 | e.preventDefault(); | 506 | e.preventDefault(); | |||
| 506 | 507 | |||||
| 507 | if (el.hasClass('towishlist')) { | 508 | if (el.hasClass('towishlist')) { | |||
| 508 | submitFilterAction(url, true, method); | 509 | submitFilterAction(url, true, method); | |||
| 509 | } else{ | 510 | } else{ | |||
| 510 | submitFilterAction(url, true, method); | 511 | submitFilterAction(url, true, method); | |||
| 511 | } | 512 | } | |||
| 512 | }); | 513 | }); | |||
| 513 | } | 514 | } | |||
| 514 | }) | 515 | }) | |||
| 515 | }, | 516 | }, | |||
| 516 | 517 | |||||
| 517 | //Selected attribute color after page load. | 518 | //Selected attribute color after page load. | |||
| 518 | selectedAttr: function () { | 519 | selectedAttr: function () { | |||
| 519 | var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value'); | 520 | var filterCurrent = $('.layered-filter-block-container .filter-current .items .item .filter-value'); | |||
| 520 | 521 | |||||
| 521 | filterCurrent.each(function(){ | 522 | filterCurrent.each(function(){ | |||
| 522 | var el = $(this), | 523 | var el = $(this), | |||
| 523 | colorLabel = el.html(), | 524 | colorLabel = el.html(), | |||
| 524 | swatchAttr = $('.filter-options .filter-options-item .swatch-option-link-layered .swatch-option'); | 525 | swatchAttr = $('.filter-options .filter-options-item .swatch-option-link-layered .swatch-option'); | |||
| 525 | 526 | |||||
| 526 | swatchAttr.each(function(){ | 527 | swatchAttr.each(function(){ | |||
| 527 | var elA = $(this); | 528 | var elA = $(this); | |||
| 528 | if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){ | 529 | if(elA.attr('data-option-label') === colorLabel && !elA.hasClass('selected')){ | |||
| 529 | elA.addClass('selected'); | 530 | elA.addClass('selected'); | |||
| 530 | } | 531 | } | |||
| 531 | }); | 532 | }); | |||
| 532 | }); | 533 | }); | |||
| 533 | }, | 534 | }, | |||
| 534 | 535 | |||||
| 535 | renderCategoryTree: function () { | 536 | renderCategoryTree: function () { | |||
| 536 | var iconExpand = this.element.find('.filter-options .icon-expand'); | 537 | var iconExpand = this.element.find('.filter-options .icon-expand'); | |||
| 537 | 538 | |||||
| 538 | iconExpand.each(function () { | 539 | iconExpand.each(function () { | |||
| 539 | var el = $(this); | 540 | var el = $(this); | |||
| 540 | 541 | |||||
| 541 | el.nextAll('ol').each(function() { | 542 | el.nextAll('ol').each(function() { | |||
| 542 | if($(this).find('input[checked]').length !== 0 | 543 | if($(this).find('input[checked]').length !== 0 | |||
| 543 | && !$(this).prevAll('.icon-expand').hasClass('active') | 544 | && !$(this).prevAll('.icon-expand').hasClass('active') | |||
| 544 | ) { | 545 | ) { | |||
| 545 | $(this).show(); | 546 | $(this).show(); | |||
| 546 | $(this).prevAll('.icon-expand').toggleClass('active'); | 547 | $(this).prevAll('.icon-expand').toggleClass('active'); | |||
| 547 | } | 548 | } | |||
| 548 | }); | 549 | }); | |||
| 549 | 550 | |||||
| 550 | el.bind('click', function (e) { | 551 | el.bind('click', function (e) { | |||
| 551 | el.nextAll('ol').toggle(); | 552 | el.nextAll('ol').toggle(); | |||
| 552 | el.toggleClass('active'); | 553 | el.toggleClass('active'); | |||
| 553 | e.stopPropagation(); | 554 | e.stopPropagation(); | |||
| 554 | }); | 555 | }); | |||
| 555 | }); | 556 | }); | |||
| 556 | } | 557 | } | |||
| 557 | }); | 558 | }); | |||
| 558 | 559 | |||||
| 559 | return $.mageplaza.layer; | 560 | return $.mageplaza.layer; | |||
| 560 | }); | 561 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993–2019 Araxis Ltd (www.araxis.com). All rights reserved.