1jQuery(document).ready(function($) { 2 const countDecimals = value => (Math.floor(value) === value ? 0 : value.toString().split(".")[1]?.length || 0); 3 4 const renderSlider = () => { 5 $('.slider-display').each(function(i, GFSlider) { 6 if (!$(this).hasClass('slider-initialized')) { 7 const slider = $(this); 8 const input = slider.prev(':input'); 9 const value = input.val(); 10 const gfield = input.attr('id'); 11 const tabindex = input.attr('tabindex'); 12 const minrel = input.data('min-relation'); 13 const maxrel = input.data('max-relation'); 14 const min = parseFloat(input.attr('min')); 15 const max = parseFloat(input.attr('max')); 16 let step = parseFloat(input.attr('step')); 17 const visibility = input.data('value-visibility'); 18 const connect = input.data('connect'); 19 const format = input.data('value-format'); 20 let decs = countDecimals(step); 21 22 if (format === 'currency') { 23 const currency = input.data('currency'); 24 if (currency.decimals < decs) { 25 step = [1, 0.1, 0.01][currency.decimals] || step; 26 } 27 decs = currency.decimals; 28 } 29 30 let formatTooltip = false; 31 if (['hover-drag', 'show'].includes(visibility)) { 32 if (format === 'currency') { 33 const currency = input.data('currency'); 34 formatTooltip = wNumb({ 35 decimals: currency.decimals, 36 mark: currency.decimal_separator, 37 thousand: currency.thousand_separator, 38 prefix: currency.symbol_left + currency.symbol_padding, 39 postfix: currency.symbol_padding + currency.symbol_right, 40 }); 41 } else { 42 formatTooltip = wNumb({ 43 decimals: decs, 44 mark: format === 'decimal_comma' ? ',' : undefined, 45 thousand: format === 'decimal_comma' ? '.' : undefined, 46 }); 47 } 48 } 49 50 noUiSlider.create(GFSlider, { 51 start: [value], 52 step: step, 53 range: { 54 min: [min], 55 max: [max], 56 }, 57 format: wNumb({ 58 decimals: decs, 59 }), 60 connect: connect, 61 tooltips: formatTooltip, 62 }); 63 64 slider.addClass('slider-initialized'); 65 66 GFSlider.noUiSlider.on('update', function(sliderVal) { 67 input.attr('value', sliderVal).change(); 68 }); 69 70 document.getElementById(gfield).addEventListener('change', function() { 71 GFSlider.noUiSlider.set(this.value); 72 }); 73 74 slider.append(`<span class="min-val-relation">${minrel}</span><span class="max-val-relation">${maxrel}</span>`); 75 } 76 }); 77 }; 78 79 const initSlider = () => { 80 if ($('.gfield .slider').length) { 81 renderSlider(); 82 } 83 }; 84 85 jQuery(document).bind('gform_page_loaded', initSlider); 86 87 initSlider(); 88});
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.