Carrello
Il tuo carrello è attualmente vuoto.
Continua a response.json())
.then(data => {
params.success(data);
})
.catch((error) => {
console.error('Error:', error);
});
},
extractImageObject: function(val) {
if(!val || val == '') return false;
var val = val;
// Handle src-sets
if(val.search(/([0-9]+w?h?x?,)/gi) > -1) {
val = val.split(/([0-9]+w?h?x?,)/gi)[0];
}
var url = val;
var host = file = name = type = '';
url = url.substring(0, (url.indexOf("#") == -1) ? url.length : url.indexOf("#"));
url = url.substring(0, (url.indexOf("?") == -1) ? url.length : url.indexOf("?"));
url = url.substring(url.lastIndexOf("/") + 1, url.length);
var hostBegin = val.indexOf('//') ? val.indexOf('//') : 0;
host = val.substring(hostBegin, val.lastIndexOf('/') + 1);
name = url.replace(/(_[0-9]+x[0-9]*|_{width}x|_{size})?(_crop_(top|center|bottom|left|right))?(@[0-9]*x)?(\.progressive)?\.(jpe?g|png|gif|webp)/gi, "");
type = url.substring(url.lastIndexOf('.')+1, url.length);
file = url.replace(/(_[0-9]+x[0-9]*|_{width}x|_{size})?(_crop_(top|center|bottom|left|right))?(@[0-9]*x)?(\.progressive)?\.(jpe?g|png|gif|webp)/gi, '.'+type);
return {
host: host,
name: name,
type: type,
file: file
}
},
getCurrentLanguage: function() {
return "it";
},
setLanguage: function(code) {
if(!langify.locale.languages.find(x => x.iso_code === code)) return false;
var rootUrl = langify.locale.languages.find(x => x.iso_code === code).root_url;
if(rootUrl == '/') {rootUrl = '';}
var finalUrl = rootUrl + "cart";
if(finalUrl == '') {finalUrl = '/';}
window.location.href = finalUrl;
return true;
},
getCookie: function(name) {
var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
if(v) return v[2];
else return null;
},
setCookie: function(name, value, days) {
var d = new Date;
d.setTime(d.getTime() + 24*60*60*1000*days);
document.cookie = name + "=" + value + ";path=/;expires=" + d.toGMTString();
},
getVersion: function() {
return 2;
},
isOutOfViewport: function (elem) {
var bounding = elem.getBoundingClientRect();
var out = {};
out.top = bounding.top < 0;
out.left = bounding.left < 0;
out.bottom = Math.ceil(bounding.bottom) >= (window.innerHeight || document.documentElement.clientHeight);
out.right = bounding.right > (window.innerWidth || document.documentElement.clientWidth);
out.any = out.top || out.left || out.bottom || out.right;
out.inViewport = bounding.x > 0 && bounding.y > 0;
return out;
},
isDomainFeatureEnabled: function() {
return null;
},
getVal: function(str) {
var v = window.location.search.match(new RegExp('(?:[?&]'+str+'=)([^&]+)'));
return v ? v[1] : null;
},
inIframe: function() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
},
};
var customContents = {};
var customContents_image = {};
var customContents_html = {};
var customContents_text = {};
var customContents_attr = {};
// Custom Contents Section
// Images Section
var languageUrls = [];languageUrls['en'] = '/cart';languageUrls['it'] = '/it/cart';langify.locale = langify.locale || {
primary: false,
iso_code: "it",
root_url: "\/it",
language_id: "ly138034",
languages: [{
iso_code: "en",
root_url: "\/",
language_id: "ly126100",
domain: "",
},{
iso_code: "it",
root_url: "\/it",
language_id: "ly138034",
domain: "",
},
]
};
function isIE() {
ua = navigator.userAgent;
var is_ie = ua.indexOf("MSIE ") > -1 || ua.indexOf("Trident/") > -1;
return is_ie;
}
if (!isIE()){
// Disable link correction ALWAYS on languages with mapped domains
if(langify.locale.languages.find(x => x.iso_code === "it" && x.domain !== '' )) {
langify.settings.observeLinks = false;
}
var langifyObserverCore = function() {
var observedNodes = [];
var intersectionObs = null;
var mutationObs = null;
var mutationObsConfig = {
characterData: true,
characterDataOldValue: true,
attributes: true,
attributeOldValue: true,
childList: true,
subtree: true,
};
function init() {
if(langify.settings.observe) {
spreadCustomContents();
if (window.MutationObserver) {
if (langify.settings.lazyload && window.IntersectionObserver) {
startIntersectionObserver();
} else {
startMutationObserver(null);
}
} else {
startMutationEvents();
}
}
}
// Intersection Observer
function startIntersectionObserver() {
intersectionObs = new IntersectionObserver(callbackIntersectionChange);
var elementNodes = document.getElementsByClassName('shopify-section');
Array.prototype.slice.call(elementNodes).forEach(function(node) {
intersectionObs.observe(node);
});
}
function callbackIntersectionChange(intersections) {
intersections.forEach(function(intersection) {
var target = intersection.target;
var targetIsIntersecting = Boolean(target.getAttribute('ly-is-intersecting') === "true" ? true : false);
if(typeof targetIsIntersecting == 'undefined' || targetIsIntersecting == null) {
target.setAttribute('ly-is-intersecting', intersection.isIntersecting);
targetIsIntersecting = intersection.isIntersecting;
}
// On Screen
if(targetIsIntersecting == false && intersection.isIntersecting == true) {
if(!target.getAttribute('ly-is-observing')) {
startMutationObserver(target);
intersectionObs.unobserve(target);
// As the mutation observer didn't see the "add" of the elememts, trigger the initial translation manually
var elementNodes = getNodesUnder(target, 'SHOW_ELEMENT');
var textNodes = getNodesUnder(target, 'SHOW_TEXT');
var nodes = elementNodes.concat(textNodes);
nodes.forEach(function(node) {
translate(node, 'mutation -> childList');
});
}
}
// Off Screen
//else if(targetIsIntersecting == true && intersection.isIntersecting == false) {
// stopMutationObserver(target);
//}
target.setAttribute('ly-is-intersecting', intersection.isIntersecting);
});
}
// Mutation Observer
function startMutationObserver(observerTarget) {
if (!observerTarget) {
var target = document.documentElement || document.body; // main window
} else {
if (observerTarget.nodeName === 'IFRAME') {
var target = observerTarget.contentDocument || observerTarget.contentWindow.document; // iframe
} else {
var target = observerTarget;
}
}
mutationObs = new MutationObserver(callbackDomChange);
mutationObs.observe(target, mutationObsConfig);
observedNodes.push(target);
try { target.setAttribute('ly-is-observing', 'true'); } catch(e) {}
}
function stopMutationObserver(target) {
if(observedNodes.indexOf(target) > -1) {
observedNodes.splice(observedNodes.indexOf(target), 1);
}
var mutations = mutationObs.takeRecords();
mutationObs.disconnect();
observedNodes.forEach(node => {
mutationObs.observe(node, mutationObsConfig);
});
try { target.removeAttribute('ly-is-observing'); } catch(e) {}
}
function callbackDomChange(mutations, mutationObs) {
for (var i = 0, length = mutations.length; i < length; i++) {
var mutation = mutations[i];
var target = mutation.target;
// Links-Hook
if (mutation.type === 'attributes' && (mutation.attributeName === 'href' || mutation.attributeName === 'action')) {
var target = mutation.target;
translateLink(target.getAttribute(mutation.attributeName), target);
}
// Images-Hook
else if (mutation.type === 'attributes' && (mutation.attributeName === 'src' || mutation.attributeName === 'data-src' || mutation.attributeName === 'srcset' || mutation.attributeName === 'data-srcset')) {
translateImage(target, mutation.attributeName);
}
else if (mutation.type === 'attributes' && mutation.attributeName === 'style') {
translateCssImage(target);
}
// Subtree Events
else if (mutation.type === 'childList') {
// Added Nodes
if(mutation.addedNodes.length > 0) {
var elementNodes = getNodesUnder(mutation.target, 'SHOW_ELEMENT');
var textNodes = getNodesUnder(mutation.target, 'SHOW_TEXT');
var nodes = elementNodes.concat(textNodes);
nodes.forEach(function(node) {
translate(node, 'mutation -> childList');
});
}
}
// CharacterData Events
else if (mutation.type === 'characterData') {
var target = mutation.target;
translate(target, 'mutation -> characterData');
}
}
}
function translate(node, info) {
if((node.nodeType === 1 && node.hasAttribute('data-ly-locked')) || (node.nodeType === 3 && node.parentNode && node.parentNode.hasAttribute('data-ly-locked'))) {
return;
}
// CC-Hook
if (node.nodeName !== 'SCRIPT' && node.nodeName !== 'STYLE') {
if (node.nodeType === 3) {
translateTextNode(node, info);
}
translateNodeAttrs(node);
}
// Links-Hook
if (node.nodeName === 'A' || node.nodeName === 'FORM') {
if(node.hasAttribute('href')) var attrName = 'href';
else var attrName = 'action';
var url = node.getAttribute(attrName);
translateLink(url, node);
}
// Images-Hook
if (node.nodeName === 'IMG' || node.nodeName === 'SOURCE') {
translateImage(node, ['src', 'data-src', 'srcset', 'data-srcset']);
}
if (node.attributes && node.getAttribute('style')) {
translateCssImage(node);
}
// Iframe Observation
if (node.nodeName === 'IFRAME') {
// Todo: handle srcdoc iframe content observing
if (node.getAttribute('ly-is-observing') == null && node.getAttribute('src') == null && !node.hasAttribute('srcdoc')) {
node.setAttribute('ly-is-observing', 'true');
startMutationObserver(node);
}
}
}
function translateNodeAttrs(node) {
if(Object.keys(customContents_attr).length > 0) {
}
}
var mutationCount = 0;
function translateTextNode(node, info) {
if(langify.settings.observeCustomContents === false || !node.textContent || node.textContent.trim().length === 0) {
return;
}
var src = node.textContent.trim().replace(/(\r\n|\n|\r)/gim,"").replace(/\s+/g," ").toLowerCase();
if(customContents_text[src] && node.textContent !== customContents_text[src]) {
var newContent = node.textContent.replace(node.textContent.trim(), customContents_text[src]);
if (newContent != node.textContent) {
if(!node.parentNode.hasAttribute('data-ly-mutation-count') || parseInt(node.parentNode.getAttribute('data-ly-mutation-count')) < langify.settings.maxMutations) {
var count = node.parentNode.hasAttribute('data-ly-mutation-count') ? parseInt(node.parentNode.getAttribute('data-ly-mutation-count')) : 0;
node.parentNode.setAttribute('data-ly-mutation-count', count+1);
node.textContent = newContent;
mutationCount = mutationCount + 1;
log('REPLACED (TEXT)', {
oldValue: src,
newValue: customContents_text[src],
mutationCount,
}, 'success'
);
var event = new CustomEvent('langify.observer.aftertranslatetext', {
bubbles: true,
detail: {
target: node,
original: src,
translation: customContents_text[src]
}
});
node.dispatchEvent(event);
}
}
}
}
function translateLink(url, node) {
if(langify.settings.observeLinks === false || node.hasAttribute('data-ly-locked') || !url || (url.indexOf('mailto:') !== -1 || url.indexOf('javascript:') !== -1 || url.indexOf('tel:') !== -1 || url.indexOf('file:') !== -1 || url.indexOf('ftp:') !== -1 || url.indexOf('sms:') !== -1 || url.indexOf('market:') !== -1 || url.indexOf('fax:') !== -1 || url.indexOf('callto:') !== -1 || url.indexOf('ts3server:') !== -1)) {
return;
}
var isLocalized = (url.indexOf('/'+"it"+'/') === 0 || url === '/'+"it" || url.indexOf('/'+"it"+'/') === 0 || url === '/'+"it");
var link = url.replace("https:\/\/bayriaeyewear.com", '').replace(/\/it\//gi, '/');
var isUrlAbsolute = (link.indexOf('://') > 0 || link.indexOf('//') === 0);
var blacklist = ['#', '/it#'].concat(langify.settings.linksBlacklist);
var isUrlBlacklisted = blacklist.find(x => url.indexOf(x) === 0);
if(!isLocalized && !isUrlAbsolute && !isUrlBlacklisted && "\/it" != '/') {
if(node.hasAttribute('href')) var attrName = 'href'; else var attrName = 'action';
if(link === '/' || link == "\/it") link = '';
var newLink = "\/it" + link;
var timeStamp = Math.floor(Date.now());
if(!node.hasAttribute('data-ly-processed') || timeStamp > parseInt(node.getAttribute('data-ly-processed')) + langify.settings.timeout) {
node.setAttribute('data-ly-processed', timeStamp);
node.setAttribute(attrName, newLink);
if(node.hasAttribute('data-'+attrName)) node.setAttribute('data-'+attrName, newLink);
mutationCount = mutationCount + 1;
log('REPLACED (LINK)', {
attrName,
oldValue: url,
newValue: newLink,
mutationCount,
}, 'success'
);
var event = new CustomEvent('langify.observer.aftertranslatelink', {
bubbles: true,
detail: {
target: node,
attribute: attrName,
original: url,
translation: newLink
}
});
node.dispatchEvent(event);
}
}
}
function translateImage(node, attr) {
if(langify.settings.observeImages === false || node.hasAttribute('data-ly-locked') || Object.keys(customContents_image).length === 0) {
return
}
var attrs = [];
if(typeof attr === 'string') attrs.push(attr);
else if(typeof attr === 'object') attrs = attr;
var timeStamp = Math.floor(Date.now());
if(!node.hasAttribute('data-ly-processed') || timeStamp > parseInt(node.getAttribute('data-ly-processed')) + langify.settings.timeout) {
node.setAttribute('data-ly-processed', timeStamp);
attrs.forEach(function(attr) {
if(node.hasAttribute(attr)) {
var imgObject = langify.helper.extractImageObject(node.getAttribute(attr));
var imgKey = imgObject ? imgObject.file.toLowerCase() : '';
if(customContents_image[imgKey]) {
// Replace
var oldValue = node.getAttribute(attr);
var translation = node.getAttribute(attr);
translation = translation.replace(new RegExp(imgObject.host, 'g'), customContents_image[imgKey].host);
translation = translation.replace(new RegExp(imgObject.name, 'g'), customContents_image[imgKey].name);
translation = translation.replace(new RegExp(imgObject.type, 'g'), customContents_image[imgKey].type);
// China Hook
if(node.getAttribute(attr).indexOf('cdn.shopifycdn.net') >= 0) {
translation = translation.replace(new RegExp('cdn.shopify.com', 'g'), 'cdn.shopifycdn.net');
}
if(node.getAttribute(attr) != translation) {
node.setAttribute(attr, translation);
mutationCount = mutationCount + 1;
log('REPLACED (IMAGE)', {
attrName: attr,
oldValue: oldValue,
newValue: translation,
mutationCount,
}, 'success');
var event = new CustomEvent('langify.observer.aftertranslateimage', {
bubbles: true,
detail: {
target: node,
attribute: attr,
original: oldValue,
translation: translation
}
});
node.dispatchEvent(event);
}
}
}
});
}
}
function translateCssImage(node) {
if(langify.settings.observeImages === false || node.hasAttribute('data-ly-locked') || Object.keys(customContents_image).length === 0 || !node.getAttribute('style')) {
return
}
var imgMatches = node.getAttribute('style').match(/url\(("|')?(.*)("|')?\)/gi);
if(imgMatches !== null) {
var imgSource = imgMatches[0].replace(/url\(("|')?|("|')?\)/, '');
var imgObject = langify.helper.extractImageObject(imgSource);
var imgKey = imgObject ? imgObject.file.toLowerCase() : '';
var attr = 'style';
if(customContents_image[imgKey]) {
// Replace
var translation = node.getAttribute(attr);
translation = translation.replace(new RegExp(imgObject.host, 'g'), customContents_image[imgKey].host);
translation = translation.replace(new RegExp(imgObject.name, 'g'), customContents_image[imgKey].name);
translation = translation.replace(new RegExp(imgObject.type, 'g'), customContents_image[imgKey].type);
// China Hook
if(node.getAttribute(attr).indexOf('cdn.shopifycdn.net') >= 0) {
translation = translation.replace(new RegExp('cdn.shopify.com', 'g'), 'cdn.shopifycdn.net');
}
if(node.getAttribute(attr) != translation) {
var timeStamp = Math.floor(Date.now());
if(!node.hasAttribute('data-ly-processed') || timeStamp > parseInt(node.getAttribute('data-ly-processed')) + langify.settings.timeout) {
node.setAttribute('data-ly-processed', timeStamp);
node.setAttribute(attr, translation);
mutationCount = mutationCount + 1;
}
}
}
}
}
function findAndLocalizeLinks(target, parent) {
if(target.parentNode && parent) var allLinks = target.parentElement.querySelectorAll('[href],[action]');
else var allLinks = target.querySelectorAll('[href],[action]');
allLinks.forEach(link => {
if(link.hasAttribute('href')) var attrName = 'href'; else var attrName = 'action';
var url = link.getAttribute(attrName);
translateLink(url, link);
});
}
function getNodesUnder(el, show){
var n, a=[], walk=document.createTreeWalker(el, NodeFilter[show] , null, false);
while(n=walk.nextNode()) a.push(n);
return a;
}
function log(title, data, type) {
if(langify.settings.debug) {
let css = 'color: green; font-weight: bold;';
console.log(`%c ${title}: \n`, css, data);
}
}
function spreadCustomContents() {
var getFileName = function(url) {
if(!url || url == '') return;
url = url.substring(0, (url.indexOf("#") == -1) ? url.length : url.indexOf("#"));
url = url.substring(0, (url.indexOf("?") == -1) ? url.length : url.indexOf("?"));
url = url.substring(url.lastIndexOf("/") + 1, url.length);
url = url.replace(/(_[0-9]+x[0-9]*|_{width}x)?(_crop_(top|center|bottom|left|right))?(@[0-9]*x)?(\.progressive)?\.(jpe?g|png|gif|webp)/gi, "");
return '/' + url;
}
Object.entries(customContents).forEach(function(entry) {
//if(/<\/?[a-z][\s\S]*>/i.test(entry[0])) customContents_html[entry[0]] = entry[1];
//else if(/(http(s?):)?([/|.|\w|\s|-])*\.(?:jpe?g|gif|png)/.test(entry[0])) customContents_image[getFileName(entry[0])] = getFileName(entry[1]);
if(/(http(s?):)?([/|.|\w|\s|-])*\.(?:jpe?g|gif|png|webp)/.test(entry[0])) customContents_image[langify.helper.extractImageObject(entry[0]).file] = langify.helper.extractImageObject(entry[1]);
else customContents_text[entry[0]] = entry[1];
});
log('CUSTOM CONTENTS:', {customContents, customContents_text, customContents_image}, 'info')
}
// Polyfill for old browsers
function startMutationEvents() {
var target = document.querySelector('body');
target.addEventListener("DOMAttrModified", function (event) {
if(event.attrName === 'href' || event.attrName === 'action') {
if(event.prevValue != event.newValue) {
translateLink(event.newValue, event.target);
}
}
}, false);
target.addEventListener("DOMSubtreeModified", function (event) {
//findAndLocalizeLinks(event.target, false);
//matchCustomContent(event.target);
}, false);
}
function triggerCustomContents() {
var rootnode = document.getElementsByTagName('body')[0]
var walker = document.createTreeWalker(rootnode, NodeFilter.SHOW_ALL, null, false)
while (walker.nextNode()) {
//console.log(walker.currentNode.tagName)
translate(walker.currentNode, null);
}
}
function stopObserver() {
mutationObs.takeRecords();
mutationObs.disconnect();
}
init();
return {
init: init,
triggerCustomContents: triggerCustomContents,
stopObserver: stopObserver,
}
};
var langifyObserver = langifyObserverCore();
langify.api = {
observer: {
start: langifyObserver.init,
stop: langifyObserver.stopObserver,
trigger: langifyObserver.triggerCustomContents
}
};
}
langify.tools = langify.tools || {
compareJQueryVersion: function(a,b) {if (a === b) {return 0;}var a_components = a.split(".");var b_components = b.split(".");var len = Math.min(a_components.length, b_components.length);for (var i = 0; i < len; i++) {if (parseInt(a_components[i]) > parseInt(b_components[i])) {return 1;}if (parseInt(a_components[i]) < parseInt(b_components[i])) {return -1;}}if (a_components.length > b_components.length) {return 1;}if (a_components.length < b_components.length) {return -1;}return 0;}
};
langify.loader = langify.loader || {
loadScript: function(url, callback) {
var script = document.createElement('script');
script.type = 'text/javascript';
if(script.readyState) {
script.onreadystatechange = function () {
if(script.readyState == 'loaded' || script.readyState == 'complete') {
script.onreadystatechange = null;
callback();
}
};
} else {
script.onload = function () {
callback();
};
}
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
},
reload: function() {
window.location.reload();
}
};
langify.switcher = langify.switcher || {
init: function() {
var lyForceOff = location.search.split('ly-force-off=')[1];
var switcherElements = Array.prototype.slice.call(document.getElementsByClassName('ly-switcher-wrapper'));
if(!switcherElements.length) {
switcherElements = Array.prototype.slice.call(document.getElementsByClassName('ly-languages-switcher'));
}
document.addEventListener('click', function(event) {
if(!event.target.closest('.ly-languages-switcher')) {
var openSwitchers = document.querySelectorAll('.ly-languages-switcher.ly-is-open')
for(i = 0; i < openSwitchers.length; i++) {
openSwitchers[i].classList.remove('ly-is-open');
}
}
});
// Custom positioning
for(i = 0; i < switcherElements.length; i++) {
if(lyForceOff !== 'true' && langify.locale.languages.length > 1) {
switcherElements[i].classList.remove('ly-hide');
}
if(switcherElements[i].classList.contains('ly-custom') && (document.getElementById('ly-custom-'+switcherElements[i].getAttribute('data-breakpoint')) || document.getElementsByClassName('ly-custom-'+switcherElements[i].getAttribute('data-breakpoint')).length )) {
var targets = Array.from(document.getElementsByClassName('ly-custom-'+switcherElements[i].getAttribute('data-breakpoint')));
var target = document.getElementById('ly-custom-'+switcherElements[i].getAttribute('data-breakpoint'));
if(target) targets.push(target);
for(c = 0; c < targets.length; c++) {
var clone = switcherElements[i].cloneNode(true);
targets[c].innerHTML = clone.outerHTML;
}
switcherElements[i].classList.add('ly-hide');
}
}
var links = document.getElementsByClassName('ly-languages-switcher-link');
for(l = 0; l < links.length; l++) {
if(links[l].getAttribute('href') !== '#') {
links[l].setAttribute('href', links[l].getAttribute('href') + window.location.search);
links[l].addEventListener('click', function(event) {
langify.helper.setCookie('ly-lang-selected', this.getAttribute('data-ly-code'), 365);
});
}
}
// Native select event handling
var nativeLangifySelects = document.getElementsByClassName('ly-native-select');
for(var i = 0; i < nativeLangifySelects.length; i++) {
nativeLangifySelects[i].onchange = function() {
var selectedLanguageCode = this[this.selectedIndex].getAttribute('key');
var url = languageUrls[selectedLanguageCode];
if(url) {
langify.helper.setCookie('ly-lang-selected', selectedLanguageCode, 365);
window.location.replace(url+window.location.search);
}
};
}
// Initial cart.attributes update
lyShopifyAPI.getCart(function (cart) {
var currentLanguage = langify.locale.iso_code;
if(!cart.attributes.language || cart.attributes.language != currentLanguage) {
lyShopifyAPI.updateCartAttributes({"language": currentLanguage}, function(data){});
}
});
// Custom Dropdown
var switcher = document.getElementsByClassName('ly-custom-dropdown-switcher');
for(var a = 0; a < switcher.length; a++) {
switcher[a].classList.toggle('ly-is-open');
var isOut = langify.helper.isOutOfViewport(switcher[a]);
if(isOut.bottom && isOut.inViewport) {
switcher[a].classList.add('ly-is-dropup');
var arrows = switcher[a].querySelectorAll('.ly-arrow');
for(var b = 0; b < arrows.length; b++) {
arrows[b].classList.add('ly-arrow-up');
}
}
switcher[a].classList.toggle('ly-is-open');
}
if(langify.locale.languages.length === 1) {
console.info(`%c LANGIFY INFO:\n`, 'font-weight: bold;', 'The language switcher is hidden! This can have one the following reasons: \n * All additional languages are disabled in the "Langify -> Dashboard -> Languages" section. \n * If you are using different domains for your additional languages, ensure that "Cross Domain Links" are enabled inside the "Langify -> Dashboard -> Switcher Configurator -> Domains" section.');
}
this._currencySwitcherBindings();
var event = new CustomEvent('langify.switcher.initialized', {
bubbles: true,
detail: {}
});
},
_currencySwitcherBindings: function() {
var currencySwitcherForm = document.getElementById('currency_switcher_form');
// Switcher-factory backward compability version < 3.2
if(currencySwitcherForm && currencySwitcherForm.querySelector('input[name="currency"]')) {
currencySwitcherForm.querySelector('input[name="currency"]').setAttribute('name', 'currency_code');
}
if(currencySwitcherForm) {
var countryCodeField = currencySwitcherForm.querySelector('input[name="country_code"]');
var languageCodeField = currencySwitcherForm.querySelector('input[name="languageCodeField"]');
var currencySelectSwitcher = document.querySelectorAll('select.ly-currency-switcher , select.ly-country-switcher');
var currencyCustomSwitcher = document.querySelectorAll('div.ly-currency-switcher a, div.ly-country-switcher a');
currencySwitcherForm.querySelector('input[name="return_to"]').value = window.location.pathname;
for(var i=0; i