trigger event when ready (wc_address_i18n_ready)
This commit is contained in:
parent
9799301b0a
commit
3922d186e0
|
@ -14,7 +14,11 @@ jQuery( function( $ ) {
|
||||||
field.addClass( 'validate-required' );
|
field.addClass( 'validate-required' );
|
||||||
|
|
||||||
if ( field.find( 'label .required' ).length === 0 ) {
|
if ( field.find( 'label .required' ).length === 0 ) {
|
||||||
field.find( 'label' ).append( ' <abbr class="required" title="' + wc_address_i18n_params.i18n_required_text + '">*</abbr>' );
|
field.find( 'label' ).append(
|
||||||
|
' <abbr class="required" title="' +
|
||||||
|
wc_address_i18n_params.i18n_required_text +
|
||||||
|
'">*</abbr>'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
field.find( 'label .required' ).remove();
|
field.find( 'label .required' ).remove();
|
||||||
|
@ -27,7 +31,8 @@ jQuery( function( $ ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle locale
|
// Handle locale
|
||||||
$( document.body ).bind( 'country_to_state_changing', function( event, country, wrapper ) {
|
$( document.body )
|
||||||
|
.bind( 'country_to_state_changing', function( event, country, wrapper ) {
|
||||||
var thisform = wrapper, thislocale;
|
var thisform = wrapper, thislocale;
|
||||||
|
|
||||||
if ( typeof locale[ country ] !== 'undefined' ) {
|
if ( typeof locale[ country ] !== 'undefined' ) {
|
||||||
|
@ -65,7 +70,11 @@ jQuery( function( $ ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the i18n label as a placeholder if there is no label element and no i18n placeholder.
|
// Use the i18n label as a placeholder if there is no label element and no i18n placeholder.
|
||||||
if ( typeof fieldLocale.placeholder === 'undefined' && typeof fieldLocale.label !== 'undefined' && ! field.find( 'label' ).length ) {
|
if (
|
||||||
|
typeof fieldLocale.placeholder === 'undefined' &&
|
||||||
|
typeof fieldLocale.label !== 'undefined' &&
|
||||||
|
! field.find( 'label' ).length
|
||||||
|
) {
|
||||||
field.find( 'input' ).attr( 'placeholder', fieldLocale.label );
|
field.find( 'input' ).attr( 'placeholder', fieldLocale.label );
|
||||||
field.find( '.select2-selection__placeholder' ).text( fieldLocale.label );
|
field.find( '.select2-selection__placeholder' ).text( fieldLocale.label );
|
||||||
}
|
}
|
||||||
|
@ -92,7 +101,12 @@ jQuery( function( $ ) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var fieldsets = $('.woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper, .woocommerce-address-fields__field-wrapper, .woocommerce-additional-fields__field-wrapper .woocommerce-account-fields');
|
var fieldsets = $(
|
||||||
|
'.woocommerce-billing-fields__field-wrapper,' +
|
||||||
|
'.woocommerce-shipping-fields__field-wrapper,' +
|
||||||
|
'.woocommerce-address-fields__field-wrapper,' +
|
||||||
|
'.woocommerce-additional-fields__field-wrapper .woocommerce-account-fields'
|
||||||
|
);
|
||||||
|
|
||||||
fieldsets.each( function( index, fieldset ) {
|
fieldsets.each( function( index, fieldset ) {
|
||||||
var rows = $( fieldset ).find( '.form-row' );
|
var rows = $( fieldset ).find( '.form-row' );
|
||||||
|
@ -124,5 +138,6 @@ jQuery( function( $ ) {
|
||||||
|
|
||||||
rows.detach().appendTo( wrapper );
|
rows.detach().appendTo( wrapper );
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
.trigger( 'wc_address_i18n_ready' );
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue