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