1let woocs_interval_search; 2 3woocs_interval_search = setInterval(woocs_search_oprice_filter, 333); 4 5function woocs_search_oprice_filter () { 6 7 let price_filter = jQuery('div[data-filter-type="price-filter"] .wc-block-price-slider input'); 8 9 if (jQuery(price_filter).length) { 10 if (woocs_current_currency.name == woocs_default_currency.name) { 11 clearInterval(woocs_interval_search ); 12 woocs_interval_search = null; 13 return; 14 } 15 16 let price_filter_clon = jQuery(price_filter).parents('.wc-block-price-filter__controls').clone(); 17 jQuery(price_filter).parents('.wc-block-price-filter__controls').replaceWith(price_filter_clon ) 18 19 20 21 clearInterval(woocs_interval_search ); 22 woocs_interval_search = null; 23 woocs_init_real_price_filter(); 24 } 25 26 27} 28 29function woocs_init_real_price_filter() { 30 31 let cuerrency_data = window.wc.priceFormat.getCurrency(); 32 33 let minorUnit = 10 ** cuerrency_data.minorUnit; 34 35 let price_filter_wraper = jQuery('div[data-filter-type="price-filter"]'); 36 37 let min_input = jQuery(price_filter_wraper).find('.wc-block-price-filter__range-input--min'); 38 let max_input = jQuery(price_filter_wraper).find('.wc-block-price-filter__range-input--max'); 39 40 41 let min_current = jQuery(min_input).val(); 42 //jQuery(price_filter_wraper).find('input.wc-block-price-filter__amount--min').attr('value',woocs_convert_price_slider( min_current/100) ) 43 jQuery(price_filter_wraper).find('input.wc-block-price-filter__amount--min').val(window.wc.priceFormat.formatPrice( woocs_convert_price_filter(min_current))); 44 45 let max_current = jQuery(max_input).val(); 46 //jQuery(price_filter_wraper).find('input.wc-block-price-filter__amount--max').attr('value',woocs_convert_price_slider( max_current/100)) 47 jQuery(price_filter_wraper).find('input.wc-block-price-filter__amount--max').val(window.wc.priceFormat.formatPrice( woocs_convert_price_filter(max_current))); 48 49 50 51 jQuery(min_input).on('input', function(){ 52 let min = jQuery(this).val(); 53 jQuery('input.wc-block-price-filter__amount--min').val(window.wc.priceFormat.formatPrice(woocs_convert_price_filter(min))); 54 55 }); 56 jQuery(max_input).on('input', function(){ 57 let max = jQuery(this).val(); 58 jQuery('input.wc-block-price-filter__amount--max').val(window.wc.priceFormat.formatPrice(woocs_convert_price_filter(max))); 59 60 }); 61 62 jQuery('input.wc-block-price-filter__amount--min').on('focus',function(){ 63 let min = jQuery(min_input).val(); 64 jQuery(this).attr('type', 'number'); 65 return jQuery(this).val(woocs_convert_price_filter(min)/minorUnit); 66 }); 67 jQuery('input.wc-block-price-filter__amount--max').on('focus',function(){ 68 let max = jQuery(max_input).val(); 69 jQuery(this).attr('type', 'number'); 70 return jQuery(this).val(woocs_convert_price_filter(max)/minorUnit); 71 }); 72 73 74 jQuery('input.wc-block-price-filter__amount--min').on('focusout',function(){ 75 let min = jQuery(this).val() * minorUnit; 76 let old_min = jQuery(min_input).val(); 77 let range_min = jQuery(min_input).attr('min'); 78 let range_max = jQuery(min_input).attr('max'); 79 jQuery(this).attr('type', 'text'); 80 if (woocs_convert_price_filter(old_min) == min ) { 81 jQuery(this).attr('value', window.wc.priceFormat.formatPrice(woocs_convert_price_filter(old_min))); 82 jQuery(this).val(window.wc.priceFormat.formatPrice(woocs_convert_price_filter(old_min))); 83 return false; 84 } 85 86 jQuery(min_input).trigger('focus'); 87 88 jQuery(min_input).attr('value', woocs_back_convert_price_filter(min)) 89 jQuery(min_input).val(woocs_back_convert_price_filter(min)); 90 91 jQuery(this).attr('value', window.wc.priceFormat.formatPrice(min)); 92 93 94 let percent = parseInt(((jQuery(min_input).val() - range_min)/(range_max - range_min))*100); 95 jQuery('.wc-block-price-filter__range-input-progress').css("--low", percent + "%"); 96 97 jQuery(this).val(window.wc.priceFormat.formatPrice(min)); 98 99 let url_val = {} 100 url_val['min_price'] = -1; 101 if ( jQuery(min_input).val() != range_max) { 102 url_val['min_price'] = jQuery(min_input).val()/minorUnit ; 103 } 104 105
106 if (parseInt(jQuery(max_input).val()) < parseInt(jQuery(min_input).val())) { 107 url_val['max_price'] = -1; 108 109 } 110 111 woocs_do_price_filter(url_val); 112 return true; 113 }); 114 jQuery('input.wc-block-price-filter__amount--max').on('focusout',function(){ 115 let max = jQuery(this).val() * minorUnit; 116 let old_max = jQuery(max_input).val(); 117 let range_min = jQuery(max_input).attr('min'); 118 let range_max = jQuery(max_input).attr('max'); 119 jQuery(this).attr('type', 'text'); 120 if (woocs_convert_price_filter(old_max) == max ) { 121 jQuery(this).attr('value', window.wc.priceFormat.formatPrice(woocs_convert_price_filter(old_max))); 122 jQuery(this).val(window.wc.priceFormat.formatPrice(woocs_convert_price_filter(old_max))); 123 return false; 124 } 125 126 127 jQuery(max_input).trigger('focus'); 128 129 jQuery(max_input).attr('value', woocs_back_convert_price_filter(max)) 130 jQuery(max_input).val(woocs_back_convert_price_filter(max)) 131 jQuery(this).attr('value', window.wc.priceFormat.formatPrice(woocs_convert_price_filter(max))) 132 133 let percent = parseInt(((jQuery(max_input).val() - range_min)/(range_max - range_min))*100); 134 jQuery('.wc-block-price-filter__range-input-progress').css("--high", percent + "%"); 135 jQuery(this).val(window.wc.priceFormat.formatPrice(max)); 136 137 let url_val = {} 138 url_val['max_price'] = -1; 139 if ( jQuery(max_input).val() != range_max) { 140 url_val['max_price'] = jQuery(max_input).val()/minorUnit ; 141 } 142 143 144 if (parseInt(jQuery(max_input).val()) < parseInt(jQuery(min_input).val())) { 145 url_val['min_price'] = -1; 146 147 } 148 149 woocs_do_price_filter(url_val); 150 return true; 151 }); 152} 153function woocs_do_price_filter(properties) { 154 155 var url = new URL(window.location.href); 156 157 158 Object.keys(properties).forEach(key => { 159 if (properties[key] == -1) { 160 url.searchParams.delete(key); 161 }else { 162 url.searchParams.set(key, properties[key]); 163 } 164 }); 165 window.location.href = url.href; 166 167} 168function woocs_unformat_price_filter(formated_price) { 169 let price = 0; 170 let curr_price = window.wc.priceFormat.getCurrency(); 171 172 formated_price = formated_price.replace(curr_price.symbol,'').replace(' ','').replace(curr_price.thousandSeparator,'').replace(curr_price.decimalSeparator,'.'); 173 174 175 return price; 176} 177function woocs_back_convert_price_filter(price) { 178 var label = price; 179 180 181 if (woocs_current_currency.rate !== 1) { 182 label = parseInt(label / parseFloat(woocs_current_currency.rate)); 183 } 184 185 //+++ 186 return label; 187} 188function woocs_convert_price_filter(price) { 189 var label = price; 190 if (woocs_current_currency.rate !== 1) { 191 label = parseInt(label * parseFloat(woocs_current_currency.rate)); 192 } 193 194 //+++ 195 return label; 196}
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.