File "geolocation.min.js"
Full Path: /home/jlklyejr/public_html/wp-content-20241030122153/plugins/woocommerce/assets/js/frontend/geolocation.min.js
File size: 1.26 KB
MIME-type: text/plain
Charset: utf-8
jQuery(function(e){var t=!1;var o,a=function(){t&&e('a[href^="'+wc_geolocation_params.home_url+'"]:not(a[href*="v="]), a[href^="/"]:not(a[href*="v="])').each(function(){var o=e(this),a=o.attr("href"),n=a.split("#");a=(a=n[0]).indexOf("?")>0?a+"&v="+t:a+"?v="+t,"undefined"!=typeof n[1]&&null!==n[1]&&(a=a+"#"+n[1]),o.attr("href",a)})},n={url:wc_geolocation_params.wc_ajax_url.toString().replace("%%endpoint%%","get_customer_location"),type:"GET",success:function(e){e.success&&e.data.hash&&e.data.hash!==t&&c(e.data.hash)}},c=function(e){Cookies.set("woocommerce_geo_hash",e,{expires:1/24});const t=new URL(window.location).searchParams;t.get("v")!==e&&(t.set("v",e),window.location.search="?"+t.toString())};("string"!=typeof(o=Cookies.get("woocommerce_geo_hash"))||!o.length||(t=o,0)||t&&new URLSearchParams(window.location.search).get("v")!==t)&&e.ajax(n),t&&e("form").each(function(){var o=e(this),a=o.attr("method"),n=o.find('input[name="v"]').length>0;if(a&&"get"===a.toLowerCase()&&!n)o.append('<input type="hidden" name="v" value="'+t+'" />');else{var c=o.attr("action");c&&(c.indexOf("?")>0?o.attr("action",c+"&v="+t):o.attr("action",c+"?v="+t))}}),a(),e(document.body).on("added_to_cart",function(){a()}),e(document.body).on("woocommerce_append_geo_hashes",function(){a()})});