Merged in feature/MAW-855-import-code-into-aws (pull request #2)
code import from pantheon * code import from pantheon
This commit is contained in:
@@ -463,6 +463,14 @@ jQuery( function ( $ ) {
|
||||
.find( 'option[value="' + $( el ).data( 'taxonomy' ) + '"]' )
|
||||
.attr( 'disabled', 'disabled' );
|
||||
}
|
||||
|
||||
if ( 'undefined' === $(el).attr( 'data-taxonomy' ) || false === $(el).attr( 'data-taxonomy' ) || '' === $(el).attr( 'data-taxonomy' ) ) {
|
||||
add_placeholder_to_attribute_values_field( $(el) );
|
||||
|
||||
$( '.woocommerce_attribute input.woocommerce_attribute_used_for_variations' ).on( 'change', function() {
|
||||
add_placeholder_to_attribute_values_field( $(el) );
|
||||
} );
|
||||
}
|
||||
} );
|
||||
$( 'select.wc-attribute-search' ).data(
|
||||
'disabled-items',
|
||||
@@ -514,6 +522,17 @@ jQuery( function ( $ ) {
|
||||
$attributeListItem.find( 'h3' ).trigger( 'click' );
|
||||
}
|
||||
|
||||
function add_placeholder_to_attribute_values_field( $attributeListItem ) {
|
||||
|
||||
var $used_for_variations_checkbox = $attributeListItem.find( 'input.woocommerce_attribute_used_for_variations' );
|
||||
|
||||
if ( $used_for_variations_checkbox.length && $used_for_variations_checkbox.is( ':checked' ) ) {
|
||||
$attributeListItem.find( 'textarea' ).attr( 'placeholder', woocommerce_admin_meta_boxes.i18n_attributes_used_for_variations_placeholder );
|
||||
} else {
|
||||
$attributeListItem.find( 'textarea' ).attr( 'placeholder', woocommerce_admin_meta_boxes.i18n_attributes_default_placeholder );
|
||||
}
|
||||
}
|
||||
|
||||
function init_select_controls() {
|
||||
$( document.body ).trigger( 'wc-enhanced-select-init' );
|
||||
}
|
||||
@@ -547,6 +566,15 @@ jQuery( function ( $ ) {
|
||||
|
||||
toggle_expansion_of_attribute_list_item( $attributeListItem );
|
||||
|
||||
// Conditionally change the placeholder of product-level Attributes depending on the value of the "Use for variations" checkbox.
|
||||
if ( 'undefined' === typeof globalAttributeId ) {
|
||||
add_placeholder_to_attribute_values_field( $attributeListItem );
|
||||
|
||||
$( '.woocommerce_attribute input.woocommerce_attribute_used_for_variations' ).on( 'change', function() {
|
||||
add_placeholder_to_attribute_values_field( $(this).closest( '.woocommerce_attribute' ) );
|
||||
} );
|
||||
}
|
||||
|
||||
$( document.body ).trigger( 'woocommerce_added_attribute' );
|
||||
|
||||
jQuery.maybe_disable_save_button();
|
||||
@@ -602,6 +630,17 @@ jQuery( function ( $ ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Handle the Attributes onboarding dismissible notice.
|
||||
// If users dismiss the notice, never show it again.
|
||||
if ( localStorage.getItem('attributes-notice-dismissed' ) ) {
|
||||
$( '#product_attributes .notice' ).hide();
|
||||
}
|
||||
|
||||
$( '#product_attributes .notice.woocommerce-message button' ).on( 'click', function( e ) {
|
||||
$( '#product_attributes .notice' ).hide();
|
||||
localStorage.setItem( 'attributes-notice-dismissed', 'true');
|
||||
} );
|
||||
|
||||
$( 'select.wc-attribute-search' ).on( 'select2:select', function ( e ) {
|
||||
const attributeId = e && e.params && e.params.data && e.params.data.id;
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -312,7 +312,7 @@ jQuery( 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',
|
||||
minimumInputLength: $( this ).data( 'minimum_input_length' ) !== null && $( this ).data( 'minimum_input_length' ) !== undefined ? $( this ).data( 'minimum_input_length' ) : '3',
|
||||
escapeMarkup : function( m ) {
|
||||
return m;
|
||||
},
|
||||
@@ -356,7 +356,7 @@ jQuery( 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',
|
||||
minimumInputLength: $( this ).data( 'minimum_input_length' ) !== null && $( this ).data( 'minimum_input_length' ) !== undefined ? $( this ).data( 'minimum_input_length' ) : '3',
|
||||
escapeMarkup : function( m ) {
|
||||
return m;
|
||||
},
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -675,6 +675,10 @@
|
||||
// Order screen.
|
||||
this.$lock_dialog = $( '.woocommerce_page_wc-orders #post-lock-dialog.order-lock-dialog' );
|
||||
if ( 0 !== this.$lock_dialog.length && 'undefined' !== typeof woocommerce_admin_meta_boxes ) {
|
||||
// We do not want WP's lock to interfere.
|
||||
$( document ).off( 'heartbeat-send.refresh-lock' );
|
||||
$( document ).off( 'heartbeat-tick.refresh-lock' );
|
||||
|
||||
$( document ).on( 'heartbeat-send', this.refresh_order_lock );
|
||||
$( document ).on( 'heartbeat-tick', this.check_order_lock );
|
||||
}
|
||||
@@ -688,6 +692,7 @@
|
||||
},
|
||||
|
||||
refresh_order_lock: function( e, data ) {
|
||||
delete data['wp-refresh-post-lock'];
|
||||
data['wc-refresh-order-lock'] = woocommerce_admin_meta_boxes.post_id;
|
||||
},
|
||||
|
||||
@@ -725,7 +730,7 @@
|
||||
},
|
||||
|
||||
send_orders_in_list: function( e, data ) {
|
||||
data['wc-check-locked-orders'] = wc_order_lock.$list_table.find( 'tr input[name="order"]' ).map(
|
||||
data['wc-check-locked-orders'] = wc_order_lock.$list_table.find( 'tr input[name="id[]"]' ).map(
|
||||
function() { return this.value; }
|
||||
).get();
|
||||
},
|
||||
@@ -735,7 +740,7 @@
|
||||
|
||||
wc_order_lock.$list_table.find( 'tr' ).each( function( i, tr ) {
|
||||
var $tr = $( tr );
|
||||
var order_id = $tr.find( 'input[name="order"]' ).val();
|
||||
var order_id = $tr.find( 'input[name="id[]"]' ).val();
|
||||
|
||||
if ( locked_orders[ order_id ] ) {
|
||||
if ( ! $tr.hasClass( 'wp-locked' ) ) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -60,23 +60,22 @@ jQuery( function( $ ) {
|
||||
/**
|
||||
* Removes duplicate notices.
|
||||
*
|
||||
* @param {JQuery Object} notices
|
||||
* @param {JQuery Object} $notices
|
||||
*/
|
||||
var remove_duplicate_notices = function( notices ) {
|
||||
var seen = [];
|
||||
var new_notices = notices;
|
||||
var remove_duplicate_notices = function( $notices ) {
|
||||
var seen = new Set();
|
||||
var deduplicated_notices = [];
|
||||
|
||||
notices.each( function( index ) {
|
||||
var text = $( this ).text();
|
||||
$notices.each( function() {
|
||||
const text = $( this ).text();
|
||||
|
||||
if ( 'undefined' === typeof seen[ text ] ) {
|
||||
seen[ text ] = true;
|
||||
} else {
|
||||
new_notices.splice( index, 1 );
|
||||
if ( ! seen.has( text ) ) {
|
||||
seen.add( text );
|
||||
deduplicated_notices.push( this );
|
||||
}
|
||||
} );
|
||||
|
||||
return new_notices;
|
||||
return $( deduplicated_notices );
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -83,17 +83,14 @@ jQuery( function( $ ) {
|
||||
// Updates our (cookie-based) cache of the hash value. Expires in 1 hour.
|
||||
Cookies.set( 'woocommerce_geo_hash', hash, { expires: 1 / 24 } );
|
||||
|
||||
var this_page = window.location.toString();
|
||||
const urlQuery = new URL( window.location ).searchParams;
|
||||
const existingHash = urlQuery.get( 'v' );
|
||||
|
||||
if ( this_page.indexOf( '?v=' ) > 0 || this_page.indexOf( '&v=' ) > 0 ) {
|
||||
this_page = this_page.replace( /v=[^&]+/, 'v=' + hash );
|
||||
} else if ( this_page.indexOf( '?' ) > 0 ) {
|
||||
this_page = this_page + '&v=' + hash;
|
||||
} else {
|
||||
this_page = this_page + '?v=' + hash;
|
||||
// If the current URL does not contain the expected hash, redirect.
|
||||
if ( existingHash !== hash ) {
|
||||
urlQuery.set( 'v', hash );
|
||||
window.location.search = '?' + urlQuery.toString();
|
||||
}
|
||||
|
||||
window.location = this_page;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1 +1 @@
|
||||
jQuery(function(e){var o=!1;var t,a=function(){o&&e('a[href^="'+wc_geolocation_params.home_url+'"]:not(a[href*="v="]), a[href^="/"]:not(a[href*="v="])').each(function(){var t=e(this),a=t.attr("href"),n=a.split("#");a=(a=n[0]).indexOf("?")>0?a+"&v="+o:a+"?v="+o,"undefined"!=typeof n[1]&&null!==n[1]&&(a=a+"#"+n[1]),t.attr("href",a)})},n={url:wc_geolocation_params.wc_ajax_url.toString().replace("%%endpoint%%","get_customer_location"),type:"GET",success:function(e){e.success&&e.data.hash&&e.data.hash!==o&&i(e.data.hash)}},i=function(e){Cookies.set("woocommerce_geo_hash",e,{expires:1/24});var o=window.location.toString();o=o.indexOf("?v=")>0||o.indexOf("&v=")>0?o.replace(/v=[^&]+/,"v="+e):o.indexOf("?")>0?o+"&v="+e:o+"?v="+e,window.location=o};("string"!=typeof(t=Cookies.get("woocommerce_geo_hash"))||!t.length||(o=t,0)||o&&new URLSearchParams(window.location.search).get("v")!==o)&&e.ajax(n),o&&e("form").each(function(){var t=e(this),a=t.attr("method"),n=t.find('input[name="v"]').length>0;if(a&&"get"===a.toLowerCase()&&!n)t.append('<input type="hidden" name="v" value="'+o+'" />');else{var i=t.attr("action");i&&(i.indexOf("?")>0?t.attr("action",i+"&v="+o):t.attr("action",i+"?v="+o))}}),a(),e(document.body).on("added_to_cart",function(){a()}),e(document.body).on("woocommerce_append_geo_hashes",function(){a()})});
|
||||
jQuery(function(e){var t=!1;var o,a=function(){t&&e('a[href^="'+wc_geolocation_params.home_url+'"]:not(a[href*="v="]), a[href^="/"]:not(a[href*="v="])').each(function(){var o=e(this),a=o.attr("href"),n=a.split("#");a=(a=n[0]).indexOf("?")>0?a+"&v="+t:a+"?v="+t,"undefined"!=typeof n[1]&&null!==n[1]&&(a=a+"#"+n[1]),o.attr("href",a)})},n={url:wc_geolocation_params.wc_ajax_url.toString().replace("%%endpoint%%","get_customer_location"),type:"GET",success:function(e){e.success&&e.data.hash&&e.data.hash!==t&&c(e.data.hash)}},c=function(e){Cookies.set("woocommerce_geo_hash",e,{expires:1/24});const t=new URL(window.location).searchParams;t.get("v")!==e&&(t.set("v",e),window.location.search="?"+t.toString())};("string"!=typeof(o=Cookies.get("woocommerce_geo_hash"))||!o.length||(t=o,0)||t&&new URLSearchParams(window.location.search).get("v")!==t)&&e.ajax(n),t&&e("form").each(function(){var o=e(this),a=o.attr("method"),n=o.find('input[name="v"]').length>0;if(a&&"get"===a.toLowerCase()&&!n)o.append('<input type="hidden" name="v" value="'+t+'" />');else{var c=o.attr("action");c&&(c.indexOf("?")>0?o.attr("action",c+"&v="+t):o.attr("action",c+"?v="+t))}}),a(),e(document.body).on("added_to_cart",function(){a()}),e(document.body).on("woocommerce_append_geo_hashes",function(){a()})});
|
||||
Reference in New Issue
Block a user