if (document.getElementById('oxi-social-login')!==null) { document.getElementById('oxi-social-login').innerHTML=""; } var oxi_elms = document.querySelectorAll("[class='oxi-social-login']"); for(var i = 0; i < oxi_elms.length; i++) { oxi_elms[i].innerHTML=""; } string = window.location.href; if (string.indexOf('a/social-login') === -1 && getURLParameter('checkout_url') && getURLParameter('_t2')=='social_login') { checkout_url = getURLParameter('checkout_url'); email = getURLParameter('email'); checkout_url = checkout_url.replace('cart?a=false', 'checkout'); parent.postMessage(JSON.stringify({'action':'open_url','url':'https://aqualabtechnologies.myshopify.com/a/social-login?checkout_url='+checkout_url+'&email='+email}), 'https://social-login.oxiapps.com'); } else if (string.indexOf('checkout_url') === -1 && getURLParameter('_t2')=='social_login' ) { if (string.indexOf('cart?a=false') !== -1) { $page = window.location.origin+'/checkout'; } else { $page = window.location.origin + window.location.pathname + window.location.hash; } top.location.href = $page; } var resized = false; var response = function(event) { if (event.origin+'/'=="https://social-login.oxiapps.com/") { var message = event.data; var key = message.split(':')[0]; var value = message.split(':')[1]; if (key=="height") { var oxi_iframe = document.getElementById('social_login_frame'); if (oxi_iframe && !resized) { resized = true; oxi_iframe.style.height = value + "px"; } } } } if (window.addEventListener) { window.addEventListener('message', response, false); } else { window.attachEvent("onmessage", response); } function getURLParameter(name) { var url = location.search; url = url.replace(/%3F/g,'?'); url = url.replace(/%2F/g,'/'); url = url.replace(/%26/g,'&'); url = url.replace(/%3D/g,'='); url = url.replace(/%7C/g,'|'); return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^|]*)').exec(url) || [null, ''])[1].replace(/\+/g, '%20')) || null; }