Need to re-geolocate on page load to refresh cached pages being viewed with wrong hash

This commit is contained in:
Mike Jolley 2015-06-22 15:35:46 +01:00
parent 9adbdd4a2c
commit 1489fafd06
2 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ jQuery( function( $ ) {
}
};
if ( 0 > this_page.indexOf( '?v=' ) && 0 > this_page.indexOf( '&v=' ) && '1' !== wc_geolocation_params.is_checkout ) {
if ( '1' !== wc_geolocation_params.is_checkout ) {
$.ajax( $geolocate_customer );
}

View File

@ -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)}};0>b.indexOf("?v=")&&0>b.indexOf("&v=")&&"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()});