1"use strict"; 2/* global woocommerce_price_slider_params, accounting */ 3jQuery( function( $ ) { 4 5 // woocommerce_price_slider_params is required to continue, ensure the object exists 6 if ( typeof woocommerce_price_slider_params === 'undefined' ) { 7 return false; 8 } 9 10 $( document.body ).bind( 'price_slider_create price_slider_slide', function( event, min, max ) { 11 12 min=woocs_convert_price_slider(min); 13 max=woocs_convert_price_slider(max); 14 var woocs_format="%v %s"; 15 if (woocs_current_currency.position === 'left') { 16 woocs_format="%s%v"; 17 } else if (woocs_current_currency.position === 'left_space') { 18 woocs_format="%s %v"; 19 } else if (woocs_current_currency.position === 'right') { 20 woocs_format="%v%s"; 21 22 } else if (woocs_current_currency.position === 'right_space') { 23 woocs_format="%v %s"; 24 } 25 //woocommerce_price_slider_params.currency_format_num_decimals =woocs_current_currency.decimals; 26 27 $( '.price_slider_amount span.from' ).html( accounting.formatMoney( min, { 28 symbol: woocommerce_price_slider_params.currency_format_symbol, 29 decimal: woocommerce_price_slider_params.currency_format_decimal_sep, 30 thousand: woocommerce_price_slider_params.currency_format_thousand_sep, 31 precision: woocommerce_price_slider_params.currency_format_num_decimals, 32 format: woocs_format 33 } ) ); 34 35 $( '.price_slider_amount span.to' ).html( accounting.formatMoney( max, { 36 symbol: woocommerce_price_slider_params.currency_format_symbol, 37 decimal: woocommerce_price_slider_params.currency_format_decimal_sep, 38 thousand: woocommerce_price_slider_params.currency_format_thousand_sep, 39 precision: woocommerce_price_slider_params.currency_format_num_decimals, 40 format: woocs_format 41 } ) ); 42 43 $( document.body ).trigger( 'price_slider_updated', [ min, max ] ); 44 }); 45 46 function init_price_filter() { 47 $( 'input#min_price, input#max_price' ).hide(); 48 $( '.price_slider, .price_label' ).show(); 49 50 var min_price = $( '.price_slider_amount #min_price' ).data( 'min' ), 51 max_price = $( '.price_slider_amount #max_price' ).data( 'max' ), 52 current_min_price = $( '.price_slider_amount #min_price' ).val(), 53 current_max_price = $( '.price_slider_amount #max_price' ).val(); 54 55 $( '.price_slider:not(.ui-slider)' ).slider({ 56 range: true, 57 animate: true, 58 min: min_price, 59 max: max_price, 60 values: [ current_min_price, current_max_price ], 61 create: function() { 62 63 $( '.price_slider_amount #min_price' ).val( current_min_price ); 64 $( '.price_slider_amount #max_price' ).val( current_max_price ); 65 66 $( document.body ).trigger( 'price_slider_create', [ current_min_price, current_max_price ] ); 67 }, 68 slide: function( event, ui ) { 69 70 $( 'input#min_price' ).val( ui.values[0] ); 71 $( 'input#max_price' ).val( ui.values[1] ); 72 73 $( document.body ).trigger( 'price_slider_slide', [ woocs_convert_price_slider(ui.values[0]), woocs_convert_price_slider(ui.values[1])] ); 74 }, 75 change: function( event, ui ) { 76 77 $( document.body ).trigger( 'price_slider_change', [ ui.values[0], ui.values[1] ] ); 78 } 79 }); 80 81 } 82 83 init_price_filter(); 84 85 var hasSelectiveRefresh = ( 86 'undefined' !== typeof wp && 87 wp.customize && 88 wp.customize.selectiveRefresh && 89 wp.customize.widgetsPreview && 90 wp.customize.widgetsPreview.WidgetPartial 91 ); 92 if ( hasSelectiveRefresh ) { 93 wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() { 94 init_price_filter(); 95 } ); 96 } 97}); 98 99function woocs_convert_price_slider(price){ 100 var label = price; 101 102 if (woocs_current_currency.rate !== 1) { 103 label = Math.ceil(label * parseFloat(woocs_current_currency.rate)); 104 } 105 106 //+++ 107 return label; 108}
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.