2014-05-27 22:02:27 +00:00
|
|
|
/* global woocommerce_admin */
|
2014-08-08 09:24:38 +00:00
|
|
|
jQuery( function ( $ ) {
|
2011-11-28 15:50:19 +00:00
|
|
|
|
2017-06-28 15:31:55 +00:00
|
|
|
if ( 'undefined' === typeof woocommerce_admin ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-05-16 14:06:22 +00:00
|
|
|
// Add buttons to product screen.
|
|
|
|
var $product_screen = $( '.edit-php.post-type-product' ),
|
2017-05-16 14:36:56 +00:00
|
|
|
$title_action = $product_screen.find( '.page-title-action:first' ),
|
|
|
|
$blankslate = $product_screen.find( '.woocommerce-BlankState' );
|
2017-05-16 14:06:22 +00:00
|
|
|
|
2017-05-16 14:36:56 +00:00
|
|
|
if ( 0 === $blankslate.length ) {
|
|
|
|
$title_action.after( '<a href="' + woocommerce_admin.urls.export_products + '" class="page-title-action">' + woocommerce_admin.strings.export_products + '</a>' );
|
|
|
|
$title_action.after( '<a href="' + woocommerce_admin.urls.import_products + '" class="page-title-action">' + woocommerce_admin.strings.import_products + '</a>' );
|
|
|
|
} else {
|
|
|
|
$title_action.hide();
|
|
|
|
}
|
2017-05-16 14:06:22 +00:00
|
|
|
|
2017-05-17 13:16:38 +00:00
|
|
|
// Progress indicators when showing steps.
|
|
|
|
$( '.woocommerce-progress-form-wrapper .button-next' ).on( 'click', function() {
|
|
|
|
$('.wc-progress-form-content').block({
|
|
|
|
message: null,
|
|
|
|
overlayCSS: {
|
|
|
|
background: '#fff',
|
|
|
|
opacity: 0.6
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return true;
|
|
|
|
} );
|
|
|
|
|
2015-04-23 12:35:27 +00:00
|
|
|
// Field validation error tips
|
|
|
|
$( document.body )
|
2016-04-18 12:27:05 +00:00
|
|
|
|
2015-04-23 12:35:27 +00:00
|
|
|
.on( 'wc_add_error_tip', function( e, element, error_type ) {
|
|
|
|
var offset = element.position();
|
|
|
|
|
2016-03-01 13:08:25 +00:00
|
|
|
if ( element.parent().find( '.wc_error_tip' ).length === 0 ) {
|
2015-04-23 12:35:27 +00:00
|
|
|
element.after( '<div class="wc_error_tip ' + error_type + '">' + woocommerce_admin[error_type] + '</div>' );
|
2015-05-02 16:28:42 +00:00
|
|
|
element.parent().find( '.wc_error_tip' )
|
|
|
|
.css( 'left', offset.left + element.width() - ( element.width() / 2 ) - ( $( '.wc_error_tip' ).width() / 2 ) )
|
|
|
|
.css( 'top', offset.top + element.height() )
|
|
|
|
.fadeIn( '100' );
|
2014-04-17 10:50:43 +00:00
|
|
|
}
|
2015-04-23 12:35:27 +00:00
|
|
|
})
|
2016-04-18 12:27:05 +00:00
|
|
|
|
2015-04-23 12:35:27 +00:00
|
|
|
.on( 'wc_remove_error_tip', function( e, element, error_type ) {
|
2016-04-18 12:27:05 +00:00
|
|
|
element.parent().find( '.wc_error_tip.' + error_type ).fadeOut( '100', function() { $( this ).remove(); } );
|
2015-04-23 12:35:27 +00:00
|
|
|
})
|
2016-04-18 12:27:05 +00:00
|
|
|
|
2015-04-23 12:35:27 +00:00
|
|
|
.on( 'click', function() {
|
2015-05-02 16:28:42 +00:00
|
|
|
$( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } );
|
2015-04-23 12:35:27 +00:00
|
|
|
})
|
2016-04-18 12:27:05 +00:00
|
|
|
|
2015-04-23 12:35:27 +00:00
|
|
|
.on( 'blur', '.wc_input_decimal[type=text], .wc_input_price[type=text], .wc_input_country_iso[type=text]', function() {
|
2015-05-02 16:28:42 +00:00
|
|
|
$( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } );
|
2015-04-23 12:35:27 +00:00
|
|
|
})
|
2016-04-18 12:27:05 +00:00
|
|
|
|
2016-05-17 13:08:23 +00:00
|
|
|
.on( 'change', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc-order-totals #refund_amount[type=text]', function() {
|
2016-04-18 14:37:19 +00:00
|
|
|
var regex;
|
|
|
|
|
2016-05-17 13:08:23 +00:00
|
|
|
if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
|
2016-04-18 14:37:19 +00:00
|
|
|
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
|
2016-04-18 12:27:05 +00:00
|
|
|
} else {
|
2016-04-18 14:37:19 +00:00
|
|
|
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
|
2016-04-18 12:27:05 +00:00
|
|
|
}
|
|
|
|
|
2015-05-02 16:28:42 +00:00
|
|
|
var value = $( this ).val();
|
2015-04-23 12:35:27 +00:00
|
|
|
var newvalue = value.replace( regex, '' );
|
|
|
|
|
|
|
|
if ( value !== newvalue ) {
|
2015-05-02 16:28:42 +00:00
|
|
|
$( this ).val( newvalue );
|
2014-04-17 10:50:43 +00:00
|
|
|
}
|
2015-04-23 12:35:27 +00:00
|
|
|
})
|
2016-04-18 12:27:05 +00:00
|
|
|
|
2016-05-17 13:08:23 +00:00
|
|
|
.on( 'keyup', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc_input_country_iso[type=text], .wc-order-totals #refund_amount[type=text]', function() {
|
2016-04-18 14:37:19 +00:00
|
|
|
var regex, error;
|
|
|
|
|
2016-05-17 13:08:23 +00:00
|
|
|
if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) {
|
2016-04-18 14:37:19 +00:00
|
|
|
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' );
|
|
|
|
error = 'i18n_mon_decimal_error';
|
2016-04-18 12:27:05 +00:00
|
|
|
} else if ( $( this ).is( '.wc_input_country_iso' ) ) {
|
2016-04-29 15:56:43 +00:00
|
|
|
regex = new RegExp( '([^A-Z])+|(.){3,}', 'im' );
|
2016-04-18 14:37:19 +00:00
|
|
|
error = 'i18n_country_iso_error';
|
2016-04-18 12:27:05 +00:00
|
|
|
} else {
|
2016-04-18 14:37:19 +00:00
|
|
|
regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' );
|
|
|
|
error = 'i18n_decimal_error';
|
2016-04-18 12:27:05 +00:00
|
|
|
}
|
|
|
|
|
2015-05-02 16:28:42 +00:00
|
|
|
var value = $( this ).val();
|
2015-04-23 12:35:27 +00:00
|
|
|
var newvalue = value.replace( regex, '' );
|
|
|
|
|
|
|
|
if ( value !== newvalue ) {
|
2016-04-18 12:27:05 +00:00
|
|
|
$( document.body ).triggerHandler( 'wc_add_error_tip', [ $( this ), error ] );
|
2015-04-23 12:35:27 +00:00
|
|
|
} else {
|
2016-04-18 12:27:05 +00:00
|
|
|
$( document.body ).triggerHandler( 'wc_remove_error_tip', [ $( this ), error ] );
|
2015-04-23 12:35:27 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2016-05-16 22:06:05 +00:00
|
|
|
.on( 'change', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
2015-05-02 16:28:42 +00:00
|
|
|
var sale_price_field = $( this ), regular_price_field;
|
2015-04-23 12:35:27 +00:00
|
|
|
|
2015-05-02 16:28:42 +00:00
|
|
|
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
|
|
|
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
2015-04-23 12:35:27 +00:00
|
|
|
} else {
|
2015-05-02 16:28:42 +00:00
|
|
|
regular_price_field = $( '#_regular_price' );
|
2014-08-04 15:28:20 +00:00
|
|
|
}
|
|
|
|
|
2015-05-02 16:28:42 +00:00
|
|
|
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
|
|
|
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
2014-05-27 22:02:27 +00:00
|
|
|
|
2015-04-23 12:35:27 +00:00
|
|
|
if ( sale_price >= regular_price ) {
|
2016-05-16 22:06:05 +00:00
|
|
|
$( this ).val( '' );
|
2014-05-27 22:02:27 +00:00
|
|
|
}
|
2016-03-24 17:26:40 +00:00
|
|
|
})
|
2016-04-18 12:27:05 +00:00
|
|
|
|
2016-05-16 22:06:05 +00:00
|
|
|
.on( 'keyup', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() {
|
2016-04-18 12:27:05 +00:00
|
|
|
var sale_price_field = $( this ), regular_price_field;
|
|
|
|
|
|
|
|
if( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) {
|
|
|
|
regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' );
|
|
|
|
} else {
|
|
|
|
regular_price_field = $( '#_regular_price' );
|
|
|
|
}
|
|
|
|
|
|
|
|
var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
|
|
|
var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) );
|
|
|
|
|
|
|
|
if ( sale_price >= regular_price ) {
|
2016-05-16 22:06:05 +00:00
|
|
|
$( document.body ).triggerHandler( 'wc_add_error_tip', [ $(this), 'i18_sale_less_than_regular_error' ] );
|
|
|
|
} else {
|
|
|
|
$( document.body ).triggerHandler( 'wc_remove_error_tip', [ $(this), 'i18_sale_less_than_regular_error' ] );
|
2016-04-18 12:27:05 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2016-03-24 17:26:40 +00:00
|
|
|
.on( 'init_tooltips', function() {
|
2017-11-22 16:14:30 +00:00
|
|
|
$( '.tips, .help_tip, .woocommerce-help-tip' ).tipTip( {
|
2016-03-24 17:26:40 +00:00
|
|
|
'attribute': 'data-tip',
|
|
|
|
'fadeIn': 50,
|
|
|
|
'fadeOut': 50,
|
|
|
|
'delay': 200
|
2017-11-22 16:14:30 +00:00
|
|
|
} );
|
2016-03-24 17:26:40 +00:00
|
|
|
|
2017-11-22 16:28:11 +00:00
|
|
|
$( '.column-wc_actions .wc-action-button' ).tipTip( {
|
2017-11-22 16:14:30 +00:00
|
|
|
'fadeIn': 50,
|
|
|
|
'fadeOut': 50,
|
|
|
|
'delay': 200
|
|
|
|
} );
|
2016-03-24 17:26:40 +00:00
|
|
|
|
|
|
|
// Add tiptip to parent element for widefat tables
|
|
|
|
$( '.parent-tips' ).each( function() {
|
2017-11-22 16:14:30 +00:00
|
|
|
$( this ).closest( 'a, th' ).attr( 'data-tip', $( this ).data( 'tip' ) ).tipTip( {
|
|
|
|
'attribute': 'data-tip',
|
|
|
|
'fadeIn': 50,
|
|
|
|
'fadeOut': 50,
|
|
|
|
'delay': 200
|
|
|
|
} ).css( 'cursor', 'help' );
|
2016-03-24 17:26:40 +00:00
|
|
|
});
|
2015-04-23 12:35:27 +00:00
|
|
|
});
|
2013-09-27 19:28:42 +00:00
|
|
|
|
2012-03-05 17:19:00 +00:00
|
|
|
// Tooltips
|
2016-03-24 17:26:40 +00:00
|
|
|
$( document.body ).trigger( 'init_tooltips' );
|
2012-08-10 09:35:25 +00:00
|
|
|
|
2013-08-05 15:34:48 +00:00
|
|
|
// wc_input_table tables
|
2015-05-02 16:39:44 +00:00
|
|
|
$( '.wc_input_table.sortable tbody' ).sortable({
|
|
|
|
items: 'tr',
|
|
|
|
cursor: 'move',
|
|
|
|
axis: 'y',
|
|
|
|
scrollSensitivity: 40,
|
2013-08-05 15:34:48 +00:00
|
|
|
forcePlaceholderSize: true,
|
|
|
|
helper: 'clone',
|
|
|
|
opacity: 0.65,
|
|
|
|
placeholder: 'wc-metabox-sortable-placeholder',
|
2015-05-02 16:39:44 +00:00
|
|
|
start: function( event, ui ) {
|
|
|
|
ui.item.css( 'background-color', '#f6f6f6' );
|
2013-08-05 15:34:48 +00:00
|
|
|
},
|
2015-05-02 16:39:44 +00:00
|
|
|
stop: function( event, ui ) {
|
|
|
|
ui.item.removeAttr( 'style' );
|
2013-08-05 15:34:48 +00:00
|
|
|
}
|
|
|
|
});
|
2018-01-03 20:10:08 +00:00
|
|
|
// Focus on inputs within the table if clicked instead of trying to sort.
|
|
|
|
$( '.wc_input_table.sortable tbody input' ).on( 'click', function() {
|
|
|
|
$( this ).focus();
|
|
|
|
} );
|
2013-08-05 15:34:48 +00:00
|
|
|
|
2015-05-02 16:39:44 +00:00
|
|
|
$( '.wc_input_table .remove_rows' ).click( function() {
|
|
|
|
var $tbody = $( this ).closest( '.wc_input_table' ).find( 'tbody' );
|
2016-03-01 13:08:25 +00:00
|
|
|
if ( $tbody.find( 'tr.current' ).length > 0 ) {
|
2015-05-02 16:39:44 +00:00
|
|
|
var $current = $tbody.find( 'tr.current' );
|
|
|
|
$current.each( function() {
|
|
|
|
$( this ).remove();
|
2013-08-05 15:34:48 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
var controlled = false;
|
2016-01-04 11:04:52 +00:00
|
|
|
var shifted = false;
|
|
|
|
var hasFocus = false;
|
2013-08-05 15:34:48 +00:00
|
|
|
|
2015-05-02 16:39:44 +00:00
|
|
|
$( document.body ).bind( 'keyup keydown', function( e ) {
|
2016-01-04 11:04:52 +00:00
|
|
|
shifted = e.shiftKey;
|
|
|
|
controlled = e.ctrlKey || e.metaKey;
|
2015-05-02 16:39:44 +00:00
|
|
|
});
|
2013-08-05 15:34:48 +00:00
|
|
|
|
2015-05-02 16:39:44 +00:00
|
|
|
$( '.wc_input_table' ).on( 'focus click', 'input', function( e ) {
|
2016-01-04 11:04:52 +00:00
|
|
|
var $this_table = $( this ).closest( 'table, tbody' );
|
2015-05-02 16:39:44 +00:00
|
|
|
var $this_row = $( this ).closest( 'tr' );
|
2013-08-05 15:34:48 +00:00
|
|
|
|
2015-05-02 16:39:44 +00:00
|
|
|
if ( ( e.type === 'focus' && hasFocus !== $this_row.index() ) || ( e.type === 'click' && $( this ).is( ':focus' ) ) ) {
|
2013-08-05 15:34:48 +00:00
|
|
|
hasFocus = $this_row.index();
|
|
|
|
|
|
|
|
if ( ! shifted && ! controlled ) {
|
2015-05-02 16:39:44 +00:00
|
|
|
$( 'tr', $this_table ).removeClass( 'current' ).removeClass( 'last_selected' );
|
|
|
|
$this_row.addClass( 'current' ).addClass( 'last_selected' );
|
2013-08-05 15:34:48 +00:00
|
|
|
} else if ( shifted ) {
|
2015-05-02 16:39:44 +00:00
|
|
|
$( 'tr', $this_table ).removeClass( 'current' );
|
|
|
|
$this_row.addClass( 'selected_now' ).addClass( 'current' );
|
2013-08-05 15:34:48 +00:00
|
|
|
|
2016-03-01 13:08:25 +00:00
|
|
|
if ( $( 'tr.last_selected', $this_table ).length > 0 ) {
|
2015-10-08 11:57:42 +00:00
|
|
|
if ( $this_row.index() > $( 'tr.last_selected', $this_table ).index() ) {
|
2015-05-02 16:39:44 +00:00
|
|
|
$( 'tr', $this_table ).slice( $( 'tr.last_selected', $this_table ).index(), $this_row.index() ).addClass( 'current' );
|
2013-08-05 15:34:48 +00:00
|
|
|
} else {
|
2015-05-02 16:39:44 +00:00
|
|
|
$( 'tr', $this_table ).slice( $this_row.index(), $( 'tr.last_selected', $this_table ).index() + 1 ).addClass( 'current' );
|
2013-08-05 15:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-02 16:39:44 +00:00
|
|
|
$( 'tr', $this_table ).removeClass( 'last_selected' );
|
|
|
|
$this_row.addClass( 'last_selected' );
|
2013-08-05 15:34:48 +00:00
|
|
|
} else {
|
2015-05-02 16:39:44 +00:00
|
|
|
$( 'tr', $this_table ).removeClass( 'last_selected' );
|
|
|
|
if ( controlled && $( this ).closest( 'tr' ).is( '.current' ) ) {
|
|
|
|
$this_row.removeClass( 'current' );
|
2013-08-05 15:34:48 +00:00
|
|
|
} else {
|
2015-05-02 16:39:44 +00:00
|
|
|
$this_row.addClass( 'current' ).addClass( 'last_selected' );
|
2013-08-05 15:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-02 16:39:44 +00:00
|
|
|
$( 'tr', $this_table ).removeClass( 'selected_now' );
|
2013-08-05 15:34:48 +00:00
|
|
|
}
|
2015-05-02 16:39:44 +00:00
|
|
|
}).on( 'blur', 'input', function() {
|
2013-08-05 15:34:48 +00:00
|
|
|
hasFocus = false;
|
|
|
|
});
|
|
|
|
|
2015-05-02 16:42:37 +00:00
|
|
|
// Additional cost and Attribute term tables
|
|
|
|
$( '.woocommerce_page_wc-settings .shippingrows tbody tr:even, table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
2012-08-10 09:35:25 +00:00
|
|
|
|
2013-07-31 14:12:53 +00:00
|
|
|
// Show order items on orders page
|
2015-04-13 15:37:22 +00:00
|
|
|
$( document.body ).on( 'click', '.show_order_items', function() {
|
2015-05-02 16:39:44 +00:00
|
|
|
$( this ).closest( 'td' ).find( 'table' ).toggle();
|
2013-07-31 14:12:53 +00:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2015-05-02 16:39:44 +00:00
|
|
|
// Select availability
|
|
|
|
$( 'select.availability' ).change( function() {
|
|
|
|
if ( $( this ).val() === 'all' ) {
|
|
|
|
$( this ).closest( 'tr' ).next( 'tr' ).hide();
|
|
|
|
} else {
|
|
|
|
$( this ).closest( 'tr' ).next( 'tr' ).show();
|
|
|
|
}
|
|
|
|
}).change();
|
2012-08-10 09:35:25 +00:00
|
|
|
|
2015-05-02 16:39:44 +00:00
|
|
|
// Hidden options
|
|
|
|
$( '.hide_options_if_checked' ).each( function() {
|
|
|
|
$( this ).find( 'input:eq(0)' ).change( function() {
|
|
|
|
if ( $( this ).is( ':checked' ) ) {
|
|
|
|
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
|
2012-03-12 15:48:22 +00:00
|
|
|
} else {
|
2015-05-02 16:39:44 +00:00
|
|
|
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
|
2012-03-12 15:48:22 +00:00
|
|
|
}
|
|
|
|
}).change();
|
|
|
|
});
|
2012-08-10 09:35:25 +00:00
|
|
|
|
2015-05-02 16:39:44 +00:00
|
|
|
$( '.show_options_if_checked' ).each( function() {
|
|
|
|
$( this ).find( 'input:eq(0)' ).change( function() {
|
|
|
|
if ( $( this ).is( ':checked' ) ) {
|
|
|
|
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show();
|
2012-03-12 15:48:22 +00:00
|
|
|
} else {
|
2015-05-02 16:39:44 +00:00
|
|
|
$( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide();
|
2012-03-12 15:48:22 +00:00
|
|
|
}
|
|
|
|
}).change();
|
|
|
|
});
|
2012-03-12 09:25:06 +00:00
|
|
|
|
2015-05-02 16:39:44 +00:00
|
|
|
// Demo store notice
|
|
|
|
$( 'input#woocommerce_demo_store' ).change(function() {
|
|
|
|
if ( $( this ).is( ':checked' ) ) {
|
|
|
|
$( '#woocommerce_demo_store_notice' ).closest( 'tr' ).show();
|
2012-08-10 09:35:25 +00:00
|
|
|
} else {
|
2015-05-02 16:39:44 +00:00
|
|
|
$( '#woocommerce_demo_store_notice' ).closest( 'tr' ).hide();
|
2012-08-10 09:35:25 +00:00
|
|
|
}
|
|
|
|
}).change();
|
|
|
|
|
2017-06-08 18:52:34 +00:00
|
|
|
// Reviews.
|
2017-06-08 14:26:30 +00:00
|
|
|
$( 'input#woocommerce_enable_reviews' ).change(function() {
|
|
|
|
if ( $( this ).is( ':checked' ) ) {
|
|
|
|
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).show();
|
|
|
|
} else {
|
|
|
|
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).hide();
|
|
|
|
}
|
|
|
|
}).change();
|
|
|
|
|
2013-11-19 11:04:45 +00:00
|
|
|
// Attribute term table
|
2014-08-08 09:24:38 +00:00
|
|
|
$( 'table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
2016-01-21 00:54:29 +00:00
|
|
|
|
|
|
|
// Load videos when help button is clicked.
|
|
|
|
$( '#contextual-help-link' ).on( 'click', function() {
|
2017-10-12 11:18:37 +00:00
|
|
|
$( '.wc-guided-tour-embed' ).each( function() {
|
|
|
|
var video_id = $( this ).data( 'video_id' );
|
|
|
|
$( this ).replaceWith( '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/' + video_id + '" frameborder="0" allowfullscreen></iframe>' );
|
|
|
|
} );
|
2016-01-21 00:54:29 +00:00
|
|
|
});
|
2014-05-27 22:02:27 +00:00
|
|
|
});
|