1if ( typeof jQuery !== 'undefined' ) { 2 jQuery( function( $ ) { 3 4 $( '.wpbdp-zipcodesearch-search-unit .mode-radio' ).change( function () { 5 var $unit = $( this ).parents( '.wpbdp-zipcodesearch-search-unit' ); 6 var $distance_fields = $unit.find('.wpbdp-zipcodesearch-distance-fields'); 7 var val = $(this).val(); 8 9 if ('distance' == val) 10 $distance_fields.removeClass('hidden'); 11 else 12 $distance_fields.addClass('hidden'); 13 }); 14 15 $(window).on('wpbdp_submit_refresh', function (event, submit, section_id) { 16 zip_autocomplete( '.wpbdp-form-field.wpbdp-zipcodesearch-autocomplete' ); 17 }); 18 19 zip_autocomplete = function ( $element ) { 20 $( $element ).each(function () { 21 var $field = $(this); 22 var $input = $field.find('input[type="text"]'); 23 24 $input.autocomplete({ 25 source: $field.attr('data-ajaxurl'), 26 minLength: 2, 27 response: function (event, ui) { 28 if (!ui.content || ui.content.length < 2) { 29 $(this).autocomplete('close'); 30 $(this).siblings('.country-hint').val(''); 31 } 32 }, 33 select: function (event, ui) { 34 $(this).siblings('.country-hint').val(ui.item.country); 35 }, 36 }); 37 }); 38 }; 39 40 $(window).on( 'load', function () { 41 if( $( '.zip-field.wpbdp-zipcodesearch-autocomplete, .wpbdp-form-field.wpbdp-zipcodesearch-autocomplete' ).length ) { 42 zip_autocomplete( '.zip-field.wpbdp-zipcodesearch-autocomplete, .wpbdp-form-field.wpbdp-zipcodesearch-autocomplete' ); 43 } 44 } ); 45 46 } ); 47}
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.