JSHint fixes.
The other advantage of splitting js out of php files — jshint can run on it! :) :) :)
This commit is contained in:
parent
69b6936d4d
commit
516977bd01
|
@ -1,3 +1,4 @@
|
|||
/* global htmlSettingsTaxLocalizeScript */
|
||||
/**
|
||||
* Used by woocommerce/includes/admin/settings/views/html-settings-tax.php
|
||||
*/
|
||||
|
@ -15,18 +16,19 @@
|
|||
|
||||
$('.wc_tax_rates .remove_tax_rates').click(function() {
|
||||
if ( $tbody.find('tr.current').size() > 0 ) {
|
||||
$current = $tbody.find('tr.current');
|
||||
var $current = $tbody.find('tr.current');
|
||||
$current.find('input').val('');
|
||||
$current.find('input.remove_tax_rate').val('1');
|
||||
|
||||
$current.each(function(){
|
||||
if ( $(this).is('.new') )
|
||||
$(this).remove();
|
||||
else
|
||||
$(this).hide();
|
||||
if ( $(this).is('.new') ) {
|
||||
$( this ).remove();
|
||||
} else {
|
||||
$( this ).hide();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert( data.strings.no_rows_selected );
|
||||
window.alert( data.strings.no_rows_selected );
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
@ -38,28 +40,25 @@
|
|||
$('#rates tr:visible').each(function() {
|
||||
var row = '';
|
||||
$(this).find('td:not(.sort) input').each(function() {
|
||||
var val = '';
|
||||
|
||||
if ( $(this).is('.checkbox') ) {
|
||||
|
||||
if ( $(this).is(':checked') ) {
|
||||
val = 1;
|
||||
} else {
|
||||
val = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
var val = $(this).val();
|
||||
|
||||
if ( ! val )
|
||||
val = $(this).attr('placeholder');
|
||||
val = $(this).val();
|
||||
if ( ! val ) {
|
||||
val = $( this ).attr( 'placeholder' );
|
||||
}
|
||||
}
|
||||
|
||||
row = row + val + ',';
|
||||
});
|
||||
row = row + data.current_class;
|
||||
//row.substring( 0, row.length - 1 );
|
||||
csv_data = csv_data + row + "\n";
|
||||
csv_data = csv_data + row + '\n';
|
||||
});
|
||||
|
||||
$(this).attr( 'href', encodeURI( csv_data ) );
|
||||
|
@ -73,7 +72,7 @@
|
|||
tax_rate_id : 'new-' + size,
|
||||
tax_rate_priority : 1,
|
||||
tax_rate_shipping : 1,
|
||||
new : true
|
||||
newRow : true
|
||||
} );
|
||||
|
||||
if ( $tbody.find('tr.current').size() > 0 ) {
|
||||
|
@ -82,13 +81,13 @@
|
|||
$tbody.append( code );
|
||||
}
|
||||
|
||||
$( "td.country input" ).autocomplete({
|
||||
source: availableCountries,
|
||||
$( 'td.country input' ).autocomplete({
|
||||
source: data.countries,
|
||||
minLength: 3
|
||||
});
|
||||
|
||||
$( "td.state input" ).autocomplete({
|
||||
source: availableStates,
|
||||
$( 'td.state input' ).autocomplete({
|
||||
source: data.states,
|
||||
minLength: 3
|
||||
});
|
||||
|
||||
|
@ -99,12 +98,12 @@
|
|||
$(this).attr( 'name', $(this).attr( 'data-name' ) );
|
||||
});
|
||||
|
||||
$( "td.country input" ).autocomplete({
|
||||
$( 'td.country input' ).autocomplete({
|
||||
source: data.countries,
|
||||
minLength: 3
|
||||
});
|
||||
|
||||
$( "td.state input" ).autocomplete({
|
||||
$( 'td.state input' ).autocomplete({
|
||||
source: data.states,
|
||||
minLength: 3
|
||||
});
|
||||
|
|
|
@ -113,7 +113,7 @@ wp_enqueue_script( 'wc-settings-tax' );
|
|||
<script type="text/html" id="tmpl-wc-tax-table-row">
|
||||
<tr class="tips" data-tip="<?php echo esc_attr( sprintf( __( 'Tax rate ID: %s', 'woocommerce' ), '{{ data.tax_rate_id }}' ) ); ?>">
|
||||
<td class="sort">
|
||||
<# if ( ! data.new ) { #>
|
||||
<# if ( ! data.newRow ) { #>
|
||||
<input type="hidden" class="remove_tax_rate" name="remove_tax_rate[{{ data.tax_rate_id }}]" value="0" />
|
||||
<# } #>
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue