plugin updates

This commit is contained in:
Tony Volpe
2024-11-15 13:53:04 -05:00
parent 1293d604ca
commit 0238f0c4ca
2009 changed files with 163492 additions and 89543 deletions

View File

@@ -39,7 +39,7 @@ jQuery(function( $ ) {
},
/**
* Insert generate coupon code buttom HTML.
* Insert generate coupon code button HTML.
*/
insert_generate_coupon_code_button: function() {
$( '.post-type-shop_coupon' ).find( '#title' ).after(

View File

@@ -98,9 +98,10 @@
event
) {
// Toggling WP List Table checkboxes should not trigger navigation warnings.
// Theses checkboxes only select/unselect rows, they don't change the form.
if (
$check_column.length &&
$check_column.has( event.target )
$check_column.has( event.target ).length
) {
return;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,94 @@
/* global wc_enhanced_select_params */
/* global wpApiSettings */
jQuery( function( $ ) {
function getEnhancedSelectFormatString() {
return {
'language': {
errorLoading: function() {
// Workaround for https://github.com/select2/select2/issues/4355 instead of i18n_ajax_error.
return wc_enhanced_select_params.i18n_searching;
},
inputTooLong: function( args ) {
var overChars = args.input.length - args.maximum;
if ( 1 === overChars ) {
return wc_enhanced_select_params.i18n_input_too_long_1;
}
return wc_enhanced_select_params.i18n_input_too_long_n.replace( '%qty%', overChars );
},
inputTooShort: function( args ) {
var remainingChars = args.minimum - args.input.length;
if ( 1 === remainingChars ) {
return wc_enhanced_select_params.i18n_input_too_short_1;
}
return wc_enhanced_select_params.i18n_input_too_short_n.replace( '%qty%', remainingChars );
},
loadingMore: function() {
return wc_enhanced_select_params.i18n_load_more;
},
maximumSelected: function( args ) {
if ( args.maximum === 1 ) {
return wc_enhanced_select_params.i18n_selection_too_long_1;
}
return wc_enhanced_select_params.i18n_selection_too_long_n.replace( '%qty%', args.maximum );
},
noResults: function() {
return wc_enhanced_select_params.i18n_no_matches;
},
searching: function() {
return wc_enhanced_select_params.i18n_searching;
}
}
};
}
try {
$( document.body )
.on( 'wc-enhanced-select-init', function() {
// Ajax category search boxes
$( ':input.wc-brands-search' ).filter( ':not(.enhanced)' ).each( function() {
var select2_args = $.extend( {
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
placeholder : $( this ).data( 'placeholder' ),
minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : 3,
escapeMarkup : function( m ) {
return m;
},
ajax: {
url: wpApiSettings.root + 'wc/v3/products/brands',
dataType: 'json',
delay: 250,
headers: {
'X-WP-Nonce': wpApiSettings.nonce
},
data: function( params ) {
return {
hide_empty: 1,
search: params.term
};
},
processResults: function( data ) {
const results = data
.map( term => ({ id: term.slug, text: term.name + ' (' + term.count + ')' }) )
return {
results
};
},
cache: true
}
}, getEnhancedSelectFormatString() );
$( this ).selectWoo( select2_args ).addClass( 'enhanced' );
});
})
.trigger( 'wc-enhanced-select-init' );
} catch( err ) {
// If select2 failed (conflict?) log the error but don't stop other scripts breaking.
window.console.log( err );
}
});

View File

@@ -0,0 +1 @@
jQuery(function(n){try{n(document.body).on("wc-enhanced-select-init",function(){n(":input.wc-brands-search").filter(":not(.enhanced)").each(function(){var e=n.extend({allowClear:!!n(this).data("allow_clear"),placeholder:n(this).data("placeholder"),minimumInputLength:n(this).data("minimum_input_length")?n(this).data("minimum_input_length"):3,escapeMarkup:function(n){return n},ajax:{url:wpApiSettings.root+"wc/v3/products/brands",dataType:"json",delay:250,headers:{"X-WP-Nonce":wpApiSettings.nonce},data:function(n){return{hide_empty:1,search:n.term}},processResults:function(n){return{results:n.map(n=>({id:n.slug,text:n.name+" ("+n.count+")"}))}},cache:!0}},{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(n){var e=n.input.length-n.maximum;return 1===e?wc_enhanced_select_params.i18n_input_too_long_1:wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",e)},inputTooShort:function(n){var e=n.minimum-n.input.length;return 1===e?wc_enhanced_select_params.i18n_input_too_short_1:wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",e)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(n){return 1===n.maximum?wc_enhanced_select_params.i18n_selection_too_long_1:wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",n.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}});n(this).selectWoo(e).addClass("enhanced")})}).trigger("wc-enhanced-select-init")}catch(e){window.console.log(e)}});