var XURL='https://schilderstyle.de/konfigurator/2/'; var gw = 0; $(document).ready(function() { $("
Anmelden
Warenkorb
").insertAfter($("nav > div.main-menu-right")); $("
Anmelden
Warenkorb
").insertAfter($("div.hamburger-menu")); gw = $(window).width(); // set global width to check horizontal resize event; resizeNavigation() var script = document.createElement("script"); script.src = "https://static-eu.payments-amazon.com/checkout.js"; script.onload = function () { $(document).on('click', '.amazonLogin, .amazonRegister', function(e) { $('#AmazonPayButton').trigger('click'); }); amazon.Pay.renderButton('#AmazonPayButton', { merchantId: 'A1H8MDX3Y29KX5', ledgerCurrency: 'EUR', productType: 'SignIn', placement: 'Cart', buttonColor: 'Gold', createCheckoutSessionConfig: null, signInConfig: { payloadJSON: "{\"signInReturnUrl\":\"https:\/\/schilderstyle.de\/konfigurator\/core\/payments\/amazon-io.php?com=getBuyerToken&source=index\",\"storeId\":\"amzn1.application-oa2-client.8bedf4d4ddda4062ad304b88967687cb\",\"signInScopes\":[\"name\",\"email\",\"postalCode\",\"billingAddress\",\"shippingAddress\",\"phoneNumber\"],\"signInCancelUrl\":\"https:\/\/schilderstyle.de\/konfigurator\/warenkorb\/adressen\/\"}", signature: "hRNMyPUvH5J4BO4\/T73crLyF1RUaaarChtXJ+o4Ri4o3EoJSxtDh3hADSepyknQOpg7C7W8GiDwBV8zJmxdVGNswA8bT2TAOzXqfDgLdgn4wR+hViyz0EHOS28uOmLuIs3zBR95vZuqmM1iIq6pG4RBnfoLYhR6RkSFuVPH6kbdJkmdlXWMcn7otw3rCcK0LqIEYHKw3sVoJ9vBIWrFH2uZGciC6iPdZV45y\/z3mzchISzAH0jTdpsOmgLtNEMXX9sOs3wpDnuahSJFOkk+MS0axqk+zXHWGSU\/+OR53IXpwlw3gI37EPHCiZfQSPHFJiQbYea\/ZzXtcZj6d2b6sSQ==", publicKeyId: 'LIVE-AFG7OYXWALL2LOHDI5NNLGXU', }, }); }; document.body.appendChild(script); $("").insertAfter($("body")); $("").insertAfter($("body")); }); $(document).on('click', '.googleLogin', function() { googleLoginPopup($(this)); }); $(document).on('click', '.facebookLogin', function() { facebookLoginPopup($(this)); }); $(document).on('click', '.googleRegister', function() { googleLoginPopup($(this)); }); $(document).on('click', '.facebookRegister', function() { facebookLoginPopup($(this)); }); $(document).on('click', '.logoutCustomerLink', function (e) { logoutCustomer(e, this); }); function googleLoginPopup(btn) { const form = btn.closest('form'); const value = form.find('input[name="sp"]').val(); const state = JSON.stringify({'action': 'google_login', 'mode': value, 'source' : 'index'}); var googleLoginUrl = 'https://accounts.google.com/o/oauth2/v2/auth?client_id=158119646144-70f4clj1e68eklf8nbhvp67kf34q1ucg.apps.googleusercontent.com&redirect_uri=https://schilderstyle.de/konfigurator/scripts/mmk-io.php&response_type=code&scope=openid+email+profile&access_type=offline&state='+state+'&prompt=consent'; socialLoginPopupWindow(googleLoginUrl,'google', value); } function facebookLoginPopup(btn) { const form = btn.closest('form'); const value = form.find('input[name="sp"]').val(); const state = JSON.stringify({'action': 'fb_login', 'mode': value, 'source': 'index'}); var fbLoginUrl = 'https://www.facebook.com/v21.0/dialog/oauth?client_id=AppID&redirect_uri=https://schilderstyle.de/konfigurator/scripts/mmk-io.php&scope=email,public_profile&state=' + state; socialLoginPopupWindow(fbLoginUrl,'facebook', value); //console.log(fbLoginUrl); } function logoutCustomer(e,el) { e.preventDefault(); console.log('loggin user out'); //return; logoutAmazon(); const target = $(el).attr('href'); setTimeout(function() { window.location.href = target; }, 150); } function logoutAmazon() { if(window.amazon && amazon.Login) { amazon.Login.logout(); //const cookies = [ // 'amazon_Login_state_cache', // 'amazon_Login_accessToken', // 'amazon_Login_accessToken_expiresIn', // 'amazon_Login_accessToken_issueTime' //]; //cookies.forEach(c => { // document.cookie = c + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; // }); } if (amazon.Pay) { amazon.Pay.signout(); } /* V2 */ } $(window).on('resize', function() { resizeNavigation() }); function resizeNavigation() { //console.log($(window).height(),$(window).width(),gw); if($(window).width()!=gw) { if ($(window).width() < 1500) { $('.usLoggedText').hide(); $('.usText').hide(); } else { $('.usLoggedText').show(); $('.usText').show(); } /* HIDE LOGIN MENU */ $('#mmkmenu .userPanel, #mmkRespMenu .userPanel').hide(); } }