1/* global woodmart_settings */ 2(function($) { 3 blonweThemeModule.$document.on(' blonweShopPageInit', function () { 4 blonweThemeModule.woocommercePriceSlider1(); 5 }); 6 7 blonweThemeModule.woocommercePriceSlider1 = function() { 8 if ($(".widget_price_filter")[0]){ 9 // Price Slider 2 10 $( document.body ).on( 'price_slider_create price_slider_slide', function( event, min, max ) { 11 12 $( '.price_slider_amount span.from' ).html( accounting.formatMoney( min, { 13 symbol: woocommerce_price_slider_params.currency_format_symbol, 14 decimal: woocommerce_price_slider_params.currency_format_decimal_sep, 15 thousand: woocommerce_price_slider_params.currency_format_thousand_sep, 16 precision: woocommerce_price_slider_params.currency_format_num_decimals, 17 format: woocommerce_price_slider_params.currency_format 18 } ) ); 19 20 $( '.price_slider_amount span.to' ).html( accounting.formatMoney( max, { 21 symbol: woocommerce_price_slider_params.currency_format_symbol, 22 decimal: woocommerce_price_slider_params.currency_format_decimal_sep, 23 thousand: woocommerce_price_slider_params.currency_format_thousand_sep, 24 precision: woocommerce_price_slider_params.currency_format_num_decimals, 25 format: woocommerce_price_slider_params.currency_format 26 } ) ); 27 28 $( document.body ).trigger( 'price_slider_updated', [ min, max ] ); 29 }); 30 31 function init_price_filter() { 32 $( 'input#min_price, input#max_price' ).hide(); 33 $( '.price_slider, .price_label' ).show(); 34 35 var min_price = $( '.price_slider_amount #min_price' ).data( 'min' ), 36 max_price = $( '.price_slider_amount #max_price' ).data( 'max' ), 37 step = $( '.price_slider_amount' ).data( 'step' ) || 1, 38 current_min_price = $( '.price_slider_amount #min_price' ).val(), 39 current_max_price = $( '.price_slider_amount #max_price' ).val(); 40 41 $( '.price_slider:not(.ui-slider)' ).slider({ 42 range: true, 43 animate: true, 44 min: min_price, 45 max: max_price, 46 step: step, 47 values: [ current_min_price, current_max_price ], 48 create: function() { 49 50 $( '.price_slider_amount #min_price' ).val( current_min_price ); 51 $( '.price_slider_amount #max_price' ).val( current_max_price ); 52 53 $( document.body ).trigger( 'price_slider_create', [ current_min_price, current_max_price ] ); 54 }, 55 slide: function( event, ui ) { 56 57 $( 'input#min_price' ).val( ui.values[0] ); 58 $( 'input#max_price' ).val( ui.values[1] ); 59 60 $( document.body ).trigger( 'price_slider_slide', [ ui.values[0], ui.values[1] ] ); 61 }, 62 change: function( event, ui ) { 63 64 $( document.body ).trigger( 'price_slider_change', [ ui.values[0], ui.values[1] ] ); 65 } 66 }); 67 } 68 69 init_price_filter(); 70 $( document.body ).on( 'init_price_filter', init_price_filter ); 71 72 var hasSelectiveRefresh = ( 73 'undefined' !== typeof wp && 74 wp.customize && 75 wp.customize.selectiveRefresh && 76 wp.customize.widgetsPreview && 77 wp.customize.widgetsPreview.WidgetPartial 78 ); 79 if ( hasSelectiveRefresh ) { 80 wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() { 81 init_price_filter(); 82 } ); 83 } 84 85 // Price Slider 1 86 var $min_price = $('.price_slider_amount #min_price'); 87 var $max_price = $('.price_slider_amount #max_price'); 88 var $products = $('.products'); 89 90 if (typeof woocommerce_price_slider_params === 'undefined' || $min_price.length < 1 || !$.fn.slider) { 91 return false; 92 } 93 94 var $slider = $('.price_slider'); 95 96 if ($slider.slider('instance') !== undefined) { 97 return; 98 } 99 100 // Get markup ready for slider 101 $('input#min_price, input#max_price').hide(); 102 $('.price_slider, .price_label').show(); 103 104 // Price slider uses $ ui 105 var min_price = $min_price.data('min'), 106 max_price = $max_price.data('max'), 107 current_min_price = parseInt(min_price, 10), 108 current_max_price = parseInt(max_price, 10); 109 110 if ($products.attr('data-min_price') && $products.attr('data-min_price').length > 0) { 111 current_min_price = parseInt($products.attr('data-min_price'), 10); 112 } 113 114 if ($products.attr('data-max_price') && $products.attr('data-max_price').length > 0) { 115 current_max_price = parseInt($products.attr('data-max_price'), 10); 116 } 117 118 $slider.slider({ 119 range : true, 120 animate: true, 121 min : min_price, 122 max : max_price, 123 values : [ 124 current_min_price, 125 current_max_price 126 ], 127 create : function() { 128 $min_price.val(current_min_price); 129 $max_price.val(current_max_price); 130 131 blonweThemeModule.$body.trigger('price_slider_create', [ 132 current_min_price, 133 current_max_price 134 ]); 135 }, 136 slide : function(event, ui) { 137 $('input#min_price').val(ui.values[0]); 138 $('input#max_price').val(ui.values[1]); 139 140 blonweThemeModule.$body.trigger('price_slider_slide', [ 141 ui.values[0], 142 ui.values[1] 143 ]); 144 }, 145 change : function(event, ui) { 146 blonweThemeModule.$body.trigger('price_slider_change', [ 147 ui.values[0], 148 ui.values[1] 149 ]); 150 } 151 }); 152 153 setTimeout(function() { 154 blonweThemeModule.$body.trigger('price_slider_create', [ 155 current_min_price, 156 current_max_price 157 ]); 158 159 if ($slider.find('.ui-slider-range').length > 1) { 160 $slider.find('.ui-slider-range').first().remove(); 161 } 162 }, 10); 163 } 164 }; 165 166})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.