1jQuery( function ( $ ) { 2 3 function localize_address_fields( address_type ) { 4 const $country = $( `#${address_type}_country` ); 5 6 // If no such element is found, just return 7 if ( ! $country.length ) { 8 return; 9 } 10 11 // Convert country codes to uppercase for case-insensitive comparison 12 const countryCode = ( $country.val() || '' ).trim().toUpperCase(); 13 // Convert field_countries object to array 14 const fieldCountriesArrayUpper = $.map( wcnlpc_nl_account_page.postcode_field_countries, function( value ) { 15 return value.trim().toUpperCase(); 16 } ); 17 18 // Hide custom NL fields by default when country not NL 19 if ( $.inArray( countryCode, fieldCountriesArrayUpper ) === -1 ) { 20 $( `#${address_type}_street_name_field` ).hide(); 21 $( `#${address_type}_house_number_field` ).hide(); 22 $( `#${address_type}_house_number_suffix_field` ).hide(); 23 $( `#${address_type}_address_1_field` ).show(); 24 $( `#${address_type}_address_2_field` ).show(); 25 } else { 26 $( `#${address_type}_street_name_field` ).show(); 27 $( `#${address_type}_house_number_field` ).show(); 28 $( `#${address_type}_house_number_suffix_field` ).show(); 29 $( `#${address_type}_address_1_field` ).hide(); 30 $( `#${address_type}_address_2_field` ).hide(); 31 } 32 } 33 34 localize_address_fields( 'billing' ); 35 localize_address_fields( 'shipping' ); 36 37 $( '#billing_country, #shipping_country' ).on( 'change', function() { 38 let id = $( this ).attr( 'id' ); 39 let address_type = id.replace( '_country', '' ); 40 localize_address_fields( address_type) ; 41 } ); 42 43} );
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.