Merge pull request #4289 from jaredcobb/master
Make frontend scripts safe to run on non WC pages (check for objects)
This commit is contained in:
commit
bba10ae005
|
@ -1,5 +1,9 @@
|
||||||
jQuery(document).ready(function($){
|
jQuery(document).ready(function($){
|
||||||
|
|
||||||
|
// woocommerce_params is required to continue, ensure the object exists
|
||||||
|
if (typeof woocommerce_params === "undefined")
|
||||||
|
return false;
|
||||||
|
|
||||||
$('#add_payment_method')
|
$('#add_payment_method')
|
||||||
|
|
||||||
/* Payment option selection */
|
/* Payment option selection */
|
||||||
|
|
|
@ -415,6 +415,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
|
// wc_add_to_cart_variation_params is required to continue, ensure the object exists
|
||||||
|
if (typeof wc_add_to_cart_variation_params === "undefined")
|
||||||
|
return false;
|
||||||
|
|
||||||
$('.variations_form').wc_variation_form();
|
$('.variations_form').wc_variation_form();
|
||||||
$('.variations_form .variations select').change();
|
$('.variations_form .variations select').change();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
|
|
||||||
|
// wc_add_to_cart_params is required to continue, ensure the object exists
|
||||||
|
if (typeof wc_add_to_cart_params === "undefined")
|
||||||
|
return false;
|
||||||
|
|
||||||
// Ajax add to cart
|
// Ajax add to cart
|
||||||
$(document).on( 'click', '.add_to_cart_button', function() {
|
$(document).on( 'click', '.add_to_cart_button', function() {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
|
|
||||||
|
// wc_cart_fragments_params is required to continue, ensure the object exists
|
||||||
|
if (typeof wc_cart_fragments_params === "undefined")
|
||||||
|
return false;
|
||||||
|
|
||||||
/** Cart Handling */
|
/** Cart Handling */
|
||||||
$supports_html5_storage = ( 'sessionStorage' in window && window['sessionStorage'] !== null );
|
$supports_html5_storage = ( 'sessionStorage' in window && window['sessionStorage'] !== null );
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
|
|
||||||
|
// wc_cart_params is required to continue, ensure the object exists
|
||||||
|
if (typeof wc_cart_params === "undefined")
|
||||||
|
return false;
|
||||||
|
|
||||||
// Shipping calculator
|
// Shipping calculator
|
||||||
$(document).on( 'click', '.shipping-calculator-button', function() {
|
$(document).on( 'click', '.shipping-calculator-button', function() {
|
||||||
$('.shipping-calculator-form').slideToggle('slow');
|
$('.shipping-calculator-form').slideToggle('slow');
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
|
|
||||||
|
// wc_checkout_params is required to continue, ensure the object exists
|
||||||
|
if (typeof wc_checkout_params === "undefined")
|
||||||
|
return false;
|
||||||
|
|
||||||
var updateTimer;
|
var updateTimer;
|
||||||
var dirtyInput = false;
|
var dirtyInput = false;
|
||||||
var xhr;
|
var xhr;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
|
|
||||||
|
// wc_country_select_params is required to continue, ensure the object exists
|
||||||
|
if (typeof wc_country_select_params === "undefined")
|
||||||
|
return false;
|
||||||
|
|
||||||
/* State/Country select boxes */
|
/* State/Country select boxes */
|
||||||
var states_json = wc_country_select_params.countries.replace(/"/g, '"');
|
var states_json = wc_country_select_params.countries.replace(/"/g, '"');
|
||||||
var states = $.parseJSON( states_json );
|
var states = $.parseJSON( states_json );
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
|
|
||||||
|
// woocommerce_price_slider_params is required to continue, ensure the object exists
|
||||||
|
if (typeof woocommerce_price_slider_params === "undefined")
|
||||||
|
return false;
|
||||||
|
|
||||||
// Get markup ready for slider
|
// Get markup ready for slider
|
||||||
$('input#min_price, input#max_price').hide();
|
$('input#min_price, input#max_price').hide();
|
||||||
$('.price_slider, .price_label').show();
|
$('.price_slider, .price_label').show();
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
|
|
||||||
|
// wc_single_product_params is required to continue, ensure the object exists
|
||||||
|
if (typeof wc_single_product_params === "undefined")
|
||||||
|
return false;
|
||||||
|
|
||||||
// Tabs
|
// Tabs
|
||||||
$('.woocommerce-tabs .panel').hide();
|
$('.woocommerce-tabs .panel').hide();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue