FileMaster
Search
Toggle Dark Mode
Home
/
.
/
wp-content
/
plugins
/
surecart
/
packages
/
blocks-next
/
build
/
blocks
/
currency-switcher
Edit File: view.js
import*as r from"@wordpress/interactivity";var e,t,n={d:function(r,e){for(var t in e)n.o(e,t)&&!n.o(r,t)&&Object.defineProperty(r,t,{enumerable:!0,get:e[t]})},o:function(r,e){return Object.prototype.hasOwnProperty.call(r,e)}},c=(e={store:function(){return r.store}},t={},n.d(t,e),t);const{callbacks:o}=(0,c.store)("surecart/currency-switcher",{callbacks:{initialize(){o.updateCurrencyLinks(),new MutationObserver((()=>{o.updateCurrencyLinks()})).observe(document.body,{childList:!0,subtree:!0})},updateCurrencyLinks(){const r=new URLSearchParams(window.location.search).get("currency");r&&document.querySelectorAll("a").forEach((e=>{try{const t=new URL(e.href);t.origin!==window.location.origin||t.searchParams.has("currency")||(t.searchParams.set("currency",r),e.href=t.toString())}catch(r){return}}))}}});
Save
Back