Fixed all jshint errors #4680
This commit is contained in:
parent
76b312b9e7
commit
62d879e86c
|
@ -138,6 +138,7 @@ jQuery(function( $ ) {
|
|||
var groupby = $( this ) .data( 'groupby' );
|
||||
var export_format = $( this ).data( 'export' );
|
||||
var csv_data = 'data:application/csv;charset=utf-8,';
|
||||
var s, series_data, d;
|
||||
|
||||
if ( 'table' === export_format ) {
|
||||
|
||||
|
@ -183,7 +184,7 @@ jQuery(function( $ ) {
|
|||
});
|
||||
|
||||
// CSV Headers
|
||||
for ( var s = 0; s < series.length; ++s ) {
|
||||
for ( s = 0; s < series.length; ++s ) {
|
||||
csv_data += series[s].label + ',';
|
||||
}
|
||||
|
||||
|
@ -193,9 +194,9 @@ jQuery(function( $ ) {
|
|||
// Get x axis values
|
||||
var xaxis = {};
|
||||
|
||||
for ( var s = 0; s < series.length; ++s ) {
|
||||
var series_data = series[s].data;
|
||||
for ( var d = 0; d < series_data.length; ++d ) {
|
||||
for ( s = 0; s < series.length; ++s ) {
|
||||
series_data = series[s].data;
|
||||
for ( d = 0; d < series_data.length; ++d ) {
|
||||
xaxis[series_data[d][0]] = [];
|
||||
// Zero values to start
|
||||
for ( var i = 0; i < series.length; ++i ) {
|
||||
|
@ -205,9 +206,9 @@ jQuery(function( $ ) {
|
|||
}
|
||||
|
||||
// Add chart data
|
||||
for ( var s = 0; s < series.length; ++s ) {
|
||||
var series_data = series[s].data;
|
||||
for ( var d = 0; d < series_data.length; ++d ) {
|
||||
for ( s = 0; s < series.length; ++s ) {
|
||||
series_data = series[s].data;
|
||||
for ( d = 0; d < series_data.length; ++d ) {
|
||||
xaxis[series_data[d][0]][s] = series_data[d][1];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(a){function b(b,c,d){a('<div class="chart-tooltip">'+d+"</div>").css({top:c-16,left:b+20}).appendTo("body").fadeIn(200)}var c=null,d=null;a(".chart-placeholder").bind("plothover",function(e,f,g){if(g){if((c!==g.dataIndex||d!==g.seriesIndex)&&(c=g.dataIndex,d=g.seriesIndex,a(".chart-tooltip").remove(),g.series.points.show||g.series.enable_tooltip)){var h=g.series.data[g.dataIndex][1],i="";g.series.prepend_label&&(i=i+g.series.label+": "),g.series.prepend_tooltip&&(i+=g.series.prepend_tooltip),i+=h,g.series.append_tooltip&&(i+=g.series.append_tooltip),g.series.pie.show?b(f.pageX,f.pageY,i):b(g.pageX,g.pageY,i)}}else a(".chart-tooltip").remove(),c=null}),a(".wc_sparkline.bars").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),bars:{fillColor:a(this).data("color"),fill:!0,show:!0,lineWidth:1,barWidth:a(this).data("barwidth"),align:"center"},shadowSize:0}];a.plot(a(this),d,c)}),a(".wc_sparkline.lines").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),lines:{fill:!1,show:!0,lineWidth:1,align:"center"},shadowSize:0}];a.plot(a(this),d,c)});var e=a(".range_datepicker").datepicker({changeMonth:!0,changeYear:!0,defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,maxDate:"+0D",showButtonPanel:!0,showOn:"focus",buttonImageOnly:!0,onSelect:function(b){var c=a(this).is(".from")?"minDate":"maxDate",d=a(this).data("datepicker"),f=a.datepicker.parseDate(d.settings.dateFormat||a.datepicker._defaults.dateFormat,b,d.settings);e.not(this).datepicker("option",c,f)}}),f=document.createElement("a");"undefined"==typeof f.download&&a(".export_csv").hide(),a(".export_csv").click(function(){var b=a(this).data("exclude_series")||"";b=b.toString(),b=b.split(",");var c=a(this).data("xaxes"),d=a(this).data("groupby"),e=a(this).data("export"),f="data:application/csv;charset=utf-8,";if("table"===e)a(this).closest("div").find("thead tr,tbody tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();b=b.replace("[?]",""),f+='"'+b+'",'}),f=f.substring(0,f.length-1),f+="\n"}),a(this).closest("div").find("tfoot tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();if(b=b.replace("[?]",""),f+='"'+b+'",',a(this).attr("colspan")>0)for(m=1;m<a(this).attr("colspan");m++)f+='"",'}),f=f.substring(0,f.length-1),f+="\n"});else{if(!window.main_chart)return!1;var g=window.main_chart.getData(),h=[];f+=c+",",a.each(g,function(c,d){b&&-1!==a.inArray(c.toString(),b)||h.push(d)});for(var i=0;i<h.length;++i)f+=h[i].label+",";f=f.substring(0,f.length-1),f+="\n";for(var j={},i=0;i<h.length;++i)for(var k=h[i].data,l=0;l<k.length;++l){j[k[l][0]]=[];for(var m=0;m<h.length;++m)j[k[l][0]].push(0)}for(var i=0;i<h.length;++i)for(var k=h[i].data,l=0;l<k.length;++l)j[k[l][0]][i]=k[l][1];a.each(j,function(a,b){var c=new Date(parseInt(a,10));f+="day"===d?c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+"-"+c.getUTCDate()+",":c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+",";for(var e=0;e<b.length;++e){var g=b[e];Math.round(g)!==g&&(g=parseFloat(g),g=g.toFixed(2)),f+=g+","}f=f.substring(0,f.length-1),f+="\n"})}return a(this).attr("href",encodeURI(f)),!0})});
|
||||
jQuery(function(a){function b(b,c,d){a('<div class="chart-tooltip">'+d+"</div>").css({top:c-16,left:b+20}).appendTo("body").fadeIn(200)}var c=null,d=null;a(".chart-placeholder").bind("plothover",function(e,f,g){if(g){if((c!==g.dataIndex||d!==g.seriesIndex)&&(c=g.dataIndex,d=g.seriesIndex,a(".chart-tooltip").remove(),g.series.points.show||g.series.enable_tooltip)){var h=g.series.data[g.dataIndex][1],i="";g.series.prepend_label&&(i=i+g.series.label+": "),g.series.prepend_tooltip&&(i+=g.series.prepend_tooltip),i+=h,g.series.append_tooltip&&(i+=g.series.append_tooltip),g.series.pie.show?b(f.pageX,f.pageY,i):b(g.pageX,g.pageY,i)}}else a(".chart-tooltip").remove(),c=null}),a(".wc_sparkline.bars").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),bars:{fillColor:a(this).data("color"),fill:!0,show:!0,lineWidth:1,barWidth:a(this).data("barwidth"),align:"center"},shadowSize:0}];a.plot(a(this),d,c)}),a(".wc_sparkline.lines").each(function(){var b=a(this).data("sparkline"),c={grid:{show:!1}},d=[{data:b,color:a(this).data("color"),lines:{fill:!1,show:!0,lineWidth:1,align:"center"},shadowSize:0}];a.plot(a(this),d,c)});var e=a(".range_datepicker").datepicker({changeMonth:!0,changeYear:!0,defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,maxDate:"+0D",showButtonPanel:!0,showOn:"focus",buttonImageOnly:!0,onSelect:function(b){var c=a(this).is(".from")?"minDate":"maxDate",d=a(this).data("datepicker"),f=a.datepicker.parseDate(d.settings.dateFormat||a.datepicker._defaults.dateFormat,b,d.settings);e.not(this).datepicker("option",c,f)}}),f=document.createElement("a");"undefined"==typeof f.download&&a(".export_csv").hide(),a(".export_csv").click(function(){var b=a(this).data("exclude_series")||"";b=b.toString(),b=b.split(",");var c,d,e,f=a(this).data("xaxes"),g=a(this).data("groupby"),h=a(this).data("export"),i="data:application/csv;charset=utf-8,";if("table"===h)a(this).closest("div").find("thead tr,tbody tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();b=b.replace("[?]",""),i+='"'+b+'",'}),i=i.substring(0,i.length-1),i+="\n"}),a(this).closest("div").find("tfoot tr").each(function(){a(this).find("th, td").each(function(){var b=a(this).text();if(b=b.replace("[?]",""),i+='"'+b+'",',a(this).attr("colspan")>0)for(m=1;m<a(this).attr("colspan");m++)i+='"",'}),i=i.substring(0,i.length-1),i+="\n"});else{if(!window.main_chart)return!1;var j=window.main_chart.getData(),k=[];for(i+=f+",",a.each(j,function(c,d){b&&-1!==a.inArray(c.toString(),b)||k.push(d)}),c=0;c<k.length;++c)i+=k[c].label+",";i=i.substring(0,i.length-1),i+="\n";var l={};for(c=0;c<k.length;++c)for(d=k[c].data,e=0;e<d.length;++e){l[d[e][0]]=[];for(var m=0;m<k.length;++m)l[d[e][0]].push(0)}for(c=0;c<k.length;++c)for(d=k[c].data,e=0;e<d.length;++e)l[d[e][0]][c]=d[e][1];a.each(l,function(a,b){var c=new Date(parseInt(a,10));i+="day"===g?c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+"-"+c.getUTCDate()+",":c.getUTCFullYear()+"-"+parseInt(c.getUTCMonth()+1,10)+",";for(var d=0;d<b.length;++d){var e=b[d];Math.round(e)!==e&&(e=parseFloat(e),e=e.toFixed(2)),i+=e+","}i=i.substring(0,i.length-1),i+="\n"})}return a(this).attr("href",encodeURI(i)),!0})});
|
|
@ -7,7 +7,7 @@ jQuery( function ( $ ) {
|
|||
var wc_users_fields = {
|
||||
states: null,
|
||||
init: function() {
|
||||
if ( ! ( typeof wc_users_params.countries === 'undefined' ) ) {
|
||||
if ( typeof wc_users_params.countries !== 'undefined' ) {
|
||||
/* State/Country select boxes */
|
||||
this.states = $.parseJSON( wc_users_params.countries.replace( /"/g, '"' ) );
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
jQuery( function( $ ) {
|
||||
|
||||
// woocommerce_params is required to continue, ensure the object exists
|
||||
if ( typeof woocommerce_params === 'undefined' )
|
||||
if ( typeof woocommerce_params === 'undefined' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$( '#add_payment_method' )
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/*global wc_add_to_cart_variation_params */
|
||||
/*!
|
||||
* Variations Plugin
|
||||
*/
|
||||
|
@ -10,7 +11,6 @@
|
|||
|
||||
for ( var i = 0; i < product_variations.length; i++ ) {
|
||||
var variation = product_variations[i];
|
||||
var variation_id = variation.variation_id;
|
||||
|
||||
if ( $.fn.wc_variation_form.variations_match( variation.attributes, settings ) ) {
|
||||
matching.push( variation );
|
||||
|
@ -46,7 +46,7 @@
|
|||
selected_index--;
|
||||
|
||||
if ( all_variations[ selected_index ].hasOwnProperty( 'variation_description' ) ) {
|
||||
var_description_html = '<div class="woocommerce-variation-description woocommerce-variation-description-' +
|
||||
var_description_html = '<div class="woocommerce-variation-description woocommerce-variation-description-' +
|
||||
all_variations[ selected_index ].variation_id + '">' + all_variations[ selected_index ].variation_description + '</div>';
|
||||
|
||||
return var_description_html;
|
||||
|
@ -62,10 +62,10 @@
|
|||
this.find( '.variations select' ).unbind( 'change focusin' );
|
||||
|
||||
// Bind events
|
||||
$form = this
|
||||
var $form = this
|
||||
|
||||
// On clicking the reset variation button
|
||||
.on( 'click', '.reset_variations', function( event ) {
|
||||
.on( 'click', '.reset_variations', function() {
|
||||
|
||||
$( this ).closest( '.variations_form' ).find( '.variations select' ).val( '' ).change();
|
||||
|
||||
|
@ -73,27 +73,30 @@
|
|||
$weight = $( this ).closest( '.product' ).find( '.product_weight' ),
|
||||
$dimensions = $( this ).closest( '.product' ).find( '.product_dimensions' );
|
||||
|
||||
if ( $sku.attr( 'data-o_sku' ) )
|
||||
if ( $sku.attr( 'data-o_sku' ) ) {
|
||||
$sku.text( $sku.attr( 'data-o_sku' ) );
|
||||
}
|
||||
|
||||
if ( $weight.attr( 'data-o_weight' ) )
|
||||
if ( $weight.attr( 'data-o_weight' ) ) {
|
||||
$weight.text( $weight.attr( 'data-o_weight' ) );
|
||||
}
|
||||
|
||||
if ( $dimensions.attr( 'data-o_dimensions' ) )
|
||||
if ( $dimensions.attr( 'data-o_dimensions' ) ) {
|
||||
$dimensions.text( $dimensions.attr( 'data-o_dimensions' ) );
|
||||
}
|
||||
|
||||
return false;
|
||||
} )
|
||||
|
||||
// Upon changing an option
|
||||
.on( 'change', '.variations select', function( event ) {
|
||||
.on( 'change', '.variations select', function() {
|
||||
|
||||
var $variation_form = $( this ).closest( '.variations_form' ),
|
||||
var_description = $.fn.wc_variation_form.get_variation_description_html( $variation_form, this.selectedIndex );
|
||||
|
||||
// remove variation description on change
|
||||
$variation_form.find( '.variations' ).next( '.woocommerce-variation-description' ).remove();
|
||||
|
||||
|
||||
// display variation description
|
||||
if ( var_description ) {
|
||||
$variation_form.find( '.variations' ).after( var_description );
|
||||
|
@ -121,15 +124,17 @@
|
|||
} )
|
||||
|
||||
// Upon gaining focus
|
||||
.on( 'focusin touchstart', '.variations select', function( event ) {
|
||||
.on( 'focusin touchstart', '.variations select', function() {
|
||||
|
||||
$variation_form = $( this ).closest( '.variations_form' );
|
||||
var attribute_name,
|
||||
$variation_form = $( this ).closest( '.variations_form' );
|
||||
|
||||
// Get attribute name from data-attribute_name, or from input name if it doesn't exist
|
||||
if ( typeof( $( this ).data( 'attribute_name' ) ) != 'undefined' )
|
||||
if ( typeof( $( this ).data( 'attribute_name' ) ) !== 'undefined' ) {
|
||||
attribute_name = $( this ).data( 'attribute_name' );
|
||||
else
|
||||
} else {
|
||||
attribute_name = $( this ).attr( 'name' );
|
||||
}
|
||||
|
||||
$variation_form
|
||||
.trigger( 'woocommerce_variation_select_focusin' )
|
||||
|
@ -139,9 +144,9 @@
|
|||
|
||||
// Check variations
|
||||
.on( 'check_variations', function( event, exclude, focus ) {
|
||||
var all_set = true,
|
||||
var attribute_name, $variation_input,
|
||||
all_set = true,
|
||||
any_set = false,
|
||||
showing_variation = false,
|
||||
current_settings = {},
|
||||
$variation_form = $( this ),
|
||||
$reset_variations = $variation_form.find( '.reset_variations' );
|
||||
|
@ -149,11 +154,11 @@
|
|||
$variation_form.find( '.variations select' ).each( function() {
|
||||
|
||||
// Get attribute name from data-attribute_name, or from input name if it doesn't exist
|
||||
if ( typeof( $( this ).data( 'attribute_name' ) ) != 'undefined' )
|
||||
if ( typeof( $( this ).data( 'attribute_name' ) ) !== 'undefined' ) {
|
||||
attribute_name = $( this ).data( 'attribute_name' );
|
||||
else
|
||||
} else {
|
||||
attribute_name = $( this ).attr( 'name' );
|
||||
|
||||
}
|
||||
|
||||
if ( $( this ).val().length === 0 ) {
|
||||
all_set = false;
|
||||
|
@ -167,26 +172,25 @@
|
|||
current_settings[ attribute_name ] = '';
|
||||
|
||||
} else {
|
||||
|
||||
// Encode entities
|
||||
value = $( this ).val();
|
||||
|
||||
// Add to settings array
|
||||
current_settings[ attribute_name ] = value;
|
||||
current_settings[ attribute_name ] = $( this ).val();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var product_id = parseInt( $variation_form.data( 'product_id' ) ),
|
||||
var product_id = parseInt( $variation_form.data( 'product_id' ), 10 ),
|
||||
all_variations = $variation_form.data( 'product_variations' );
|
||||
|
||||
// Fallback to window property if not set - backwards compat
|
||||
if ( ! all_variations )
|
||||
if ( ! all_variations ) {
|
||||
all_variations = window.product_variations.product_id;
|
||||
if ( ! all_variations )
|
||||
}
|
||||
if ( ! all_variations ) {
|
||||
all_variations = window.product_variations;
|
||||
if ( ! all_variations )
|
||||
}
|
||||
if ( ! all_variations ) {
|
||||
all_variations = window['product_variations_' + product_id ];
|
||||
}
|
||||
|
||||
var matching_variations = $.fn.wc_variation_form.find_matching_variations( all_variations, current_settings );
|
||||
|
||||
|
@ -199,10 +203,11 @@
|
|||
// Found - set ID
|
||||
|
||||
// Get variation input by class, or by input name if class doesn't exist
|
||||
if ( $variation_form.find( 'input.variation_id' ).length > 0 )
|
||||
if ( $variation_form.find( 'input.variation_id' ).length > 0 ) {
|
||||
$variation_input = $variation_form.find( 'input.variation_id' );
|
||||
else
|
||||
} else {
|
||||
$variation_input = $variation_form.find( 'input[name=variation_id]' );
|
||||
}
|
||||
|
||||
// Set ID
|
||||
$variation_input
|
||||
|
@ -216,10 +221,11 @@
|
|||
// Nothing found - reset fields
|
||||
$variation_form.find( '.variations select' ).val( '' );
|
||||
|
||||
if ( ! focus )
|
||||
if ( ! focus ) {
|
||||
$variation_form.trigger( 'reset_image' );
|
||||
}
|
||||
|
||||
alert( wc_add_to_cart_variation_params.i18n_no_matching_variations_text );
|
||||
window.alert( wc_add_to_cart_variation_params.i18n_no_matching_variations_text );
|
||||
|
||||
}
|
||||
|
||||
|
@ -227,32 +233,29 @@
|
|||
|
||||
$variation_form.trigger( 'update_variation_values', [ matching_variations ] );
|
||||
|
||||
if ( ! focus )
|
||||
if ( ! focus ) {
|
||||
$variation_form.trigger( 'reset_image' );
|
||||
}
|
||||
|
||||
if ( ! exclude ) {
|
||||
$variation_form.find( '.single_variation_wrap' ).slideUp( 200 ).trigger( 'hide_variation' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( any_set ) {
|
||||
|
||||
if ( $reset_variations.css( 'visibility' ) === 'hidden' )
|
||||
if ( $reset_variations.css( 'visibility' ) === 'hidden' ) {
|
||||
$reset_variations.css( 'visibility', 'visible' ).hide().fadeIn();
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
$reset_variations.css( 'visibility', 'hidden' );
|
||||
$sku = $( this ).closest( '.product' ).find( '.sku' );
|
||||
var $sku = $( this ).closest( '.product' ).find( '.sku' );
|
||||
$sku.text( $sku.attr( 'data-o_sku' ) );
|
||||
|
||||
}
|
||||
|
||||
} )
|
||||
|
||||
// Reset product image
|
||||
.on( 'reset_image', function( event ) {
|
||||
.on( 'reset_image', function() {
|
||||
|
||||
var $product = $(this).closest( '.product' ),
|
||||
$product_img = $product.find( 'div.images img:eq(0)' ),
|
||||
|
@ -288,16 +291,18 @@
|
|||
// Disable option fields that are unavaiable for current set of attributes
|
||||
.on( 'update_variation_values', function( event, variations ) {
|
||||
|
||||
$variation_form = $( this ).closest( '.variations_form' );
|
||||
var $variation_form = $( this ).closest( '.variations_form' );
|
||||
|
||||
// Loop through selects and disable/enable options based on selections
|
||||
$variation_form.find( '.variations select' ).each( function( index, el ) {
|
||||
|
||||
current_attr_select = $( el );
|
||||
var current_attr_name, variation_active,
|
||||
current_attr_select = $( el );
|
||||
|
||||
// Reset options
|
||||
if ( ! current_attr_select.data( 'attribute_options' ) )
|
||||
if ( ! current_attr_select.data( 'attribute_options' ) ) {
|
||||
current_attr_select.data( 'attribute_options', current_attr_select.find( 'option:gt(0)' ).get() );
|
||||
}
|
||||
|
||||
current_attr_select.find( 'option:gt(0)' ).remove();
|
||||
current_attr_select.append( current_attr_select.data( 'attribute_options' ) );
|
||||
|
@ -307,15 +312,16 @@
|
|||
current_attr_select.find( 'option:gt(0)' ).removeAttr( 'disabled' );
|
||||
|
||||
// Get name from data-attribute_name, or from input name if it doesn't exist
|
||||
if ( typeof( current_attr_select.data( 'attribute_name' ) ) != 'undefined' )
|
||||
if ( typeof( current_attr_select.data( 'attribute_name' ) ) !== 'undefined' ) {
|
||||
current_attr_name = current_attr_select.data( 'attribute_name' );
|
||||
else
|
||||
} else {
|
||||
current_attr_name = current_attr_select.attr( 'name' );
|
||||
}
|
||||
|
||||
// Loop through variations
|
||||
for ( var num in variations ) {
|
||||
|
||||
if ( typeof( variations[ num ] ) != 'undefined' ) {
|
||||
if ( typeof( variations[ num ] ) !== 'undefined' ) {
|
||||
|
||||
var attributes = variations[ num ].attributes;
|
||||
|
||||
|
@ -323,12 +329,13 @@
|
|||
if ( attributes.hasOwnProperty( attr_name ) ) {
|
||||
var attr_val = attributes[ attr_name ];
|
||||
|
||||
if ( attr_name == current_attr_name ) {
|
||||
if ( attr_name === current_attr_name ) {
|
||||
|
||||
if ( variations[ num ].variation_is_active )
|
||||
if ( variations[ num ].variation_is_active ) {
|
||||
variation_active = 'enabled';
|
||||
else
|
||||
} else {
|
||||
variation_active = '';
|
||||
}
|
||||
|
||||
if ( attr_val ) {
|
||||
|
||||
|
@ -336,8 +343,8 @@
|
|||
attr_val = $( '<div/>' ).html( attr_val ).text();
|
||||
|
||||
// Add slashes
|
||||
attr_val = attr_val.replace( /'/g, "\\'" );
|
||||
attr_val = attr_val.replace( /"/g, "\\\"" );
|
||||
attr_val = attr_val.replace( /'/g, '\\\'' );
|
||||
attr_val = attr_val.replace( /"/g, '\\\"' );
|
||||
|
||||
// Compare the meerkat
|
||||
current_attr_select.find( 'option[value="' + attr_val + '"]' ).addClass( 'attached ' + variation_active );
|
||||
|
@ -379,8 +386,7 @@
|
|||
variation_image = variation.image_src,
|
||||
variation_link = variation.image_link,
|
||||
variation_caption = variation.image_caption,
|
||||
variation_title = variation.image_title,
|
||||
variation_alt = variation.image_alt;
|
||||
variation_title = variation.image_title;
|
||||
|
||||
$variation_form.find( '.variations_button' ).show();
|
||||
$variation_form.find( '.single_variation' ).html( variation.price_html + variation.availability_html );
|
||||
|
@ -428,14 +434,17 @@
|
|||
$weight = $product.find( '.product_weight' ),
|
||||
$dimensions = $product.find( '.product_dimensions' );
|
||||
|
||||
if ( ! $sku.attr( 'data-o_sku' ) )
|
||||
if ( ! $sku.attr( 'data-o_sku' ) ) {
|
||||
$sku.attr( 'data-o_sku', $sku.text() );
|
||||
}
|
||||
|
||||
if ( ! $weight.attr( 'data-o_weight' ) )
|
||||
if ( ! $weight.attr( 'data-o_weight' ) ) {
|
||||
$weight.attr( 'data-o_weight', $weight.text() );
|
||||
}
|
||||
|
||||
if ( ! $dimensions.attr( 'data-o_dimensions' ) )
|
||||
if ( ! $dimensions.attr( 'data-o_dimensions' ) ) {
|
||||
$dimensions.attr( 'data-o_dimensions', $dimensions.text() );
|
||||
}
|
||||
|
||||
if ( variation.sku ) {
|
||||
$sku.text( variation.sku );
|
||||
|
@ -465,15 +474,17 @@
|
|||
$variation_form.find( '.single_variation' ).html( '<p>' + wc_add_to_cart_variation_params.i18n_unavailable_text + '</p>' );
|
||||
}
|
||||
|
||||
if ( variation.min_qty !== '' )
|
||||
if ( variation.min_qty !== '' ) {
|
||||
$single_variation_wrap.find( '.quantity input.qty' ).attr( 'min', variation.min_qty ).val( variation.min_qty );
|
||||
else
|
||||
} else {
|
||||
$single_variation_wrap.find( '.quantity input.qty' ).removeAttr( 'min' );
|
||||
}
|
||||
|
||||
if ( variation.max_qty !== '' )
|
||||
if ( variation.max_qty !== '' ) {
|
||||
$single_variation_wrap.find( '.quantity input.qty' ).attr( 'max', variation.max_qty );
|
||||
else
|
||||
} else {
|
||||
$single_variation_wrap.find( '.quantity input.qty' ).removeAttr( 'max' );
|
||||
}
|
||||
|
||||
if ( variation.is_sold_individually === 'yes' ) {
|
||||
$single_variation_wrap.find( '.quantity input.qty' ).val( '1' );
|
||||
|
@ -492,8 +503,9 @@
|
|||
$( function() {
|
||||
|
||||
// wc_add_to_cart_variation_params is required to continue, ensure the object exists
|
||||
if ( typeof wc_add_to_cart_variation_params === 'undefined' )
|
||||
if ( typeof wc_add_to_cart_variation_params === 'undefined' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$( '.variations_form' ).wc_variation_form();
|
||||
$( '.variations_form .variations select' ).change();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,19 +1,22 @@
|
|||
/*global wc_add_to_cart_params */
|
||||
jQuery( function( $ ) {
|
||||
|
||||
// wc_add_to_cart_params is required to continue, ensure the object exists
|
||||
if ( typeof wc_add_to_cart_params === 'undefined' )
|
||||
if ( typeof wc_add_to_cart_params === 'undefined' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Ajax add to cart
|
||||
$( document ).on( 'click', '.add_to_cart_button', function(e) {
|
||||
$( document ).on( 'click', '.add_to_cart_button', function() {
|
||||
|
||||
// AJAX add to cart request
|
||||
var $thisbutton = $( this );
|
||||
|
||||
if ( $thisbutton.is( '.product_type_simple' ) ) {
|
||||
|
||||
if ( ! $thisbutton.attr( 'data-product_id' ) )
|
||||
if ( ! $thisbutton.attr( 'data-product_id' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$thisbutton.removeClass( 'added' );
|
||||
$thisbutton.addClass( 'loading' );
|
||||
|
@ -30,8 +33,9 @@ jQuery( function( $ ) {
|
|||
// Ajax action
|
||||
$.post( wc_add_to_cart_params.wc_ajax_url + 'add_to_cart', data, function( response ) {
|
||||
|
||||
if ( ! response )
|
||||
if ( ! response ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var this_page = window.location.toString();
|
||||
|
||||
|
@ -52,12 +56,12 @@ jQuery( function( $ ) {
|
|||
|
||||
$thisbutton.removeClass( 'loading' );
|
||||
|
||||
fragments = response.fragments;
|
||||
cart_hash = response.cart_hash;
|
||||
var fragments = response.fragments;
|
||||
var cart_hash = response.cart_hash;
|
||||
|
||||
// Block fragments class
|
||||
if ( fragments ) {
|
||||
$.each( fragments, function( key, value ) {
|
||||
$.each( fragments, function( key ) {
|
||||
$( key ).addClass( 'updating' );
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(a){return"undefined"==typeof wc_add_to_cart_params?!1:void a(document).on("click",".add_to_cart_button",function(){var b=a(this);if(b.is(".product_type_simple")){if(!b.attr("data-product_id"))return!0;b.removeClass("added"),b.addClass("loading");var c={};return a.each(b.data(),function(a,b){c[a]=b}),a(document.body).trigger("adding_to_cart",[b,c]),a.post(wc_add_to_cart_params.wc_ajax_url+"add_to_cart",c,function(c){if(c){var d=window.location.toString();return d=d.replace("add-to-cart","added-to-cart"),c.error&&c.product_url?void(window.location=c.product_url):"yes"===wc_add_to_cart_params.cart_redirect_after_add?void(window.location=wc_add_to_cart_params.cart_url):(b.removeClass("loading"),fragments=c.fragments,cart_hash=c.cart_hash,fragments&&a.each(fragments,function(b){a(b).addClass("updating")}),a(".shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}}),b.addClass("added"),wc_add_to_cart_params.is_cart||0!==b.parent().find(".added_to_cart").size()||b.after(' <a href="'+wc_add_to_cart_params.cart_url+'" class="added_to_cart wc-forward" title="'+wc_add_to_cart_params.i18n_view_cart+'">'+wc_add_to_cart_params.i18n_view_cart+"</a>"),fragments&&a.each(fragments,function(b,c){a(b).replaceWith(c)}),a(".widget_shopping_cart, .updating").stop(!0).css("opacity","1").unblock(),a(".shop_table.cart").load(d+" .shop_table.cart:eq(0) > *",function(){a(".shop_table.cart").stop(!0).css("opacity","1").unblock(),a(document.body).trigger("cart_page_refreshed")}),a(".cart_totals").load(d+" .cart_totals:eq(0) > *",function(){a(".cart_totals").stop(!0).css("opacity","1").unblock()}),a(document.body).trigger("added_to_cart",[fragments,cart_hash,b]),void 0)}}),!1}return!0})});
|
||||
jQuery(function(a){return"undefined"==typeof wc_add_to_cart_params?!1:void a(document).on("click",".add_to_cart_button",function(){var b=a(this);if(b.is(".product_type_simple")){if(!b.attr("data-product_id"))return!0;b.removeClass("added"),b.addClass("loading");var c={};return a.each(b.data(),function(a,b){c[a]=b}),a(document.body).trigger("adding_to_cart",[b,c]),a.post(wc_add_to_cart_params.wc_ajax_url+"add_to_cart",c,function(c){if(c){var d=window.location.toString();if(d=d.replace("add-to-cart","added-to-cart"),c.error&&c.product_url)return void(window.location=c.product_url);if("yes"===wc_add_to_cart_params.cart_redirect_after_add)return void(window.location=wc_add_to_cart_params.cart_url);b.removeClass("loading");var e=c.fragments,f=c.cart_hash;e&&a.each(e,function(b){a(b).addClass("updating")}),a(".shop_table.cart, .updating, .cart_totals").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}}),b.addClass("added"),wc_add_to_cart_params.is_cart||0!==b.parent().find(".added_to_cart").size()||b.after(' <a href="'+wc_add_to_cart_params.cart_url+'" class="added_to_cart wc-forward" title="'+wc_add_to_cart_params.i18n_view_cart+'">'+wc_add_to_cart_params.i18n_view_cart+"</a>"),e&&a.each(e,function(b,c){a(b).replaceWith(c)}),a(".widget_shopping_cart, .updating").stop(!0).css("opacity","1").unblock(),a(".shop_table.cart").load(d+" .shop_table.cart:eq(0) > *",function(){a(".shop_table.cart").stop(!0).css("opacity","1").unblock(),a(document.body).trigger("cart_page_refreshed")}),a(".cart_totals").load(d+" .cart_totals:eq(0) > *",function(){a(".cart_totals").stop(!0).css("opacity","1").unblock()}),a(document.body).trigger("added_to_cart",[e,f,b])}}),!1}return!0})});
|
|
@ -1,7 +1,8 @@
|
|||
/*global wc_address_i18n_params */
|
||||
jQuery( function( $ ) {
|
||||
|
||||
// wc_address_i18n_params is required to continue, ensure the object exists
|
||||
if (typeof wc_address_i18n_params === "undefined") {
|
||||
if ( typeof wc_address_i18n_params === 'undefined' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ jQuery( function( $ ) {
|
|||
formatNoMatches: function() {
|
||||
return wc_country_select_params.i18n_no_matches;
|
||||
},
|
||||
formatAjaxError: function( jqXHR, textStatus, errorThrown ) {
|
||||
formatAjaxError: function() {
|
||||
return wc_country_select_params.i18n_ajax_error;
|
||||
},
|
||||
formatInputTooShort: function( input, min ) {
|
||||
|
@ -46,7 +46,7 @@ jQuery( function( $ ) {
|
|||
|
||||
return wc_country_select_params.i18n_selection_too_long_n.replace( '%qty%', limit );
|
||||
},
|
||||
formatLoadMore: function( pageNumber ) {
|
||||
formatLoadMore: function() {
|
||||
return wc_country_select_params.i18n_load_more;
|
||||
},
|
||||
formatSearching: function() {
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
/*global wc_geolocation_params */
|
||||
jQuery( function( $ ) {
|
||||
|
||||
var this_page = window.location.toString();
|
||||
|
||||
var $append_hashes = function() {
|
||||
if ( wc_geolocation_params.hash ) {
|
||||
$( "a[href^='" + wc_geolocation_params.home_url + "']:not(a[href*='v=']), a[href^='/']:not(a[href*='v='])").each( function() {
|
||||
var $this = $(this);
|
||||
var href = $this.attr('href');
|
||||
$( 'a[href^="' + wc_geolocation_params.home_url + '"]:not(a[href*="v="]), a[href^="/"]:not(a[href*="v="])' ).each( function() {
|
||||
var $this = $( this );
|
||||
var href = $this.attr( 'href' );
|
||||
|
||||
if ( href.indexOf( '?' ) > 0 ) {
|
||||
$this.attr( "href", href + '&v=' + wc_geolocation_params.hash );
|
||||
$this.attr( 'href', href + '&v=' + wc_geolocation_params.hash );
|
||||
} else {
|
||||
$this.attr( "href", href + '?v=' + wc_geolocation_params.hash );
|
||||
$this.attr( 'href', href + '?v=' + wc_geolocation_params.hash );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var $geolocation_redirect = function( hash ) {
|
||||
if ( this_page.indexOf( '?v=' ) > 0 || this_page.indexOf( '&v=' ) > 0 ) {
|
||||
this_page = this_page.replace( /v=[^&]+/,"v=" + hash );
|
||||
this_page = this_page.replace( /v=[^&]+/, 'v=' + hash );
|
||||
} else if ( this_page.indexOf( '?' ) > 0 ) {
|
||||
this_page = this_page + '&v=' + hash;
|
||||
} else {
|
||||
|
@ -27,7 +28,7 @@ jQuery( function( $ ) {
|
|||
}
|
||||
|
||||
window.location = this_page;
|
||||
}
|
||||
};
|
||||
|
||||
var $geolocate_customer = {
|
||||
url: wc_geolocation_params.wc_ajax_url + 'get_customer_location',
|
||||
|
@ -48,4 +49,4 @@ jQuery( function( $ ) {
|
|||
});
|
||||
|
||||
$append_hashes();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(a){var b=window.location.toString(),c=function(){wc_geolocation_params.hash&&a("a[href^='"+wc_geolocation_params.home_url+"']:not(a[href*='v=']), a[href^='/']:not(a[href*='v='])").each(function(){var b=a(this),c=b.attr("href");c.indexOf("?")>0?b.attr("href",c+"&v="+wc_geolocation_params.hash):b.attr("href",c+"?v="+wc_geolocation_params.hash)})},d=function(a){b=b.indexOf("?v=")>0||b.indexOf("&v=")>0?b.replace(/v=[^&]+/,"v="+a):b.indexOf("?")>0?b+"&v="+a:b+"?v="+a,window.location=b},e={url:wc_geolocation_params.wc_ajax_url+"get_customer_location",type:"GET",success:function(a){a.success&&a.data.hash&&a.data.hash!==wc_geolocation_params.hash&&d(a.data.hash)}};"1"!==wc_geolocation_params.is_checkout&&a.ajax(e),a(document.body).on("added_to_cart",function(){c()}),c()});
|
||||
jQuery(function(a){var b=window.location.toString(),c=function(){wc_geolocation_params.hash&&a('a[href^="'+wc_geolocation_params.home_url+'"]:not(a[href*="v="]), a[href^="/"]:not(a[href*="v="])').each(function(){var b=a(this),c=b.attr("href");c.indexOf("?")>0?b.attr("href",c+"&v="+wc_geolocation_params.hash):b.attr("href",c+"?v="+wc_geolocation_params.hash)})},d=function(a){b=b.indexOf("?v=")>0||b.indexOf("&v=")>0?b.replace(/v=[^&]+/,"v="+a):b.indexOf("?")>0?b+"&v="+a:b+"?v="+a,window.location=b},e={url:wc_geolocation_params.wc_ajax_url+"get_customer_location",type:"GET",success:function(a){a.success&&a.data.hash&&a.data.hash!==wc_geolocation_params.hash&&d(a.data.hash)}};"1"!==wc_geolocation_params.is_checkout&&a.ajax(e),a(document.body).on("added_to_cart",function(){c()}),c()});
|
|
@ -1,3 +1,4 @@
|
|||
/*global wc_single_product_params */
|
||||
jQuery( function( $ ) {
|
||||
|
||||
// wc_single_product_params is required to continue, ensure the object exists
|
||||
|
@ -6,20 +7,20 @@ jQuery( function( $ ) {
|
|||
}
|
||||
|
||||
// Tabs
|
||||
$('.wc-tabs-wrapper, .woocommerce-tabs')
|
||||
$( '.wc-tabs-wrapper, .woocommerce-tabs' )
|
||||
.on( 'init', function() {
|
||||
$('.wc-tab, .panel:not(.panel .panel)').hide();
|
||||
$( '.wc-tab, .panel:not(.panel .panel)' ).hide();
|
||||
|
||||
var hash = window.location.hash;
|
||||
var url = window.location.href;
|
||||
var $tabs = $( this ).find('.wc-tabs, ul.tabs').first();
|
||||
var $tabs = $( this ).find( '.wc-tabs, ul.tabs' ).first();
|
||||
|
||||
if ( hash.toLowerCase().indexOf( "comment-" ) >= 0 || hash == '#reviews' ) {
|
||||
$tabs.find('li.reviews_tab a').click();
|
||||
} else if ( url.indexOf( "comment-page-" ) > 0 || url.indexOf( "cpage=" ) > 0 ) {
|
||||
$tabs.find('li.reviews_tab a').click();
|
||||
if ( hash.toLowerCase().indexOf( 'comment-' ) >= 0 || hash === '#reviews' ) {
|
||||
$tabs.find( 'li.reviews_tab a' ).click();
|
||||
} else if ( url.indexOf( 'comment-page-' ) > 0 || url.indexOf( 'cpage=' ) > 0 ) {
|
||||
$tabs.find( 'li.reviews_tab a' ).click();
|
||||
} else {
|
||||
$tabs.find('li:first a').click();
|
||||
$tabs.find( 'li:first a' ).click();
|
||||
}
|
||||
})
|
||||
.on( 'click', '.wc-tabs li a, ul.tabs li a', function() {
|
||||
|
@ -27,15 +28,15 @@ jQuery( function( $ ) {
|
|||
var $tabs_wrapper = $tab.closest( '.wc-tabs-wrapper, .woocommerce-tabs' );
|
||||
var $tabs = $tabs_wrapper.find( '.wc-tabs, ul.tabs' );
|
||||
|
||||
$tabs.find('li').removeClass( 'active' );
|
||||
$tabs_wrapper.find('.wc-tab, .panel:not(.panel .panel)').hide();
|
||||
$tabs.find( 'li' ).removeClass( 'active' );
|
||||
$tabs_wrapper.find( '.wc-tab, .panel:not(.panel .panel)' ).hide();
|
||||
|
||||
$tab.closest('li').addClass( 'active' );
|
||||
$tab.closest( 'li' ).addClass( 'active' );
|
||||
$tabs_wrapper.find( $tab.attr( 'href' ) ).show();
|
||||
|
||||
return false;
|
||||
})
|
||||
.trigger('init');
|
||||
.trigger( 'init' );
|
||||
|
||||
$( 'a.woocommerce-review-link' ).click( function() {
|
||||
$( '.reviews_tab a' ).click();
|
||||
|
@ -61,7 +62,7 @@ jQuery( function( $ ) {
|
|||
rating = $rating.val();
|
||||
|
||||
if ( $rating.size() > 0 && ! rating && wc_single_product_params.review_rating_required === 'yes' ) {
|
||||
alert( wc_single_product_params.i18n_required_rating_text );
|
||||
window.alert( wc_single_product_params.i18n_required_rating_text );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
jQuery(function(a){return"undefined"==typeof wc_single_product_params?!1:(a(".wc-tabs-wrapper, .woocommerce-tabs").on("init",function(){a(".wc-tab, .panel:not(.panel .panel)").hide();var b=window.location.hash,c=window.location.href,d=a(this).find(".wc-tabs, ul.tabs").first();b.toLowerCase().indexOf("comment-")>=0||"#reviews"==b?d.find("li.reviews_tab a").click():c.indexOf("comment-page-")>0||c.indexOf("cpage=")>0?d.find("li.reviews_tab a").click():d.find("li:first a").click()}).on("click",".wc-tabs li a, ul.tabs li a",function(){var b=a(this),c=b.closest(".wc-tabs-wrapper, .woocommerce-tabs"),d=c.find(".wc-tabs, ul.tabs");return d.find("li").removeClass("active"),c.find(".wc-tab, .panel:not(.panel .panel)").hide(),b.closest("li").addClass("active"),c.find(b.attr("href")).show(),!1}).trigger("init"),a("a.woocommerce-review-link").click(function(){return a(".reviews_tab a").click(),!0}),a("#rating").hide().before('<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>'),void a("body").on("click","#respond p.stars a",function(){var b=a(this),c=a(this).closest("#respond").find("#rating");return c.val(b.text()),b.siblings("a").removeClass("active"),b.addClass("active"),!1}).on("click","#respond #submit",function(){var b=a(this).closest("#respond").find("#rating"),c=b.val();return b.size()>0&&!c&&"yes"===wc_single_product_params.review_rating_required?(alert(wc_single_product_params.i18n_required_rating_text),!1):void 0}))});
|
||||
jQuery(function(a){return"undefined"==typeof wc_single_product_params?!1:(a(".wc-tabs-wrapper, .woocommerce-tabs").on("init",function(){a(".wc-tab, .panel:not(.panel .panel)").hide();var b=window.location.hash,c=window.location.href,d=a(this).find(".wc-tabs, ul.tabs").first();b.toLowerCase().indexOf("comment-")>=0||"#reviews"===b?d.find("li.reviews_tab a").click():c.indexOf("comment-page-")>0||c.indexOf("cpage=")>0?d.find("li.reviews_tab a").click():d.find("li:first a").click()}).on("click",".wc-tabs li a, ul.tabs li a",function(){var b=a(this),c=b.closest(".wc-tabs-wrapper, .woocommerce-tabs"),d=c.find(".wc-tabs, ul.tabs");return d.find("li").removeClass("active"),c.find(".wc-tab, .panel:not(.panel .panel)").hide(),b.closest("li").addClass("active"),c.find(b.attr("href")).show(),!1}).trigger("init"),a("a.woocommerce-review-link").click(function(){return a(".reviews_tab a").click(),!0}),a("#rating").hide().before('<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>'),void a("body").on("click","#respond p.stars a",function(){var b=a(this),c=a(this).closest("#respond").find("#rating");return c.val(b.text()),b.siblings("a").removeClass("active"),b.addClass("active"),!1}).on("click","#respond #submit",function(){var b=a(this).closest("#respond").find("#rating"),c=b.val();return b.size()>0&&!c&&"yes"===wc_single_product_params.review_rating_required?(window.alert(wc_single_product_params.i18n_required_rating_text),!1):void 0}))});
|
Loading…
Reference in New Issue